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

constParser -- produce a parser that accepts a fixed string, one character at a time

Synopsis

Description

i1 : constParser "abc"

o1 = -*Function[/usr/share/Macaulay2/Parsing.m2:148:51-148:146]*-

o1 : Parser
i2 : oo "a"

o2 = -*Function[/usr/share/Macaulay2/Parsing.m2:148:51-148:146]*-

o2 : Parser
i3 : oo "a"
i4 : ooo "b"

o4 = -*Function[/usr/share/Macaulay2/Parsing.m2:148:51-148:146]*-

o4 : Parser
i5 : oo "c"

o5 = -*Function[/usr/share/Macaulay2/Parsing.m2:148:51-148:146]*-

o5 : Parser
i6 : oo null

o6 = abc
i7 : (constParser "abc" : charAnalyzer) "abc"

o7 = abc

See also

For the programmer

The object constParser is a function closure.