next | previous | forward | backward | up | top | index | toc | home
Parsing > Parser > NNParser

NNParser -- a parser that accepts (and returns) a natural number, one character at a time

Description

i1 : NNParser "1"

o1 = {*Function[Parsing.m2:149:39-149:101]*}

o1 : Parser
i2 : oo null

o2 = 1
i3 : ooo "2"

o3 = {*Function[Parsing.m2:149:39-149:101]*}

o3 : Parser
i4 : oo null

o4 = 12
i5 : ooo "3"

o5 = {*Function[Parsing.m2:149:39-149:101]*}

o5 : Parser
i6 : oo null

o6 = 123
i7 : (NNParser : charAnalyzer) "123456789123456789123456789"

o7 = 123456789123456789123456789
i8 : class oo

o8 = ZZ

o8 : Ring

See also

Code

-- Parsing.m2:150
          new Parser from (c -> if digit#?c then f digit#c)
| symbol   class              value                                   location of symbol
| ------   -----              -----                                   ------------------      
| f      : FunctionClosure -- {*Function[Parsing.m2:149:17-149:101]*} Parsing.m2:149:10-149:10