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

Function % Parser -- transform the value returned by a parser

Synopsis

Description

i1 : (* constParser "abc" : charAnalyzer) "abcabcabc"

o1 = (abc, abc, abc)

o1 : Sequence
i2 : (concatenate % * constParser "abc" : charAnalyzer) "abcabcabc"

o2 = abcabcabc
i3 : (constParser "abc" : charAnalyzer) "abc"

o3 = abc
i4 : ((s -> concatenate("[",s,"]")) % constParser "abc" : charAnalyzer) "abc"

o4 = [abc]

Code

../../../../../Macaulay2/packages/Parsing.m2:94:29-94:121: --source code:
Function % Parser := (fun,p) -> new Parser from ( c -> if (p' := p c) =!= null then if c === null then fun p' else fun % p' )

See also

Ways to use this method: