[ prog / sol / mona ]

prog


How can I run my own instance of this

93 2020-02-26 01:35

Irregex PCRE x{m,n} ranges are parsed into SRE (** m n x) ranges in string->sre -> named let lp -> main parsing -> case c -> branch (#\{). The crucial bit is:

(m
 (lp (+ j 1) (+ j 1) flags `((** ,n ,m ,x) ,@tail) st))

which is at lines {962,963} in the "0.9.6: 2016/12/05" version of deps/irregex.scm from SchemeBBS on "20 Feb, 2020 4 commits". The irregex-search breakage does not depend on PCRE parsing and can be demonstrated directly on SRE. The same conditions I explained in >>91 hold for SRE:

$ guile -l irregex.scm 
scheme@(guile-user)> (define (imsis re str) (irregex-match-substring (irregex-search re str)))
scheme@(guile-user)> (imsis '(** 0 3 (or "a" "ab")) "abab")
is/m->backtrack $1 = "a"
scheme@(guile-user)> (imsis '(** 0 3 (or "ab" "a")) "abab")
is/m->backtrack $2 = "abab"
scheme@(guile-user)> (imsis '(* (or "a" "ab")) "abab")
is/m->dfa is/m->shortest $3 = "abab"
scheme@(guile-user)> 

The bug is now quite likely to be in irregex-search/backtrack with (** m n (or x y)) constructs.

SRE irregex reference:
http://synthcode.com/scheme/irregex/#SECTION_3.2

301


VIP:

do not edit these