edu.stanford.nlp.util
Class StringParsingTask<E>
java.lang.Object
edu.stanford.nlp.util.StringParsingTask<E>
public abstract class StringParsingTask<E>
- extends java.lang.Object
An instantiation of this abstract class parses a String and
returns an object of type E. It's called a
StringParsingTask (rather than StringParser)
because a new instance is constructed for each String to be
parsed. We do this to be thread-safe: methods in
StringParsingTask share state information (e.g. current
string index) via instance variables.
- Author:
- Bill MacCartney
|
Field Summary |
protected int |
index
|
protected boolean |
isEOF
|
protected java.lang.String |
s
|
|
Constructor Summary |
StringParsingTask(java.lang.String s)
Constructs a new StringParsingTask from the specified
String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
s
protected java.lang.String s
index
protected int index
isEOF
protected boolean isEOF
StringParsingTask
public StringParsingTask(java.lang.String s)
- Constructs a new
StringParsingTask from the specified
String. Derived class constructors should be sure to
call super(s)!
parse
public abstract E parse()
- Parses the
String associated with this
StringParsingTask and returns a object of type
E.
readName
protected java.lang.String readName()
- Reads characters until
isWhiteSpace(ch)or
isPunct(ch) or isEOF(). You may need
to override the definition of isPunct(ch) to
get this to work right.
readJavaIdentifier
protected java.lang.String readJavaIdentifier()
readLeftParen
protected void readLeftParen()
readRightParen
protected void readRightParen()
readDot
protected void readDot()
readWhiteSpace
protected void readWhiteSpace()
read
protected char read()
unread
protected void unread()
peek
protected char peek()
isEOF
protected boolean isEOF()
isWhiteSpace
protected boolean isWhiteSpace(char ch)
isPunct
protected boolean isPunct(char ch)
isLeftParen
protected boolean isLeftParen(char ch)
isRightParen
protected boolean isRightParen(char ch)
isDot
protected boolean isDot(char ch)
Stanford NLP Group