...
To use a grammar T.g
:
Code Block |
---|
package package { import flash.display.Sprite; import org.antlr.runtime.*; public class AntlrActionScriptTest extends Sprite { public function AntlrActionScriptTest ( ):void { var lexer:TLexer = new TLexer ( new ANTLRStringStream ( input ) ); var tokens:CommonTokenStream = CommonTokenStream ( lexer ); var parser:TParser = TParser ( tokens ); parser.entry_rule ( ); } } } |
If you want to access the tokens types in your code, you'll have to import and access them from the lexer or parser module (e.g. TLexer.EOF, TLexer.IDENTIFIER):
...