Macaulay2 » Documentation
Packages » Parsing » Parser » optP
next | previous | forward | backward | up | index | toc

optP -- making a parser optional

Description

After the first token, the parser is no slower than p would have been.

i1 : (optP constParser "abc" : charAnalyzer) "abc"

o1 = abc
i2 : (optP constParser "abc" : charAnalyzer) ""

o2 = nil

o2 : Symbol

See also

For the programmer

The object optP is a function closure.


The source of this document is in /build/reproducible-path/macaulay2-1.25.06+ds/M2/Macaulay2/packages/Parsing.m2:502:0.