|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.chaperon.process.ParserAutomaton
public class ParserAutomaton
This class represents a parser automaton, which holds all states and transition, which are used by the the parser processor.
Constructor Summary | |
---|---|
ParserAutomaton(int tsymbolcount,
int ntsymbolcount,
int productioncount,
int errorcount,
int statecount)
Constructs a empty parser automaton |
Method Summary | |
---|---|
int |
getErrorCount()
Return the count of errors. |
java.lang.String |
getErrorMessage(int index)
Returns the message for an error. |
int |
getErrorTransition(int state)
Return index of the error. |
int |
getErrorTransition(int state,
int tsymbol)
Return for a given error action the error message |
java.lang.String |
getNonterminal(int index)
Returns the name of a nonterminal symbol. |
int |
getNonterminalCount()
Returns the count of nonterminal symbols. |
int |
getProductionCount()
Return the count of productions. |
int |
getProductionLength(int index)
Return the length of a production. |
int |
getProductionSymbol(int index)
Return the symbol of a production. |
int |
getReduceProduction(int state)
Return the production, which should be reduced. |
int |
getReduceProduction(int state,
int tsymbol)
Return for a given reduce action the production, which should be reduced. |
int |
getShiftTransition(int state,
int tsymbol)
Returns the transition for a given state and terminal symbol. |
int |
getStateCount()
Returns the count of states. |
java.lang.String |
getTerminal(int index)
Returns the name of a terminal symbol. |
int |
getTerminalCount()
Returns the count of terminal symbols. |
int |
getTransition(int state,
int ntsymbol)
Returns the transition for a given state and nonterminal symbol. |
boolean |
isAcceptAction(int state)
If is a accept action. |
boolean |
isErrorAction(int state)
If is a error action. |
boolean |
isErrorAction(int state,
int tsymbol)
If is an error action |
boolean |
isReduceAction(int state)
If is a reduce action. |
boolean |
isReduceAction(int state,
int tsymbol)
If is a reduce action |
boolean |
isShiftAction(int state,
int tsymbol)
If is a shift action |
void |
setAcceptAction(int state,
int production)
Sets a accept action for a given state and terminal symbol |
void |
setErrorAction(int state,
int nextstate)
Sets a error action for a given state and terminal symbol |
void |
setErrorAction(int state,
int tsymbol,
int nextstate)
Sets a error action for a given state and terminal symbol |
void |
setErrorMessage(int index,
java.lang.String message)
Sets the message for an error. |
void |
setNonterminal(int index,
java.lang.String symbol)
Sets the name of a nonterminal symbol. |
void |
setProductionLength(int index,
int length)
Set the length of a production. |
void |
setProductionSymbol(int index,
int symbol)
Sets the symbol for a production |
void |
setReduceAction(int state,
int production)
Set a reduce action for a given state and for the end of the file. |
void |
setReduceAction(int state,
int tsymbol,
int production)
Sets a reduce action for a given state and terminal symbol |
void |
setShiftAction(int state,
int tsymbol,
int nextstate)
Sets a shift action for a given state and terminal symbol |
void |
setTerminal(int index,
java.lang.String symbol)
Sets the name of a terminal symbol. |
void |
setTransition(int state,
int ntsymbol,
int nextstate)
Sets transition for a given state and nonterminal symbol. |
java.lang.String |
toString()
Return a string representation of the automaton. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ParserAutomaton(int tsymbolcount, int ntsymbolcount, int productioncount, int errorcount, int statecount)
tsymbolcount
- Count of terminal symbols.ntsymbolcount
- Count of nonterminal symbols.productioncount
- Count of productions.errorcount
- Count of error types.statecount
- Count of states.Method Detail |
---|
public void setTerminal(int index, java.lang.String symbol)
index
- Index of the symbol.symbol
- Name of the symbol.public java.lang.String getTerminal(int index)
index
- Index of the symbol.
public int getTerminalCount()
public void setNonterminal(int index, java.lang.String symbol)
index
- Index of the symbol.symbol
- Name of the symbol.public java.lang.String getNonterminal(int index)
index
- Index of the symbol.
public int getNonterminalCount()
public void setProductionSymbol(int index, int symbol)
index
- Index of the productionsymbolindex
- Index of the nonterminal symbolpublic int getProductionSymbol(int index)
index
- Index of the production.
public void setProductionLength(int index, int length)
index
- Index of the production.length
- Length of the production.public int getProductionLength(int index)
index
- Index of a production.
public int getProductionCount()
public void setErrorMessage(int index, java.lang.String message)
index
- Index of the error.message
- Message of the error.public java.lang.String getErrorMessage(int index)
index
- Index of the error.
public int getErrorCount()
public void setErrorAction(int state, int tsymbol, int nextstate)
state
- Index of the statetsymbol
- Index of the terminal symbolnextstate
- Destination statepublic void setErrorAction(int state, int nextstate)
state
- Index of the statenextstate
- Destination statepublic void setShiftAction(int state, int tsymbol, int nextstate)
state
- Index of the statetsymbol
- Index of the terminal symbolnextstate
- Destination statepublic void setReduceAction(int state, int tsymbol, int production)
state
- Index of the statetsymbol
- Index of the terminal symbolproduction
- Index of the production, which should be reducedpublic void setReduceAction(int state, int production)
state
- Index of state.production
- Production, which shoudl be reduced.public void setAcceptAction(int state, int production)
state
- Index of the stateproduction
- Index of the production, which should be reducedpublic boolean isErrorAction(int state, int tsymbol)
state
- Index of the statetsymbol
- Index of the terminal symbol
public boolean isErrorAction(int state)
state
- Index of the state
public boolean isShiftAction(int state, int tsymbol)
state
- Index of the statetsymbol
- Index of the terminal symbol
public boolean isReduceAction(int state, int tsymbol)
state
- Index of the statetsymbol
- Index of the terminal symbol
public boolean isReduceAction(int state)
state
- Index of the state.
public boolean isAcceptAction(int state)
state
- Index of the state
public int getShiftTransition(int state, int tsymbol)
state
- Index of the statetsymbol
- Index of the terminal symbol.
public int getReduceProduction(int state, int tsymbol)
state
- Index of the statetsymbol
- Index of the terminal symbol
public int getReduceProduction(int state)
state
- Index of the state.
public int getErrorTransition(int state, int tsymbol)
state
- Index of the statetsymbol
- Index of the terminal symbol
public int getErrorTransition(int state)
state
- Index of state.
public void setTransition(int state, int ntsymbol, int nextstate)
state
- Index of the state.ntsymbol
- Index of the nonterminal symbol.nextstate
- Index of destination state.public int getTransition(int state, int ntsymbol)
state
- Index of the state.ntsymbol
- Index of the nonterminal symbol.
public int getStateCount()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |