Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools JavaCC > ParseExceptions...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 445 of 548
Post > Topic >>

ParseExceptions and TokenMgrErrors

by "Ulrich Hobelmann" <ulrich.hobelmann@[EMAIL PROTECTED] > Jan 11, 2007 at 07:16 AM

I encountered a situation where my JavaCC parser does not simply throw
a ParseException on unwanted/undeclared input, but it throws a
TokenMgrError (which, simply put, was not good for the rest of the
application).  This happens when the input ends in \ , i.e. a
backslash.

Solution is easy: transform the exceptional condition "parser does not
like token" into an exceptional condition "parser does not like input",
i.e. catch Error and rethrow ParseException.  However, I think this
should not be necessary.  When JavaCC's parser encounters an undeclared
Token (I had no TOKEN rule involving \ ), it should simply throw a
ParseException, because what's the difference between having a Token
that does not match any possible grammar production, and having a
Character that does not match any possible TOKEN rule?  To me both
kinds of error look similar, i.e. they should be in the same 'class'
(like ParseException).
 




 1 Posts in Topic:
ParseExceptions and TokenMgrErrors
"Ulrich Hobelmann&qu  2007-01-11 07:16:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 23:49:41 CDT 2008.