map-tokens ( ... end quot: ( ... token -- ... elt ) -- ... seq )
Factor handbook » The language » Parsing words » Parsing raw tokens

Prev:each-token ( ... end quot: ( ... token -- ... ) -- ... )
Next:parse-tokens ( end -- seq )


Vocabulary
lexer

Inputs
enda string
quota quotation with stack effect ( ... token -- ... elt )


Outputs
seqa sequence of objects


Word description
Reads a sequence of tokens until the first occurrence of end. quot is called on each token as it is read, and the results are collected into a new output sequence.

Notes
This word should only be called from parsing words.

See also
parse-tokens, each-token, (parse-until), parse-until

Definition


: map-tokens
( ... end quot: ( ... token -- ... elt ) -- ... seq )
collector [ each-token ] dip { } like ; inline