
13 Jun
2010
13 Jun
'10
11:08 p.m.
On Mon, Jun 14, 2010 at 12:10 AM, Roman Cheplyaka
Of course most parsers don't consume trailing newlines. But I was writing general function to use in many places in the code which would recover the end location. In most cases it just subtracts 1 from the column number, but what if it just happened so that column number is 1?
Parsec can handle state, right ? You could modify the parsers for white space so they record the beginning position in some state. ( In a maybe ) Then, modify parseWithLocation to set the state position to nothing, parse p then if no position has been recorded in the state , use the current position, else use the position in the state. Excuse me if this is unclear or confused, it's late :) David.