On 6/14/10 0:10, Roman Cheplyaka wrote:
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
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 sens
On Mon, Jun 14, 2010 at 12:10 AM, Roman Cheplyaka wrote:
> 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
* Antoine Latter [2010-06-13 16:47:28-0500]
> On Sun, Jun 13, 2010 at 4:17 PM, Roman Cheplyaka wrote:
> > Suppose I have some parser 'p'. I want to parse it as well as get its
> > span in the text. So I could write
> >
> > \begin{code]
> > pWithLocation = do
> > loc_start <- getPosition
> > pva
On Sun, Jun 13, 2010 at 4:17 PM, Roman Cheplyaka wrote:
> Suppose I have some parser 'p'. I want to parse it as well as get its
> span in the text. So I could write
>
> \begin{code]
> pWithLocation = do
> loc_start <- getPosition
> pval <- p
> loc_end <- getPosition
> return (pval,loc_start,lo
Suppose I have some parser 'p'. I want to parse it as well as get its
span in the text. So I could write
\begin{code]
pWithLocation = do
loc_start <- getPosition
pval <- p
loc_end <- getPosition
return (pval,loc_start,loc_end)
\end{code}
except that loc_end gives me the location _after_ '