diff --git a/extra/regexp/regexp.factor b/extra/regexp/regexp.factor index d60011c41c..55d15aed42 100755 --- a/extra/regexp/regexp.factor +++ b/extra/regexp/regexp.factor @@ -41,7 +41,7 @@ MACRO: fast-member? ( str -- quot ) dup alpha? swap punct? or ; : 'ordinary-char' ( -- parser ) - [ "\\^*+?|(){}[" fast-member? not ] satisfy + [ "\\^*+?|(){}[$" fast-member? not ] satisfy [ [ = ] curry ] <@ ; : 'octal-digit' ( -- parser ) [ octal-digit? ] satisfy ; @@ -185,7 +185,13 @@ C: group-result <+> [ ] <@ ; LAZY: 'regexp' ( -- parser ) - 'term' "|" token nonempty-list-of [ ] <@ ; + 'term' "|" token nonempty-list-of [ ] <@ + "^" token 'term' "|" token nonempty-list-of [ ] <@ + &> [ "caret" print ] <@ <|> + 'term' "|" token nonempty-list-of [ ] <@ + "$" token <& [ "dollar" print ] <@ <|> + "^" token 'term' "|" token nonempty-list-of [ ] <@ &> + "$" token [ "caret dollar" print ] <@ <& <|> ; TUPLE: regexp source parser ;