Posted By:
Peter_Liddle
Posted On:
Saturday, May 10, 2003 12:21 PM
Hey Guys I have a grammar i have made that goes through and picks out parts of my source code and puts them into a AST. My problem is when i output the AST to an XML file or print it to screen i only get the tree for the first rule but my other rules are set up the same as the first one. This one works :- importDefinition : i:""import""^ {#i.setType(IMPORT);} identifierStar SEMI! {System.out.println(""import found"");} ; This one doesn't (well it doesn't appear in XML output or the text print of the AST) classDefinition//[AST modifiers] : c:""class""^ IDENT cb:templateBlock
More>>
Hey Guys
I have a grammar i have made that goes through and picks out parts of my source code and puts them into a AST. My problem is when i output the AST to an XML file or print it to screen i only get the tree for the first rule but my other rules are set up the same as the first one.
This one works :-
importDefinition
: i:""import""^ {#i.setType(IMPORT);} identifierStar SEMI!
{System.out.println(""import found"");}
;
This one doesn't (well it doesn't appear in XML output or the text print of the AST)
classDefinition//[AST modifiers]
: c:""class""^ IDENT
cb:templateBlock
{System.out.println(""Class Found""); #c.setType(CLASS);}
;
<<Less