each-token ( ... end quot: ( ... token -- ... ) -- ... )
Factor handbook > The language > Parsing words > Parsing raw tokens

Next:map-tokens ( ... end quot: ( ... token -- ... elt ) -- ... seq )


Vocabulary
lexer

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


Word description
Reads a sequence of tokens until the first occurrence of end. quot is called on each token as it is read.

Examples
This word is used to implement USING:.

Notes
This word should only be called from parsing words.

See also
parse-tokens, map-tokens, (parse-until), parse-until

Definition


: each-token ( ... end quot: ( ... token -- ... ) -- ... )
[ scan-token ] 2dip 2over =
[ 3drop ] [ [ nip call ] [ each-token ] 2bi ] if ; inline
recursive