<PRIVATE
-M: lookahead question>quot ! Returns ( index string -- ? )
+M: lookahead question>quot
+ ! Returns ( index string -- ? )
term>> ast>dfa dfa>shortest-word '[ f _ execute ] ;
: <reversed-option> ( ast -- reversed )
"r" string>options <with-options> ;
-M: lookbehind question>quot ! Returns ( index string -- ? )
+M: lookbehind question>quot
+ ! Returns ( index string -- ? )
term>> <reversed-option>
ast>dfa dfa>reverse-shortest-word
'[ [ 1 - ] dip f _ execute ] ;
: regexp-initial-word ( i string regexp -- i/f )
[ compile-regexp ] with-compilation-unit match-index-from ;
-M: regexp compile-regexp ( regexp -- regexp )
+M: regexp compile-regexp
dup '[
dup \ regexp-initial-word =
[ drop _ get-ast ast>dfa dfa>word ] when
] change-dfa ;
-M: reverse-regexp compile-regexp ( regexp -- regexp )
+M: reverse-regexp compile-regexp
t backwards? [ call-next-method ] with-variable ;
DEFER: compile-next-match