|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gshute.ioutil.LineScanner
An object of class LineScanner scans text, breaking it up into tokens.
Field Summary | |
protected int |
currentPosition
currentPosition is the beginning position in text of currentToken. |
protected java.lang.StringBuffer |
currentToken
currentToken is a StringBuffer containing the current token of this LineScanner. |
protected int |
currentTokenEnd
currentTokenEnd the end position in text of currentToken. |
protected int |
currentType
currentType is the type of currentToken. |
static int |
ECHO
|
protected int |
echoPolicy
echoPolicy determines if this LineScanner echoes lines before printing errors. |
protected java.util.Vector |
errors
errors is a Vector of errors that have been recorded in this LineScanner. |
static int |
NO_ECHO
|
protected static int |
t_end
|
protected static int |
t_escape_error
|
protected static int |
t_float
|
protected static int |
t_int
|
protected static int |
t_string
|
protected static int |
t_unmatched
These are the token type constants. |
protected java.lang.String |
text
text is the text that this LineScanner is reading. |
protected int |
textLength
textLength is the length of text. |
Constructor Summary | |
LineScanner(java.lang.String str,
int echoPol)
new LineScanner(str, echoPol) returns a new LineScanner for scanning str. |
|
LineScanner(java.lang.String str,
int echoPol,
int skip)
new LineScanner(str, echoPol, skip) returns a new LineScanner for scanning str. |
Method Summary | |
void |
addError(java.lang.String msg)
ls.addError(msg) adds msg to the error list for ls. |
void |
advance()
ls.advance() advances the current position in ls. |
boolean |
atChar()
ls.atChar() returns true if the token at the current position of ls is a character. |
boolean |
atEnd()
ls.atEnd() returns true if the current position of ls is at the end of the line. |
boolean |
atFloat()
ls.atFloat() returns true if the token at the current position of ls is a float. |
boolean |
atInt()
ls.atInt() returns true if the token at the current position of ls is an int. |
boolean |
atString()
ls.atString() returns true if the token at the current position of ls is a string. |
protected void |
classifyToken()
ls.classifyToken() sets currentType to the type of the current token of ls. |
protected void |
copyToken()
copyToken() copies the current token of this LineScanner into currentToken and sets currentTokenEnd to the position just beyond the end of the current token string. |
char |
currentChar()
ls.currentChar() returns the string value of the current token of ls. |
float |
currentFloat()
ls.currentFloat() returns the float value of the current token of ls. |
int |
currentInt()
ls.currentInt() returns the int value of the current token of ls. |
java.lang.String |
currentString()
ls.currentString() returns the string value of the current token of ls. |
int |
errorCount()
ls.errorCount() returns the number of error messages in ls. |
int |
getEchoPolicy()
ls.getEchoPolicy(echoPol) returns the echo policy of ls. |
java.lang.String |
getText()
ls.getText(echoPol) returns the text of ls. |
protected int |
getToMatch(int pos)
getToMatch(pos) returns the position in text of the character just beyond the first unescaped match for the character at pos. |
void |
printAllErrors()
ls.printAllErrors() prints all of the error messages in ls to System.out. |
protected void |
printError(int i)
ls.printError(i) prints the i-th error message in ls to stdout. |
void |
printFirstError()
ls.printFirstError() prints the first error message in ls to System.out, if there is one. |
char |
readChar()
ls.readChar() returns the character value of the current token of ls, then advances the current position. |
void |
readEnd()
ls.readEnd() records an error message in ls if the current position of ls is not at the end of the line. |
float |
readFloat()
ls.readFloat() returns the float value of the current token of ls, then advances the current position. |
int |
readInt()
ls.readInt() returns the int value of the current token of ls, then advances the current position. |
java.lang.String |
readString()
ls.readString() returns the string value of the current token of ls, then advances the current position. |
void |
removeLastError()
ls.removeLastError() removes the last error message from ls. |
void |
setEchoPolicy(int echoPol)
ls.setEchoPolicy(echoPol) changes the echo policy of ls to echoPol. |
void |
setText(java.lang.String str)
ls.setText(str) resets ls in preparation for scanning str. |
void |
setText(java.lang.String str,
int skip)
ls.setText(str, skip) resets ls in preparation for scanning str. |
protected int |
translateEscapeCharacter(int pos)
translateEscapeCharacter(pos) appends the translation for the escape sequence at pos to currentToken and returns the position just beyond the escape sequence. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int NO_ECHO
public static final int ECHO
protected java.lang.String text
protected int textLength
protected java.lang.StringBuffer currentToken
protected int currentType
protected int currentPosition
protected int currentTokenEnd
protected int echoPolicy
protected java.util.Vector errors
protected static final int t_unmatched
protected static final int t_escape_error
protected static final int t_string
protected static final int t_float
protected static final int t_int
protected static final int t_end
Constructor Detail |
public LineScanner(java.lang.String str, int echoPol, int skip)
public LineScanner(java.lang.String str, int echoPol)
Method Detail |
public void setText(java.lang.String str, int skip)
public void setText(java.lang.String str)
public void setEchoPolicy(int echoPol)
public java.lang.String getText()
public int getEchoPolicy()
public java.lang.String readString()
public char readChar()
public float readFloat()
public int readInt()
public void readEnd()
public boolean atString()
public boolean atChar()
public boolean atFloat()
public boolean atInt()
public boolean atEnd()
public java.lang.String currentString()
public char currentChar()
public float currentFloat()
public int currentInt()
public void advance()
public int errorCount()
public void addError(java.lang.String msg)
public void removeLastError()
public void printFirstError()
public void printAllErrors()
protected void copyToken()
protected int getToMatch(int pos)
protected int translateEscapeCharacter(int pos)
protected void classifyToken()
protected void printError(int i)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |