[bitc-dev] Implementation of indentation-aware parse
Sam Mason
sam at samason.me.uk
Thu Feb 26 20:01:18 EST 2009
On Thu, Feb 26, 2009 at 05:22:24PM -0500, Jonathan S. Shapiro wrote:
> Thank you. That is informative. And yes, subject to that constraint I
> know how to do this entirely in the lexer. It's a rather horrible
> kludge, because context-sensitive lexing sucks, but it can be made to
> work.
Yes, I came to the same conclusion but from the point of view of what
constraints would I need to apply to do it only in the lexer. Nicely
it matched what Geoffrey described. I'd maintain some brace depth and
ignore new lines when inside at least one brace. A block open/close is
returned when the indent depth increases/decreases respectively. A bit
grim, but seems like a simple enough hack. Python gives the appropriate
errors when I fail to follow these rules which is somewhat nice.
--
Sam http://samason.me.uk/
More information about the bitc-dev
mailing list