[antlr-interest] ANTLRWorks problem
Lucio Biondi
lbiondi at olijo.com
Tue Apr 10 06:14:53 PDT 2007
Ok, I could safely ignore a warning in the combined lexer/parser grammar I'm working on,
but it prevents me from using ANTLRWorks. And, admitting I can't live by now without it
(great work Terence & Jean, it's very handy :-), I just need to resolve the error.
So, that's the matter
I'm getting a "no lexer rule corresponding to token: FLOAT_CONST" error message, but
don't know how to overcome this. All things seem right in the grammar, and it works even ;-)
The token FLOAT_CONST is present in all files generated by antlr, and I have tried as well
different ways for setting the rule type
setType(FLOAT_CONST)
$type = FLOAT_CONST
but the error message persists.
Googling I found this old answer by Ter but it doesn't help me.
>> I also don't know what to do about the 'no lexer rule corresponding
>> to token: >> VISIT_IDENTIFIER' warning.
> Hmm...yes, should not get a warning in this case...added to list.
Any hints ? Am I missing some new antlr3 rule ?
thanks in advance
Lucio
grammar Givvy;
...
tokens {
FLOAT_CONST; // Imaginary
}
...
atom
: FLOAT_CONST
...
;
/**** LEXER ****/
INT_CONST
: '1'..'9' ('0'..'9')* ((IS_FLOAT_CONST) => { _type = FLOAT_CONST; })?
...
;
fragment
IS_FLOAT_CONST
: '.' { input.LA(1) >= '0' && input.LA(1) <= '9'}? => DIGITS EXPONENT? FLOAT_SUFFIX?
| EXPONENT FLOAT_SUFFIX?
| FLOAT_SUFFIX
;
More information about the antlr-interest
mailing list