|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--TopLevelClass.LexicalAnalyzer | +--TopLevelClass.Default.LexicalAnalyzer
The default TopLevelClass.LexicalAnalyzer
.
Field Summary | |
protected int |
column
The zero-based column number the next token begins at. |
protected int |
end
The exclusive end index of the target text region. |
protected int |
index
The zero-based index the next token begins at. |
protected int |
line
The zero-based line number the next token begins at. |
protected String |
sourceName
The sourceName given to the constructor. |
protected int |
tabStop
The tabStop given to the constructor. |
protected CharSequence |
text
The text given to the constructor. |
Constructor Summary | |
TopLevelClass.Default.LexicalAnalyzer(String sourceName,
CharSequence text,
int tabStop)
Constructs a lexical analyzer. |
|
TopLevelClass.Default.LexicalAnalyzer(String sourceName,
CharSequence text,
int tabStop,
int start,
int end,
int line,
int column)
Constructs a lexical analyzer that analyze a part of a text. |
Method Summary | |
TopLevelClass.Token |
next()
Returns the next token in the sequence. |
protected char |
nextChar()
Returns the next character in the text .
|
protected char |
nextUnicodeEscapedChar()
Returns the next character in the text based on the Unicode escapes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final String sourceName
sourceName
given to the constructor.
protected final CharSequence text
text
given to the constructor.
protected final int end
text
region.
protected final int tabStop
tabStop
given to the constructor.
protected int index
protected int line
protected int column
Constructor Detail |
public TopLevelClass.Default.LexicalAnalyzer(String sourceName,
CharSequence text,
int tabStop)
sourceName
- the name of the source, used only to set the result of TopLevelClass.Token.getSourceName()
.text
- the text to parse.tabStop
- the number that the tab character advances the cursor to the next column that is a multiple of. tabStop
is used only to set the result of TopLevelClass.Token.getColumn()
.
public TopLevelClass.Default.LexicalAnalyzer(String sourceName,
CharSequence text,
int tabStop,
int start,
int end,
int line,
int column)
sourceName
- the name of the source, used only to set the result of TopLevelClass.Token.getSourceName()
.text
- the text to parse.tabStop
- the number that the tab character advances the cursor to the next column that is a multiple of. tabStop
is used only to set the result of TopLevelClass.Token.getColumn()
.start
- the inclusive start index of the text region to analyze.end
- the exclusive end index of the text region to analyze.line
- the zero-based line number of the start
index.column
- the zero-based column number of the start
index.Method Detail |
public TopLevelClass.Token next() throws TopLevelClass.ParseException
TopLevelClass.LexicalAnalyzer
If there is no tokens, the symbol ID of the returned value should be TopLevelClass.EOF_TOKEN
, but the image or the index etc. are not specified (may be unsupported).
next
in class TopLevelClass.LexicalAnalyzer
TopLevelClass.ParseException
protected char nextChar()
throws TopLevelClass.ParseException,
IndexOutOfBoundsException
text
.
This method returns the character starting at index
in the sequence and updates index
, line
, and column
to point the next character of the returned character. This method is overridden in order to deal with a string as a character through the input sequence like Unicode escapes of Java.
IndexOutOfBoundsException
- if index >= end
TopLevelClass.ParseException
protected final char nextUnicodeEscapedChar()
throws TopLevelClass.ParseException,
IndexOutOfBoundsException
text
based on the Unicode escapes.
ParseException
- for a illegal escape.
IndexOutOfBoundsException
- if index >= end
TopLevelClass.ParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |