org.norecess.antlr
Class ANTLRTester
java.lang.Object
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
myFrontEnd
private final IANTLRFrontEnd myFrontEnd
ANTLRTester
public ANTLRTester(IANTLRFrontEnd frontEnd)
- Constructs a tester with a factory for your front end.
- Parameters:
frontEnd - the front-end factory.
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.
createLexer
private org.antlr.runtime.Lexer createLexer(String string)