org.norecess.antlr
Class PostScan

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

public class PostScan
extends Object

Handles the post-processing of a successful scan by your lexer. Read the documentation for Assert for description of how to use this class.

For those who would like to know more...

Author:
Jeremy D. Frens

Field Summary
private  IANTLRFrontEnd myFrontEnd
           
private  LexerWrapper myLexerWrapper
           
 
Constructor Summary
PostScan(org.antlr.runtime.Lexer lexer, IANTLRFrontEnd frontEnd)
          Constructs a post-scan object.
PostScan(LexerWrapper lexer, IANTLRFrontEnd frontEnd)
           
 
Method Summary
private  void assertNoMoreTokens(org.antlr.runtime.Parser parser, org.antlr.runtime.RuleReturnScope result)
           
private  org.antlr.runtime.Parser createParser()
           
 org.antlr.runtime.Token getSingleToken()
          Returns a single token from the lexer's token stream, and asserts that the second token is an end-of-file.
 org.antlr.runtime.TokenSource getTokenSource()
          Returns a token source for the lexer.
private  org.antlr.runtime.RuleReturnScope invokeRuleMethod(org.antlr.runtime.Parser parser, String production)
           
 PostParse parseAs(String production)
          Parses the lexer's token stream using the specified production.
private  org.antlr.runtime.tree.Tree parseForAst(org.antlr.runtime.Parser parser, String production)
           
private  Method ruleMethod(org.antlr.runtime.Parser parser, String production)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myFrontEnd

private final IANTLRFrontEnd myFrontEnd

myLexerWrapper

private final LexerWrapper myLexerWrapper
Constructor Detail

PostScan

public PostScan(org.antlr.runtime.Lexer lexer,
                IANTLRFrontEnd frontEnd)
Constructs a post-scan object. This is used by ANTLRTester.scanInput(String), and typically you will not need to create one yourself.

Parameters:
lexer - the lexer ready to provide a token stream.
frontEnd - factory to create a parser.

PostScan

public PostScan(LexerWrapper lexer,
                IANTLRFrontEnd frontEnd)
Method Detail

getSingleToken

public org.antlr.runtime.Token getSingleToken()
Returns a single token from the lexer's token stream, and asserts that the second token is an end-of-file.

Returns:
the only token on the lexer's token stream.

getTokenSource

public org.antlr.runtime.TokenSource getTokenSource()
Returns a token source for the lexer. I don't know why this method exists.

Returns:
a token source for the lexer.

parseAs

public PostParse parseAs(String production)
Parses the lexer's token stream using the specified production.

Parameters:
production - the name of the production from the parser.
Returns:
a post-parse object for analysis and assertions.

assertNoMoreTokens

private void assertNoMoreTokens(org.antlr.runtime.Parser parser,
                                org.antlr.runtime.RuleReturnScope result)

createParser

private org.antlr.runtime.Parser createParser()

invokeRuleMethod

private org.antlr.runtime.RuleReturnScope invokeRuleMethod(org.antlr.runtime.Parser parser,
                                                           String production)

parseForAst

private org.antlr.runtime.tree.Tree parseForAst(org.antlr.runtime.Parser parser,
                                                String production)

ruleMethod

private Method ruleMethod(org.antlr.runtime.Parser parser,
                          String production)