From 2136abc1d64705805c5274337a799077f4b317e4 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 17 Mar 2019 09:52:53 -0700 Subject: [PATCH] regexp: fix take-until to handle escapes at the end of a regexp. this worked: R\ //.\ this didn't: R\ //\ --- basis/regexp/regexp.factor | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/basis/regexp/regexp.factor b/basis/regexp/regexp.factor index 19d2d8710b..c31571c718 100644 --- a/basis/regexp/regexp.factor +++ b/basis/regexp/regexp.factor @@ -200,10 +200,11 @@ PRIVATE> : take-until ( lexer -- string ) dup skip-blank [ dupd [ - [ CHAR: / -rot index-from ] keep - over [ "Unterminated regexp" throw ] unless - 2dup [ 1 - ] dip nth CHAR: \\ = - [ [ [ 1 + ] dip ] when ] keep + [ [ "\\/" member? ] find-from ] keep swap [ + CHAR: \ = [ [ 2 + ] dip t ] [ f ] if + ] [ + "Unterminated regexp" throw + ] if* ] loop over [ subseq ] dip 1 + ] change-lexer-column ; -- 2.34.1