[Haskell-cafe] parsec: how to get end location

Stephen Tetley stephen.tetley at gmail.com
Mon Jun 14 05:52:42 EDT 2010


Hi Roman

You would need different behaviour for the /lexeme/ parser in
Parsec.Token at least - this is the combinator that promotes a parser
to also consume trailing whitespace.

I suspect you would have to recode most of Parsec.Token module - the
TokenParser is a parameterized module (in the sense of Sheard and
Pasalic [1]), unfortunately /lexeme/ is not one of the parameters and
other combintators are defined using it within the makeTokenParser
function which instantiates the parameterized module.


Alternative you could remake a set of token parsers - this is covered
in the Parsec manual [2] - section 2.11 "Advanced: Separate scanners".

[1] http://web.cecs.pdx.edu/~sheard/papers/JfpPearl.ps
[2] http://legacy.cs.uu.nl/daan/download/parsec/parsec.pdf

Best wishes

Stephen


More information about the Haskell-Cafe mailing list