From a5d450de63f4e60890fabc875164c65896fee709 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 3 Dec 2007 22:43:33 -0600 Subject: [PATCH] Add stubs for ^ and $ --- extra/regexp/regexp.factor | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 ;