com.adamcornett.cminus
Class TestFrontEnd

java.lang.Object
  extended by com.adamcornett.cminus.TestFrontEnd
All Implemented Interfaces:
IANTLRFrontEnd

public class TestFrontEnd
extends Object
implements IANTLRFrontEnd


Constructor Summary
TestFrontEnd()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestFrontEnd

public TestFrontEnd()
Method Detail

createLexer

public org.antlr.runtime.Lexer createLexer(String input)
Description copied from interface: IANTLRFrontEnd
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));
 

Specified by:
createLexer in interface IANTLRFrontEnd
Parameters:
input - the raw code to be scanned.
Returns:
an instance of your lexer ready to process the input.

createParser

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

Specified by:
createParser in interface IANTLRFrontEnd
Parameters:
stream - the token stream.
Returns:
an instance of your parser based on the token stream.

createTreeParser

public org.antlr.runtime.tree.TreeParser createTreeParser(org.antlr.runtime.tree.Tree tree)
Description copied from interface: IANTLRFrontEnd
Creates a tree parser from the given tree. The tree is generated from the parser returned by IANTLRFrontEnd.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));
 

Specified by:
createTreeParser in interface IANTLRFrontEnd
Parameters:
tree - the tree to parse.
Returns:
an instance of your tree parser based on the tree.