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

optP -- making a parser optional

Synopsis

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.