[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
custom error handling
I have my app working with SableCC, and it's great: very fast, and easy to
implement for our needs (a business rules engine). My only complaint is
error reporting. Short of parsing the LexerException and ParserException
message strings, I don't see a way to extract the expected symbols so I
can use them to create a more meaningful error. For example, I'd rather
have "expecting 'and' or 'or'" rather than "TAnd TOr." _I_ know what that
means, but a typical user should not need to know the token names to
figure out a parse error. In fact, SableCC should have all the information
required, no? It already has the state names and their literal text values
from the grammar.
Is there a way to do this I haven't found? I see back in May of last year
someone offered a patch to do just this, but no one replied and I assume
the patch is quite out of date now.
Kudos for writing a compiler-compiler you can get something useful out of
in a day's work!