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
Item AST values equal to ignore are omitted. Hidden items still count toward the minimum number of matches, so the result may be empty.

Use list-of-many to require two or more item matches.

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