Parsing raw tokens
Factor handbook » The language » Parsing words

Prev:Defining words
Next:Reflection support for vocabulary search path


So far we have seen how to read individual tokens, or read a sequence of parsed objects until a delimiter. It is also possible to read raw tokens from the input and perform custom processing.

One example is the USING: parsing word.

It reads a list of vocabularies terminated by ;. However, the vocabulary names do not name words, except by coincidence; so parse-until cannot be used here. Instead, a set of lower-level combinators can be used:
each-token ( ... end quot: ( ... token -- ... ) -- ... )

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

parse-tokens ( end -- seq )