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

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

Description

i1 : NNParser "1"

o1 = -*Function[/usr/share/Macaulay2/Parsing.m2:152:40-152:102]*-

o1 : Parser
i2 : oo null

o2 = 1
i3 : ooo "2"

o3 = -*Function[/usr/share/Macaulay2/Parsing.m2:152:40-152:102]*-

o3 : Parser
i4 : oo null

o4 = 12
i5 : ooo "3"

o5 = -*Function[/usr/share/Macaulay2/Parsing.m2:152:40-152:102]*-

o5 : Parser
i6 : oo null

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

o7 = 123456789123456789123456789
i8 : class oo

o8 = ZZ

o8 : Ring

Code

../../../../../../../Macaulay2/packages/Parsing.m2:153:30-153:58: --source code:
          new Parser from (c -> if digit#?c then f digit#c)
| symbol   class              value location of symbol
| ------   -----              ----- ------------------                                              
| f      : FunctionClosure -- ...   ../../../../../../../Macaulay2/packages/Parsing.m2:152:11-152:12

See also

For the programmer

The object NNParser is a parser.