integer-parser ( -- parser ) (original) (raw)

Vocabulary
parser-combinators.simple

Inputs
None

Outputs

parser a parser object

Word description
Return a parser that consumes an integer from the input string. The numeric value of the integer consumed is the result of the parse.

Examples

USING: lists.lazy parser-combinators parser-combinators.simple prettyprint ; "123" integer-parser parse-1 .
123

See also
$see-also, digit-parser, string-parser, bold-parser, italic-parser, comma-list

Definition

USING: math.parser parser-combinators unicode ;

IN: parser-combinators.simple

: integer-parser ( -- parser )
[ digit? ] satisfy <*> [ string>number ] <@ ;