surrounded-by ( parser begin end -- parser' )


Vocabulary
peg.parsers

Inputs
parsera parser
begina string
enda string


Outputs
parser'a parser


Word description
Calls token on begin and end to make them into string parsers. Returns a parser that parses the begin, body, and end parsers in order. The begin and end parsers are hidden.

Examples
USING: peg peg.parsers prettyprint ; "hi123bye" integer-parser "hi" "bye" surrounded-by parse .
123


See also
pack

Definition


: surrounded-by ( parser begin end -- parser' )
[ token ] bi@ swapd pack ;