|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--goldengine.java.GOLDParser
-------------------------------------------------------------------------------------------
Source File: GenericParser.java
Author: Devin Cook, Matthew Hawkins
Description: The main parsing engine.
-------------------------------------------------------------------------------------------
Revision List
Author Version Description
------ ------- -----------
MPH 1.0 First Issue
MPH 1.1 Added the TrimReductions property and required logic
MPH 1.2 Fixed Comment bug to ignore all tokens
| Fields inherited from interface goldengine.java.GPMessageConstants |
gpMsgAccept, gpMsgCommentError, gpMsgInternalError, gpMsgLexicalError, gpMsgNotLoadedError, gpMsgReduction, gpMsgSyntaxError, gpMsgTokenRead |
| Fields inherited from interface goldengine.java.SymbolTypeConstants |
symbolTypeCommentEnd, symbolTypeCommentLine, symbolTypeCommentStart, symbolTypeEnd, symbolTypeError, symbolTypeNonterminal, symbolTypeTerminal, symbolTypeWhitespace |
| Fields inherited from interface goldengine.java.ActionConstants |
actionAccept, actionError, actionGoto, actionReduce, actionShift |
| Fields inherited from interface goldengine.java.RecordIDConstants |
recordIdCharSets, recordIdComment, recordIdDFAStates, recordIdInitial, recordIdLRTables, recordIdParameters, recordIdRules, recordIdSymbols, recordIdTableCounts |
| Fields inherited from interface goldengine.java.ParseResultConstants |
parseResultAccept, parseResultInternalError, parseResultReduceEliminated, parseResultReduceNormal, parseResultShift, parseResultSyntaxError |
| Constructor Summary | |
GOLDParser()
GOLDParser The constructor initiates some variables. |
|
| Method Summary | |
void |
clear()
clear This method clears every value in the parser engine. |
void |
closeFile()
closeFile This method will close the source file. |
int |
currentLineNumber()
currentLineNumber Returns the current source file line number. |
Reduction |
currentReduction()
currentReduction This method will return the current reduction. |
Token |
currentToken()
currentToken This method returns the current Token. |
Token |
getToken(int index)
getToken If you require access to tokens in the stack before they are placed on the parse tree. |
boolean |
getTrimReductions()
getTrimReductions #ver1.1# This method will get whether or not we should trim the reductions. |
boolean |
loadCompiledGrammar(java.lang.String fileName)
loadCompiledGrammar This method will reset the GOLDParser engine before loading a new .cgt file into it. |
boolean |
openFile(java.lang.String fileName)
openFile This method will open the source file for reading. |
java.lang.String |
parameter(java.lang.String name)
parameter This method will return the value of a parameter that corresponds to the name passed in. |
int |
parse()
parse Will parse a token. |
Token |
popInputToken()
popInputToken This method should only be called if there is a lexical error and you need to pop an unexpected token out of the stack. |
void |
pushInputToken(Token theToken)
pushInputToken This method should only be used if there is a syntax error. |
void |
reset()
reset This method will reset the parser engine. |
int |
ruleTableCount()
ruleTableCount This method returns the total number of rules in the rule table. |
Rule |
ruleTableEntry(int index)
ruleTableEntry This method will return a Rule at the specified index. |
void |
setCurrentReduction(Reduction value)
setCurrentReduction This method will set the current reduction to the one passed in. |
void |
setTrimReductions(boolean value)
setTrimReductions #ver1.1# This method will set the whether or not the program should trim the reductions. |
int |
symbolTableCount()
symbolTableCount This method returns the total number of symbols in the symbol table. |
Symbol |
symbolTableEntry(int index)
symbolTableEntry This method will return a Symbol at the specified index. |
int |
tokenCount()
tokenCount This method will return the number of tokens in the stack. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public GOLDParser()
| Method Detail |
public int currentLineNumber()
public void closeFile()
throws ParserException
ParserException - The engine parser should deal with
a problem with closing the source file.public Token currentToken()
public Token popInputToken()
public void pushInputToken(Token theToken)
theToken - A token to push onto the stack.public Token getToken(int index)
index - The index number.public Reduction currentReduction()
public void setCurrentReduction(Reduction value)
value - The new Reduction to set as the current one.public void setTrimReductions(boolean value)
value - True if we should trim reductions, false if not.public boolean getTrimReductions()
public java.lang.String parameter(java.lang.String name)
name - The name of the variable.public int symbolTableCount()
public int ruleTableCount()
public Symbol symbolTableEntry(int index)
index - The index number in the table.public Rule ruleTableEntry(int index)
index - The index number in the table.public int tokenCount()
public boolean loadCompiledGrammar(java.lang.String fileName)
throws ParserException
fileName - The absolute path of the .cgt file to load.ParserException - If there was a stream access problem with
the file.
public boolean openFile(java.lang.String fileName)
throws ParserException
fileName - The absolute path to the source file.ParserException - If there was a problem opening the file.public void clear()
public void reset()
public int parse()
throws ParserException
ParserException - This is thrown if there are any problems
reading information from the source file.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||