list-of ( items separator -- parser )


Vocabulary
peg.parsers

Inputs
itemsa sequence
separatora parser


Outputs
parsera parser


Word description
Returns a parser that returns a list of items separated by the separator parser. Hides the separators and matches a list of one or more items.

Notes
Use list-of-many to ensure a list contains two or more items.

Examples
USING: peg peg.parsers prettyprint ; "a" "a" token "," token list-of parse .
V{ "a" }

USING: peg peg.parsers prettyprint ; "a,a,a,a" "a" token "," token list-of parse .
V{ "a" "a" "a" "a" }


See also
list-of-many

Definition


: list-of ( items separator -- parser ) hide f (list-of) ;