
Am 09.03.2011 14:44, schrieb Christian Maeder:
Am 08.03.2011 13:50, schrieb Christian Maeder:
Am 08.03.2011 13:35, schrieb Hauschild, Klaus (EXT):
Hi Christian,
Thank you for your help. Now the current version of Parse.hs (http://code.google.com/p/hgmltracer/source/browse/trunk/hGmlTracer/src/Gml/P...) works well for the test file fact.gml.
spaces char end
The idea is to call spaces _after_ every token.
In other words "spaces" before "char end" is not needed.
But in your top-level parser you may want to skip leading spaces and check for a final "eof" to ensure that everything was consumed. spaces >> liftM2 const parseList eof (Instead of "liftM2 const" the symbol "<*" from "Control.Applicative" may be used: spaces *> parseList <* eof) I defined: infixl 1 << (<<) :: Monad m => m a -> m b -> m a (<<) = liftM2 const and would use: spaces >> parseList << eof C.