parent
11147c7bc0
commit
635b02ca27
|
@ -318,6 +318,12 @@ MEMO: range ( min max -- parser )
|
||||||
: choice ( seq -- parser )
|
: choice ( seq -- parser )
|
||||||
choice-parser construct-boa init-parser ;
|
choice-parser construct-boa init-parser ;
|
||||||
|
|
||||||
|
: 2choice ( parser1 parser2 -- parser )
|
||||||
|
2array choice ;
|
||||||
|
|
||||||
|
: 3choice ( parser1 parser2 parser3 -- parser )
|
||||||
|
3array choice ;
|
||||||
|
|
||||||
: choice* ( quot -- paser )
|
: choice* ( quot -- paser )
|
||||||
{ } make choice ; inline
|
{ } make choice ; inline
|
||||||
|
|
||||||
|
@ -348,8 +354,15 @@ MEMO: hide ( parser -- parser )
|
||||||
MEMO: delay ( parser -- parser )
|
MEMO: delay ( parser -- parser )
|
||||||
delay-parser construct-boa init-parser ;
|
delay-parser construct-boa init-parser ;
|
||||||
|
|
||||||
|
MEMO: (list-of) ( items separator repeat1? -- parser )
|
||||||
|
>r over 2seq r> [ repeat1 ] [ repeat0 ] if [ concat ] action 2seq
|
||||||
|
[ unclip 1vector swap first append ] action ;
|
||||||
|
|
||||||
MEMO: list-of ( items separator -- parser )
|
MEMO: list-of ( items separator -- parser )
|
||||||
hide over 2seq repeat0 [ concat ] action 2seq [ unclip 1vector swap first append ] action ;
|
hide f (list-of) ;
|
||||||
|
|
||||||
|
MEMO: list-of* ( items separator -- parser )
|
||||||
|
hide t (list-of) ;
|
||||||
|
|
||||||
MEMO: 'digit' ( -- parser )
|
MEMO: 'digit' ( -- parser )
|
||||||
[ digit? ] satisfy [ digit> ] action ;
|
[ digit? ] satisfy [ digit> ] action ;
|
||||||
|
|
Loading…
Reference in New Issue