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

Constructor Summary
PostScan(org.antlr.runtime.Lexer lexer, IANTLRFrontEnd frontEnd)
          Constructs a post-scan object.
PostScan(org.norecess.antlr.LexerWrapper lexer, IANTLRFrontEnd frontEnd)
           
 
Method Summary
 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.
 PostParse parseAs(String production)
          Parses the lexer's token stream using the specified production.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(org.norecess.antlr.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.