I found in ANTLR V3, before Parser rules began to be appiled, all the tokens
have been recognized(That is also to say that all the Lexer Rules have been
applied.).
Such as this rule:
IDENT
: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
{
$type=globalSearchId($text);
}
;
globalSearchId() will be called N times before any parser rule is about to
be appiled
Is it right?
Is there any way to let the Lexer rule of the token to be applied just
before this token is met by the Parser?
If it works in this way, in the above example, globalSearchId will be called
once the IDENT is met in the Parser Rule like:
type_id : id=IDENT { addId($id.getText(),TYPE_IDENT); $s=$id.getText(); }
As far as I know, ANTLR V2 works in this way.
Is there any way to do that in ANTLR V3?
Thanks very much.
Best Regards,
chainone
--~--~---------~--~----~------------~-------~--~----~
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:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address