digit-parser ( -- parser ) (original) (raw)

Vocabulary
parser-combinators.simple

Inputs
None

Outputs

parser a parser object

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

Examples

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

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

Definition

USING: math.parser parser-combinators unicode ;

IN: parser-combinators.simple

: digit-parser ( -- parser ) [ digit? ] satisfy [ digit> ] <@ ;