diff --git a/extra/parser-combinators/parser-combinators.factor b/extra/parser-combinators/parser-combinators.factor index 5741c801f7..199f0cb136 100755 --- a/extra/parser-combinators/parser-combinators.factor +++ b/extra/parser-combinators/parser-combinators.factor @@ -190,6 +190,10 @@ M: some-parser (parse) ( input parser -- result ) #! Same as <&> except flatten the result. <&> [ dup second swap first [ , % ] { } make ] <@ ; +: <:&:> ( parser1 parser2 -- result ) + #! Same as <&> except flatten the result. + <&> [ dup second swap first [ % % ] { } make ] <@ ; + LAZY: <*> ( parser -- parser ) dup <*> <&:> { } succeed <|> ; @@ -263,4 +267,4 @@ LAZY: <(+)> ( parser -- parser ) nonempty-list-of { } succeed <|> ; LAZY: surrounded-by ( parser start end -- parser' ) - [ token ] 2apply swapd pack ; \ No newline at end of file + [ token ] 2apply swapd pack ; diff --git a/extra/regexp/regexp.factor b/extra/regexp/regexp.factor index c7abaada26..79f826bafa 100644 --- a/extra/regexp/regexp.factor +++ b/extra/regexp/regexp.factor @@ -1,6 +1,6 @@ USING: combinators kernel lazy-lists math math.parser -namespaces parser parser-combinators promises sequences -strings ; +namespaces parser parser-combinators parser-combinators.simple +promises sequences strings ; USING: continuations io prettyprint ; IN: regexp @@ -17,8 +17,6 @@ IN: regexp : 'string' 'char' <+> [ >string token ] <@ ; -: 'integer' [ digit? ] satisfy <+> [ string>number ] <@ ; - : exactly-n ( parser n -- parser' ) swap <repetition> and-parser construct-boa ;