[Haskell-cafe] Re: Proving my point
Philippa Cowderoy
flippa at flippac.org
Fri May 16 16:57:00 EDT 2008
On Fri, 16 May 2008, Achim Schneider wrote:
> Philippa Cowderoy <flippa at flippac.org> wrote:
>
> > On Fri, 16 May 2008, Achim Schneider wrote:
> >
> > Guess who ran into that with a separate token for
> > layout-inserted braces?
> >
> It can't be me, as I attempted to be as lazy as possible, not going for
> a tokenising pass, and ended up being too lazy.
>
Nah, you just picked the wrong way to attempt discipline. I don't use
separate tokenising/lexing passes in a lot of my code (though you can't
really avoid it when you want to do layout), it's a matter of knowing how
it's done. Unless you've got a lexical structure that prevents it (which
is to say, there're situations in which two tokens following each other
aren't allowed to have whitespace between them), it's a good idea to have
your token productions eat any whitespace following them, and then your
toplevel becomes:
do {whitespace; r <- realTopLevel; eof; return r}
and then you need never worry about it again.
--
flippa at flippac.org
Ivanova is always right.
I will listen to Ivanova.
I will not ignore Ivanova's recomendations.
Ivanova is God.
And, if this ever happens again, Ivanova will personally rip your lungs out!
More information about the Haskell-Cafe
mailing list