at-most-n ( parser n -- parser' )


Vocabulary
peg.parsers

Inputs
parsera parser
nan integer


Outputs
parser'a parser


Word description
Returns a parser that matches n or fewer repetitions of the input parser.

Examples
USING: peg peg.parsers prettyprint ; "aaaa" "a" token 4 at-most-n parse .
V{ "a" "a" "a" "a" }

USING: peg peg.parsers prettyprint ; "aaaaa" "a" token 4 at-most-n parse .
V{ "a" "a" "a" "a" }


See also
exactly-n, at-least-n, from-m-to-n

Definition