]> gitweb.factorcode.org Git - factor.git/commitdiff
Revert "regexp: fix take-until to handle escapes at the end of a regexp."
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 18 Mar 2019 17:42:40 +0000 (10:42 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 18 Mar 2019 17:42:40 +0000 (10:42 -0700)
This reverts commit 2136abc1d64705805c5274337a799077f4b317e4.

basis/regexp/regexp.factor

index c31571c718711f02bec2549ec94bd848a02afc49..19d2d8710b9f884fd927b5e2300002b09401364b 100644 (file)
@@ -200,11 +200,10 @@ PRIVATE>
 : take-until ( lexer -- string )
     dup skip-blank [
         dupd [
-            [ [ "\\/" member? ] find-from ] keep swap [
-                CHAR: \ = [ [ 2 + ] dip t ] [ f ] if
-            ] [
-                "Unterminated regexp" throw
-            ] if*
+            [ CHAR: / -rot index-from ] keep
+            over [ "Unterminated regexp" throw ] unless
+            2dup [ 1 - ] dip nth CHAR: \\ =
+            [ [ [ 1 + ] dip ] when ] keep
         ] loop over [ subseq ] dip 1 +
     ] change-lexer-column ;