org.quasiliteral.antlr
Class AstroLexerSharedInputState

java.lang.Object
  |
  +--antlr.LexerSharedInputState
        |
        +--org.quasiliteral.antlr.AstroLexerSharedInputState

public class AstroLexerSharedInputState
extends LexerSharedInputState

Untamed: Extension of LexerSharedInputState that is aware of file names and can annotate ExtentTokens with them and with end position information.

Author:
based on Dan Bornstein's ExtentLexerSharedInputState, Mark Miller

Field Summary
private  String mySourceURL
          the name of the file this instance refers to
 
Fields inherited from class antlr.LexerSharedInputState
column, filename, guessing, input, line, tokenStartColumn, tokenStartLine
 
Constructor Summary
AstroLexerSharedInputState(InputStream s)
          Enabled: Construct an instance.
AstroLexerSharedInputState(InputStream s, String url)
          Enabled: Construct an instance.
 
Method Summary
 void annotate(AstroToken token)
          Enabled: Annotate an AstroToken based on this instance.
 int getColumn()
          Enabled: Get the current column of this instance.
 int getLine()
          Enabled: Get the current line of this instance.
 String getSourceURL()
          Enabled: Get the file name of this instance.
 String toString()
          Suppressed:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mySourceURL

private final String mySourceURL
the name of the file this instance refers to

Constructor Detail

AstroLexerSharedInputState

public AstroLexerSharedInputState(InputStream s,
                                  String url)
Enabled: Construct an instance.

Parameters:
s - the input stream to use
url - The file name to associate with this instance

AstroLexerSharedInputState

public AstroLexerSharedInputState(InputStream s)
Enabled: Construct an instance. The file name is set to null initially.

Parameters:
s - the input stream to use
Method Detail

toString

public String toString()
Suppressed:

Overrides:
toString in class Object
Returns:
a string representation of the object.

getLine

public int getLine()
Enabled: Get the current line of this instance.

Returns:
the current line number

getColumn

public int getColumn()
Enabled: Get the current column of this instance.

Returns:
the current column number

getSourceURL

public String getSourceURL()
Enabled: Get the file name of this instance.

Returns:
The file name

annotate

public void annotate(AstroToken token)
Enabled: Annotate an AstroToken based on this instance. It sets the end position information as well as the file name.

Parameters:
token - non-null; the token to annotate


comments?