org.norecess.antlr
Interface IANTLRFrontEnd


public interface IANTLRFrontEnd

Used as a factory to create the front-end components for an ANTLR tester. You need only provide useful definitions for the front-end components that you actually test. (If you don't test the component, ANTLRTester won't instantiate them.)

Author:
Jeremy D. Frens
See Also:
ANTLRTester

Method Summary
 org.antlr.runtime.Lexer createLexer(String input)
          Creates a lexer.
 org.antlr.runtime.Parser createParser(org.antlr.runtime.TokenStream stream)
          Creates a parser from the token stream.
 org.antlr.runtime.tree.TreeParser createTreeParser(org.antlr.runtime.tree.Tree tree)
          Creates a tree parser from the given tree.
 

Method Detail

createLexer

org.antlr.runtime.Lexer createLexer(String input)
Creates a lexer. The input is the raw code (as a String) that should be processed by the lexer. Use ANTLRStringStream to convert the String for the lexer:
 return new MyOwnLexer(new ANTLRStringStream(input));
 

Parameters:
input - the raw code to be scanned.
Returns:
an instance of your lexer ready to process the input.

createParser

org.antlr.runtime.Parser createParser(org.antlr.runtime.TokenStream stream)
Creates a parser from the token stream. The token stream is created from the lexer returned by createLexer(String) (done automatically by ANTLRTester). Your parser's constructor should be able to receive the token stream directly:
 return new MyOwnParser(stream);
 

Parameters:
stream - the token stream.
Returns:
an instance of your parser based on the token stream.

createTreeParser

org.antlr.runtime.tree.TreeParser createTreeParser(org.antlr.runtime.tree.Tree tree)
Creates a tree parser from the given tree. The tree is generated from the parser returned by createParser(TokenStream) when used with an ANTLRTester. Your tree-parser's constructor needs a tree-node stream (and you can use CommonTreeNodeStream):
 return new MyOwnTreeParser(new CommonTreeNodeStream(tree));
 

Parameters:
tree - the tree to parse.
Returns:
an instance of your tree parser based on the tree.