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

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:30-94:122: --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