Elnur Cabarov wrote:
Hi, I'm trying to get custom AST from Java grammar

importDeclaration

    :   'import' 'static'? qualifiedName ('.' '*')? ';' -> qualifiedName
    ;

qualifiedName
    :   Identifier ('.' Identifier)*
    ;

How can I get single tree node for the whole import statement?

For example
org.antlr.runtime.ANTLRFileStream  instead of

org
.
antlr
.
runtime
.
ANTLRFileStream

Don't use the 'literals', make these lexer rules, then change to:

importDeclaration
    :   IMPORT^ STATIC? qualifiedName SEMI!
    ;

qualifiedName
    :   Identifier (DOT^ Identifier)* (DOT^ STAR)?
    ;



or something similar.

Jim

--~--~---------~--~----~------------~-------~--~----~
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