Fix regexp parsing word bug

db4
Slava Pestov 2008-04-17 03:03:33 -05:00
parent 4eb4542431
commit b2a3bfa466
2 changed files with 12 additions and 4 deletions

View File

@ -226,3 +226,10 @@ IN: regexp-tests
[ t ] [ "s@f" "[a-z.-]@[a-z]" f <regexp> matches? ] unit-test
[ f ] [ "a" "[a-z.-]@[a-z]" f <regexp> matches? ] unit-test
[ t ] [ ".o" "\\.[a-z]" f <regexp> matches? ] unit-test
! Bug in parsing word
[ t ] [
"a"
R' a'
matches?
] unit-test

View File

@ -290,10 +290,11 @@ TUPLE: regexp source parser ignore-case? ;
} case ;
: parse-regexp ( accum end -- accum )
lexer get dup skip-blank [
[ index* dup 1+ swap ] 2keep swapd subseq swap
] change-lexer-column
lexer get (parse-token) parse-options <regexp> parsed ;
lexer get dup skip-blank
[ [ index* dup 1+ swap ] 2keep swapd subseq swap ] change-lexer-column
lexer get dup still-parsing-line?
[ (parse-token) parse-options ] [ drop f ] if
<regexp> parsed ;
: R! CHAR: ! parse-regexp ; parsing
: R" CHAR: " parse-regexp ; parsing