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 > JavaCC can't le...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 444 of 549
Post > Topic >>

JavaCC can't lex numbers

by "Ulrich Hobelmann" <ulrich.hobelmann@[EMAIL PROTECTED] > Jan 10, 2007 at 08:58 AM

Hi, I have the following token specifications, and it seems like any
number (i.e. sequence of digits) will not parse as a number.

TOKEN : {
	  [ ... ]
	| < NUMBER: (<DIGIT>)+ ("." (<DIGIT>)+ )? >
	| <#DIGIT: ["0" - "9"]>
[...]
}

I also tried rewriting the NUMBER spec, by creating a new token DOT,
and by factoring the <DOT> (<DIGIT>)+ out into yet another token, but
to no avail.

If there's anything wrong with my syntax, JavaCC doesn't complain.  The
problem is that in a context where both Identifiers (letters+digits)
and numbers are allowed, it will always choose the identifier.  In
context where only numbers are legal, I get a parse exception.

Since when is "5" not a NUMBER? ;-)
 




 2 Posts in Topic:
JavaCC can't lex numbers
"Ulrich Hobelmann&qu  2007-01-10 08:58:50 
Re: JavaCC can't lex numbers
"Ulrich Hobelmann&qu  2007-01-10 09:06:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Fri Jul 25 20:02:43 CDT 2008.