scan-number ( -- number )
Factor documentation > Factor handbook > The language > Parsing words > Reading ahead
Prev:scan-datum ( -- word/number )
Next:scan-object ( -- object )


Vocabulary
parser

Inputs and outputs
numbera number


Word description
Reads the next token from parser input. If the token is a number literal, it is converted to a number. Otherwise, it throws an error.

Errors
Throws an error if the token is not a number or end of file is reached.

Notes
This word should only be called from parsing words.

Definition
USING: lexer ;

IN: parser

: scan-number ( -- number ) (scan-token) parse-number ;