|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.syntax.lexer.LexerBase
A base class for all other lexers.
Field Summary | |
protected Lexer |
delegate
|
protected Lexer |
source
|
protected int |
startColumn
|
protected int |
startLine
|
Constructor Summary | |
LexerBase()
Initializes the LexerBase . |
Method Summary | |
char |
consume()
Eats a character from the input stream. |
void |
delegate(Lexer to)
Delegates our duties to another Lexer. |
int |
getColumn()
Returns the current column within that line. |
Lexer |
getDelegate()
Gets the lexer that is actually doing the nextToken()
work, if it isn't us. |
int |
getLine()
Returns the current line number. |
Lexer |
getSource()
Gets the lexer from which this lexer is obtaining characters. |
protected int |
getStartColumn()
Returns the starting column of the current token. |
protected int |
getStartLine()
Returns the starting line of the current token. |
boolean |
isDelegated()
Returns true if we are delegated to another lexer. |
boolean |
isExternallySourced()
Returns true if we are obtaining our characters from another lexer. |
char |
la()
Returns the next character, without consuming it. |
char |
la(int k)
Returns the next k th character, without consuming any. |
protected void |
mark()
Saves information about the current position, for tracking token extents. |
Token |
nextToken()
Finds and returns (consuming) the next token from the underlying stream. |
protected void |
readEOL()
Synonym for readEOL(null) . |
protected boolean |
readEOL(java.lang.StringBuffer destination)
Reads an end-of-line marker and writes the text into the specified buffer, if supplied. |
void |
reset()
Resets a lexer for reuse. |
void |
setSource(Lexer source)
Sets the source lexer. |
protected Token |
symbol(int type)
Creates a new symbol token. |
protected Token |
symbol(int type,
int columnOffset)
Creates a new symbol token, and allows you to alter the starting column. |
protected Token |
tokenizeEOL()
Process an end-of-line marker and returns a NEWLINE token. |
void |
undelegate()
Retakes responsibility for our duties. |
protected Token |
undelegatedNextToken()
Does undelegated nextToken() operations. |
protected void |
unexpected(char c,
char[] expected,
int offset)
Creates and throws a new UnexpectedCharacterException . |
protected void |
unexpected(char c,
int offset)
Synonym for unexpected( c, null, offset ) . |
protected void |
unexpected(char c,
int offset,
java.lang.String message)
Creates and throws a new UnexpectedCharacterException . |
void |
unsetSource()
Unsets the source lexer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int startLine
protected int startColumn
protected Lexer delegate
protected Lexer source
Constructor Detail |
public LexerBase()
LexerBase
.
Method Detail |
public Lexer getDelegate()
nextToken()
work, if it isn't us.
getDelegate
in interface Lexer
public Lexer getSource()
getSource
in interface Lexer
public Token nextToken() throws ReadException, LexerException
nextToken
in interface Lexer
ReadException
LexerException
protected Token undelegatedNextToken() throws ReadException, LexerException
ReadException
LexerException
protected Token tokenizeEOL() throws LexerException, ReadException
LexerException
ReadException
protected boolean readEOL(java.lang.StringBuffer destination) throws LexerException, ReadException
LexerException
ReadException
protected void readEOL() throws LexerException, ReadException
readEOL(null)
.
LexerException
ReadException
public void reset()
reset
in interface Lexer
public void delegate(Lexer to)
delegate
in interface Lexer
public void undelegate()
undelegate
in interface Lexer
public void setSource(Lexer source)
setSource
in interface Lexer
public void unsetSource()
unsetSource
in interface Lexer
public boolean isDelegated()
isDelegated
in interface Lexer
public boolean isExternallySourced()
isExternallySourced
in interface Lexer
protected void unexpected(char c, int offset, java.lang.String message) throws UnexpectedCharacterException
UnexpectedCharacterException
.
UnexpectedCharacterException
protected void unexpected(char c, char[] expected, int offset) throws UnexpectedCharacterException
UnexpectedCharacterException
.
UnexpectedCharacterException
protected void unexpected(char c, int offset) throws UnexpectedCharacterException
unexpected( c, null, offset )
.
UnexpectedCharacterException
protected Token symbol(int type, int columnOffset)
protected Token symbol(int type)
public int getLine()
getLine
in interface Lexer
public int getColumn()
getColumn
in interface Lexer
protected void mark()
protected int getStartLine()
protected int getStartColumn()
public char la() throws LexerException, ReadException
la
in interface Lexer
LexerException
ReadException
public char la(int k) throws LexerException, ReadException
k
th character, without consuming any.
la
in interface Lexer
LexerException
ReadException
public char consume() throws LexerException, ReadException
consume
in interface Lexer
LexerException
ReadException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |