|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.bmrb.starlibj.StarParser
This is the class that is used to parse a Star File. This class was generated by the javacc tool from Sun. To parse an input file or stream, do these steps:
StarParser aParser; StarFileNode aStarTree; String fileName = "sample.str"; try { aParser = new StarParser( new java.io.FileInputStream(fileName) ); aParser.StarFileNodeParse( aParser ); // 'aParser' needs to be sent as a // parameter because javacc makes // static methods that have no 'this'. aStarTree = aParser.endResult(); } // (catch() clauses left off to keep the example brief.)
Note that is is possible to parse in a smaller subset of the STAR syntax if you are reading from a source that you know is not a complete STAR file. For example, you might want to parse a file that contains only a single SaveFrameNode that was cut from a larger file. To do this, use the appropriate ...Parse() method that goes with the name of the node you are trying to parse. To parse a save frame, use SaveFrameNodeParse(). To parse a loop, use DataLoopNodeParse(), and so on. Regardless of which Parse() method you call, the result is always found by called endResult(). (Which is essentially showing what is at the top of the parse stack after parsing completed.)
To parse multiple files, You must call StarParser.ReInit() between parses, even if you make a new StarParser object. This is because the input stream in StarParse is handled using internal static variables.
StarParser is not thread safe. You should only run one StarParser at a time. Again, this is because of the shared static data in the class. (This is fixable, but only if we create our own handmade stream-like class that implements the interface javacc wants to see and then use that instead of one of the standard java stream classes. When we try to tell javacc to make a non-static parser, it refuses to run on java.io.* stream classes.)
Field Summary | |
static char |
doubleMarker
marks the value as double-quote delimited |
static char |
fieldDelim
notes the start of a value's column num |
static char |
framecodeMarker
marks the value as framecode delimited |
static Token |
jj_nt
|
static char |
lineDelim
notes the start of a line num |
static char |
nonMarker
marks the value as non delimited |
static int |
prevLine
|
static char |
semicolonMarker
marks the value as semicolon delimited |
static char |
singleMarker
marks the value as single-quote delimited |
static java.lang.String |
symbolBlockNode
|
static java.lang.String |
symbolDataItemNode
|
static java.lang.String |
symbolDataLoopNameListNode
|
static java.lang.String |
symbolDataNameNode
|
static java.lang.String |
symbolDataValueNode
|
static java.lang.String |
symbolHomemadeStringBuffer
|
static java.lang.String |
symbolLoopTableNode
|
static java.lang.String |
symbolSaveFrameNode
|
static java.lang.String |
symbolTinyAbsTypeName
|
static Token |
token
|
static StarParserTokenManager |
token_source
|
Fields inherited from interface EDU.bmrb.starlibj.StarParserConstants |
DATASTART, DEFAULT, DQUOTE, DVNDOUBLE, DVNFRAMECODE, DVNNON, DVNSEMICOLON, DVNSINGLE, EOF, EOLN_PRIV, GLOBALSTART, LINENOSTARTINGSEMI, LOOPSTART, NONBLANK, NONDQUOTE, NONEOLN, NONSQUOTE, NONUNDERSCOREBLANK, SAVEEND, SAVESTART, SQUOTE, STOP, TAGNAME, tokenImage |
Constructor Summary | |
StarParser(java.io.InputStream stream)
|
|
StarParser(java.io.Reader stream)
|
|
StarParser(StarParserTokenManager tm)
|
Method Summary | |
static void |
BlockNodeParse(StarParser p)
This method will parse a single BlockNode (a global_ or data_ block.) You can get to it by calling endResult() after it finishes. |
static void |
DataItemNodeParse(StarParser p)
This method will parse a single DataItemNode. |
static void |
DataLoopNameListNodeParse(StarParser p)
|
static void |
DataLoopNodeParse(StarParser p)
This method will parse a single DataLoopNode. |
static void |
DataNameNodeParse(StarParser p)
This method will parse a single DataNameNode (a tag). |
static void |
DataNodeParse(StarParser p)
This method will parse either a single DataItemNode, or a single DataLoopNode, or a single SaveFrameNode. |
static void |
DataValueNodeParse(StarParser p)
This method will parse a single DataValueNode. |
static void |
disable_tracing()
|
static void |
enable_tracing()
|
StarNode |
endResult()
This method is depreciated and just is a call to popResult(). |
static void |
EpsilonParse()
|
static ParseException |
generateParseException()
|
static Token |
getNextToken()
|
int |
getNumValsInCurLoopAtLevel(int nest)
Get the number of values that should be in one row for the nesting level given for the most recently parsed DataLoopNameListNode. |
static Token |
getToken(int index)
|
static void |
LoopNameListNodeParse(StarParser p)
|
static void |
LoopRowNodeParse(StarParser p,
LoopTableNode tbl,
int nest)
This method parses a single row of values, presuming that the DataLoopNameListNode has already been parsed and is on the stack underneath the current position. |
static void |
LoopTableNodeParse(StarParser p,
int nest)
This method parses a table of values, presuming that the DataLoopNameListNode has already been properly parsed to hold the numbers of values in each nesting level. |
static void |
LoopValuesParse(StarParser p)
|
static void |
OptionalStopParse(StarParser p)
|
StarNode |
popResult()
Get the StarNode object that was created by the parse. |
static void |
ReInit(java.io.InputStream stream)
|
static void |
ReInit(java.io.Reader stream)
|
void |
ReInit(StarParserTokenManager tm)
|
static void |
SaveDataNodeParse(StarParser p)
This method will parse one of the items that is allowed inside a SaveFrameNode. |
static void |
SaveFrameNodeParse(StarParser p)
This method will parse a single SaveFrameNode. |
void |
setVerbose(int verboseNum)
Call this method before parsing to turn on some debugging printing. |
static void |
StarFileNodeParse(StarParser p)
This method will parse an entire star file. |
static void |
StopParse(StarParser p)
|
static void |
TinyAbsDataValueNodeParse(StarParser p)
This method will parse a single TinyAbsDataValueNode. |
void |
trimToSize()
Trim the stack after a big deletion. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int prevLine
public static java.lang.String symbolTinyAbsTypeName
public static java.lang.String symbolDataValueNode
public static java.lang.String symbolDataNameNode
public static java.lang.String symbolDataItemNode
public static java.lang.String symbolBlockNode
public static java.lang.String symbolSaveFrameNode
public static java.lang.String symbolHomemadeStringBuffer
public static java.lang.String symbolLoopTableNode
public static java.lang.String symbolDataLoopNameListNode
public static char lineDelim
public static char fieldDelim
public static char singleMarker
public static char doubleMarker
public static char semicolonMarker
public static char framecodeMarker
public static char nonMarker
public static StarParserTokenManager token_source
public static Token token
public static Token jj_nt
Constructor Detail |
public StarParser(java.io.InputStream stream)
public StarParser(java.io.Reader stream)
public StarParser(StarParserTokenManager tm)
Method Detail |
public StarNode popResult()
public StarNode endResult()
public void setVerbose(int verboseNum)
verboseNum
- = set to higher numbers for more info,
(0 = silent)
(Default is false when a StarParser is constructed.)public void trimToSize()
public int getNumValsInCurLoopAtLevel(int nest)
public static final void EpsilonParse() throws ParseException
public static final void StarFileNodeParse(StarParser p) throws ParseException
public static final void BlockNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void DataNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void DataItemNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void DataNameNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void TinyAbsDataValueNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void DataValueNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void SaveFrameNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void SaveDataNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void LoopValuesParse(StarParser p) throws ParseException
public static final void StopParse(StarParser p) throws ParseException
public static final void OptionalStopParse(StarParser p) throws ParseException
public static final void LoopTableNodeParse(StarParser p, int nest) throws ParseException
public static final void LoopRowNodeParse(StarParser p, LoopTableNode tbl, int nest) throws ParseException
public static final void DataLoopNodeParse(StarParser p) throws ParseException
p
- It is necessary to pass the StarParser object itself because
when javacc generates this source code, it generates this method with
static scope (hence it has no concept of 'this'.)public static final void DataLoopNameListNodeParse(StarParser p) throws ParseException
public static final void LoopNameListNodeParse(StarParser p) throws ParseException
public static void ReInit(java.io.InputStream stream)
public static void ReInit(java.io.Reader stream)
public void ReInit(StarParserTokenManager tm)
public static final Token getNextToken()
public static final Token getToken(int index)
public static final ParseException generateParseException()
public static final void enable_tracing()
public static final void disable_tracing()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |