diff --git a/extra/peg/peg.factor b/extra/peg/peg.factor index 8c92605c44..465e0dd757 100755 --- a/extra/peg/peg.factor +++ b/extra/peg/peg.factor @@ -343,21 +343,16 @@ M: seq-parser (compile) ( parser -- quot ) TUPLE: choice-parser parsers ; -MATCH-VARS: ?quot ; - -: choice-pattern ( -- quot ) - [ - [ ?quot ] unless* - ] ; - M: choice-parser (compile) ( parser -- quot ) [ f , - parsers>> [ compiled-parser \ ?quot choice-pattern match-replace % ] each + parsers>> [ compiled-parser 1quotation , \ unless* , ] each ] [ ] make ; TUPLE: repeat0-parser p1 ; +MATCH-VARS: ?quot ; + : (repeat0) ( quot result -- result ) over call [ [ remaining>> swap (>>remaining) ] 2keep