peg.ebnf: minor cleanup.

clean-linux-x86-32
John Benediktsson 2019-09-25 20:38:19 -07:00
parent c3bee31342
commit c1ebf5451f
1 changed files with 9 additions and 7 deletions

View File

@ -1,10 +1,10 @@
! Copyright (C) 2007 Chris Double. ! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs combinators combinators.short-circuit USING: accessors assocs combinators combinators.short-circuit
effects kernel make math math.parser multiline namespaces parser effects fry kernel make math math.parser multiline namespaces
peg peg.parsers quotations sequences sequences.deep splitting parser peg peg.parsers quotations sequences sequences.deep
stack-checker strings strings.parser summary unicode splitting stack-checker strings strings.parser summary unicode
vocabs.parser words fry ; vocabs.parser words ;
FROM: vocabs.parser => search ; FROM: vocabs.parser => search ;
FROM: peg.search => replace ; FROM: peg.search => replace ;
IN: peg.ebnf IN: peg.ebnf
@ -209,8 +209,8 @@ DEFER: choice-parser
! Parse a group of choices, with a suffix indicating ! Parse a group of choices, with a suffix indicating
! the type of group (repeat0, repeat1, etc) and ! the type of group (repeat0, repeat1, etc) and
! an quot that is the action that produces the AST. ! an quot that is the action that produces the AST.
2dup
[ [
2dup
"(" [ choice-parser sp ] delay ")" syntax-pack "(" [ choice-parser sp ] delay ")" syntax-pack
swap 2seq swap 2seq
[ first ] rot compose action , [ first ] rot compose action ,
@ -278,8 +278,10 @@ DEFER: choice-parser
repeat0-parser sp , repeat0-parser sp ,
repeat1-parser sp , repeat1-parser sp ,
optional-parser sp , optional-parser sp ,
] choice* ] choice* [
[ dup , ":" syntax , "a-zA-Z" range-pattern repeat1 [ >string ] action , ] seq* [ first2 <ebnf-var> ] action , dup , ":" syntax , "a-zA-Z" range-pattern repeat1
[ >string ] action ,
] seq* [ first2 <ebnf-var> ] action ,
, ,
] choice* ; ] choice* ;