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

* Parser -- repetition of a parser

Synopsis

Description

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

o1 = (abc, abc, abc)

o1 : Sequence

Code

../../../../../../../Macaulay2/packages/Parsing.m2:130:14-141:87: --source code:
*Parser := p -> (
     f := (vals,current) -> new Parser from (c -> (
               if c === null then (
                    if current === null then vals
                    else if (val := current null) =!= null then append(vals,val)
                    )
               else (
                    if current === null then (f(vals,p)) c
                    else (
                         q := current c;
                         if q =!= null then return f(vals,q);
                         if (val = current null) =!= null then (f(append(vals,val),)) c))))

See also