On Monday, 14 May 2012 at 16:58:42 UTC, Roman D. Boiko wrote:
You are over engineering the whole stuff.
I'm trying to solve this and other tradeoffs. I'd like to
simplify but satisfy my design goals.
What if there were two different lex:er modes... with different
struct:s.
1. For an IDE with on the fly lexing:
Assumption, the error rate is high.(need to keep much info)
2. For the compiler
Assumption, the error rate is non existent, and if there is an
error it really doesn't matter if it's slow.
So... when choosing the "compiler mode"... and there actually is
an error, then just lex it again, to produce a pretty error
message ;)
try
{
lex(mode.compiler);
}
catch
{
lex(mode.ide); // calculates column etc. what ever info it
needs.
}