...
Code Block |
---|
package { import org.antlr.runtime.*; public class AntlrActionScriptTest { public function AntlrActionScriptTest (input:String):void { var lexer:TLexer = new TLexer(new ANTLRStringStream(input)); var tokens:CommonTokenStream = new CommonTokenStream(lexer); var parser:TParser = new TParser(tokens); parser.entry_rule(); } } } |
...
Code Block |
---|
package { import org.antlr.runtime.*; import org.antlr.runtime.tree.*; public class AntlrActionScriptTreeWalkerTest { public function AntlrActionScriptTest (input:String):void { var lexer:TLexer = new TLexer (new ANTLRStringStream(input)); var tokens:CommonTokenStream = new CommonTokenStream(lexer); var parser:TParser = new TParser(tokens); var r:ParserRuleReturnScope = parser.entry_rule(); // This is the root of the AST. var root:Tree = r.tree; var nodes:CommonTreeNodeStream = new CommonTreeNodeStream(root); nodes.tokenStream = tokens; var walker:TWalker = new TWalker(nodes); walker.entry_rule(); } } } |
...