org.norecess.antlr
Class ANTLRTester

java.lang.Object
  extended by org.norecess.antlr.ANTLRTester

public class ANTLRTester
extends Object

This is the entry point to using ANTLR Testing. Provide the constructor of this class with your own implementation of IANTLRFrontEnd so that the tester can construct instances of your lexer, parser, and tree parser.

Initialization typically looks like this:

 private ANTLRTester myTester;
 @Before
 public void setUp() {
   myTester = new ANTLRTester(new MyOwnFrontEnd());
 }
 

See Assert for the kinds of assertions you can make with an ANTLR tester.

Author:
Jeremy D. Frens

Constructor Summary
ANTLRTester(IANTLRFrontEnd frontEnd)
          Constructs a tester with a factory for your front end.
 
Method Summary
 PostScan scanInput(String input)
          Scans the input to generate a token stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ANTLRTester

public ANTLRTester(IANTLRFrontEnd frontEnd)
Constructs a tester with a factory for your front end.

Parameters:
frontEnd - the front-end factory.
Method Detail

scanInput

public PostScan scanInput(String input)
Scans the input to generate a token stream. The token stream is actually hidden in the PostScan return value to make assertions (like Assert.assertToken(int, String, PostScan)) or to parse the token stream (with PostScan.parseAs(String)).

See Assert for example usage.

Parameters:
input - input for the lexer
Returns:
a post-scan processor for assertion or parsing.