10 Sep
2002
10 Sep
'02
12:56 p.m.
Jose Romildo Malaquias wrote:
Any sugestion on how to implement the 'not starting with "A:" or "B:"' problem?
Hi, I'm not familiar with Parsec, but in ParseLib it's fairly straightforward, first you add a new combinator: ifnot :: Parser a -> Parser b -> Parser b ifnot (P p1) (P p2) = P ( \s -> if parseOk (p1 s) then [] else p2 s ) where parseOk :: [(a,String)] -> Bool parseOk [x] = True parseOk _ = False then you can say: ifnot parse_a_or_b parse_foo You will need the sources of ParseLib to try it out though, because "P" isn't exported. Jan