Class TopLevelClass.Default.LexicalAnalyzer

java.lang.Object
  extended byTopLevelClass.LexicalAnalyzer
      extended byTopLevelClass.Default.LexicalAnalyzer
Enclosing class:
TopLevelClass.Default

public static class TopLevelClass.Default.LexicalAnalyzer
extends TopLevelClass.LexicalAnalyzer

The default TopLevelClass.LexicalAnalyzer.

Since:
notavaCC 1.0

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

sourceName

protected final String sourceName
The sourceName given to the constructor.

Since:
notavaCC 1.0

text

protected final CharSequence text
The text given to the constructor.

Since:
notavaCC 1.0

end

protected final int end
The exclusive end index of the target text region.

Since:
notavaCC 1.0

tabStop

protected final int tabStop
The tabStop given to the constructor.

Since:
notavaCC 1.0

index

protected int index
The zero-based index the next token begins at.

Since:
notavaCC 1.0

line

protected int line
The zero-based line number the next token begins at.

Since:
notavaCC 1.0

column

protected int column
The zero-based column number the next token begins at.

Since:
notavaCC 1.0
Constructor Detail

TopLevelClass.Default.LexicalAnalyzer

public TopLevelClass.Default.LexicalAnalyzer(String sourceName,
                                             CharSequence text,
                                             int tabStop)
Constructs a lexical analyzer.

Parameters:
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().
Since:
notavaCC 1.0

TopLevelClass.Default.LexicalAnalyzer

public 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.

Parameters:
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.
Since:
notavaCC 1.0
Method Detail

next

public TopLevelClass.Token next()
                         throws TopLevelClass.ParseException
Description copied from class: TopLevelClass.LexicalAnalyzer
Returns the next token in the sequence.

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).

Specified by:
next in class TopLevelClass.LexicalAnalyzer
Returns:
the next token in the sequence.
Throws:
TopLevelClass.ParseException

nextChar

protected char nextChar()
                 throws TopLevelClass.ParseException,
                        IndexOutOfBoundsException
Returns the next character in the 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.

Returns:
the next character in the sequence.
Throws:
IndexOutOfBoundsException - if index >= end
TopLevelClass.ParseException
Since:
notavaCC 1.0

nextUnicodeEscapedChar

protected final char nextUnicodeEscapedChar()
                                     throws TopLevelClass.ParseException,
                                            IndexOutOfBoundsException
Returns the next character in the text based on the Unicode escapes.

Returns:
the next character in the sequence.
Throws:
ParseException - for a illegal escape.
IndexOutOfBoundsException - if index >= end
TopLevelClass.ParseException
Since:
notavaCC 1.0