Great replies thank you, I was assumed the longest-match wins rules applied, 
but I wasn't sure - thanks.

Here is an example of the sort of problems I am trying to figure out.


r            : 'BEGIN/' f1=(number 'T') f2=field EOT EOL
number : INT | FLOAT ;
field      : ALPHANUM_CHAR+;

ALPHANUM_CHAR : ( ALPHA_CHAR  | DIGIT | SPECIAL_CHAR | ' ')+;
INT : DIGIT+ ;
FLOAT : DIGIT+ '.' DIGIT+;
fragment DIGIT : '0' .. '9' ;
fragment ALPHA_CHAR : 'A' .. 'Z' ;
SPECIAL_CHAR: ( ',' | '(' | ')' | '\\' );  // more special chars can be added 
here....
EOT : '//'
EOL : '\n';


The following will work:

BEGIN/1231T/P//

However, the following will NOT :

BEGIN/1231T/T//

some lexer tests lead me to believe this should work:

'T' is a ALPHA_CHAR
'T' is also an ALPHANUM_CHAR

HOWEVER,
'T' is NOT a field???

Again, I can fix this by making f1 match a field instead of a number followed 
by a T.  But I would like to understand what is going on here...

Basically, if a field is supposed to have a certain suffix, I would like to put 
that in the grammar.  Of course, I still want to be able to accept those 
suffixes as a part of a more general field as well.


Thanks in advance.
Greg


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to