| java.lang.Object net.sourceforge.chaperon.process.ParserAutomaton
ParserAutomaton | public class ParserAutomaton implements Serializable(Code) | | This class represents a parser automaton, which holds all states and transition, which are used
by the the parser processor.
author: Stephan Michels version: CVS $Id: ParserAutomaton.java,v 1.9 2003/12/09 19:55:53 benedikta Exp $ |
Constructor Summary | |
public | ParserAutomaton(int tsymbolcount, int ntsymbolcount, int productioncount, int errorcount, int statecount) |
Method Summary | |
public int | getErrorCount() Return the count of errors. | public String | getErrorMessage(int index) Returns the message for an error.
Parameters: index - Index of the error. | public int | getErrorTransition(int state, int tsymbol) | public int | getErrorTransition(int state) Return index of the error.
Parameters: state - Index of state. | public String | getNonterminal(int index) Returns the name of a nonterminal symbol.
Parameters: index - Index of the symbol. | public int | getNonterminalCount() Returns the count of nonterminal symbols. | public int | getProductionCount() Return the count of productions. | public int | getProductionLength(int index) Return the length of a production.
Parameters: index - Index of a production. | public int | getProductionSymbol(int index) Return the symbol of a production.
Parameters: index - Index of the production. | public int | getReduceProduction(int state, int tsymbol) Return for a given reduce action the production, which should be reduced. | public int | getReduceProduction(int state) Return the production, which should be reduced.
Parameters: state - Index of the state. | public int | getShiftTransition(int state, int tsymbol) Returns the transition for a given state and terminal symbol.
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol. | public int | getStateCount() Returns the count of states. | public String | getTerminal(int index) Returns the name of a terminal symbol.
Parameters: index - Index of the symbol. | public int | getTerminalCount() Returns the count of terminal symbols. | public int | getTransition(int state, int ntsymbol) Returns the transition for a given state and nonterminal symbol.
Parameters: state - Index of the state. Parameters: ntsymbol - Index of the nonterminal symbol. | public boolean | isAcceptAction(int state) If is a accept action. | public boolean | isErrorAction(int state, int tsymbol) | public boolean | isErrorAction(int state) If is a error action. | public boolean | isReduceAction(int state, int tsymbol) | public boolean | isReduceAction(int state) If is a reduce action.
Parameters: state - Index of the state. | public boolean | isShiftAction(int state, int tsymbol) | public void | setAcceptAction(int state, int production) | public void | setErrorAction(int state, int tsymbol, int nextstate) | public void | setErrorAction(int state, int nextstate) | public void | setErrorMessage(int index, String message) Sets the message for an error. | public void | setNonterminal(int index, String symbol) Sets the name of a nonterminal symbol. | public void | setProductionLength(int index, int length) Set the length of a production. | public void | setProductionSymbol(int index, int symbol) | public void | setReduceAction(int state, int tsymbol, int production) | public void | setReduceAction(int state, int production) Set a reduce action for a given state and for the end of the file. | public void | setShiftAction(int state, int tsymbol, int nextstate) | public void | setTerminal(int index, String symbol) Sets the name of a terminal symbol. | public void | setTransition(int state, int ntsymbol, int nextstate) Sets transition for a given state and nonterminal symbol. | public String | toString() Return a string representation of the automaton. |
ParserAutomaton | public ParserAutomaton(int tsymbolcount, int ntsymbolcount, int productioncount, int errorcount, int statecount)(Code) | | Constructs a empty parser automaton
Parameters: tsymbolcount - Count of terminal symbols. Parameters: ntsymbolcount - Count of nonterminal symbols. Parameters: productioncount - Count of productions. Parameters: errorcount - Count of error types. Parameters: statecount - Count of states. |
getErrorCount | public int getErrorCount()(Code) | | Return the count of errors.
Count of errors. |
getErrorMessage | public String getErrorMessage(int index)(Code) | | Returns the message for an error.
Parameters: index - Index of the error. Message of the error. |
getErrorTransition | public int getErrorTransition(int state, int tsymbol)(Code) | | Return for a given error action the error message
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol Index of the state, to continue processing |
getErrorTransition | public int getErrorTransition(int state)(Code) | | Return index of the error.
Parameters: state - Index of state. Index of error. |
getNonterminal | public String getNonterminal(int index)(Code) | | Returns the name of a nonterminal symbol.
Parameters: index - Index of the symbol. Name of the symbol. |
getNonterminalCount | public int getNonterminalCount()(Code) | | Returns the count of nonterminal symbols.
Count of nonterminal symbols. |
getProductionCount | public int getProductionCount()(Code) | | Return the count of productions.
Count of productions. |
getProductionLength | public int getProductionLength(int index)(Code) | | Return the length of a production.
Parameters: index - Index of a production. Length of the production. |
getProductionSymbol | public int getProductionSymbol(int index)(Code) | | Return the symbol of a production.
Parameters: index - Index of the production. Index of the nonterminal symbol |
getReduceProduction | public int getReduceProduction(int state, int tsymbol)(Code) | | Return for a given reduce action the production, which should be reduced.
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol Index of the production, which should be reduced |
getReduceProduction | public int getReduceProduction(int state)(Code) | | Return the production, which should be reduced.
Parameters: state - Index of the state. Index of the production. |
getShiftTransition | public int getShiftTransition(int state, int tsymbol)(Code) | | Returns the transition for a given state and terminal symbol.
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol. Index of destination state |
getStateCount | public int getStateCount()(Code) | | Returns the count of states.
Count of states. |
getTerminal | public String getTerminal(int index)(Code) | | Returns the name of a terminal symbol.
Parameters: index - Index of the symbol. Name of the symbol. |
getTerminalCount | public int getTerminalCount()(Code) | | Returns the count of terminal symbols.
Count of terminal symbols. |
getTransition | public int getTransition(int state, int ntsymbol)(Code) | | Returns the transition for a given state and nonterminal symbol.
Parameters: state - Index of the state. Parameters: ntsymbol - Index of the nonterminal symbol. Index of destination state. |
isAcceptAction | public boolean isAcceptAction(int state)(Code) | | If is a accept action.
Parameters: state - Index of the state True, if is a accept action |
isErrorAction | public boolean isErrorAction(int state, int tsymbol)(Code) | | If is an error action
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol True, if it is a error action |
isErrorAction | public boolean isErrorAction(int state)(Code) | | If is a error action.
Parameters: state - Index of the state True, if is an error action |
isReduceAction | public boolean isReduceAction(int state, int tsymbol)(Code) | | If is a reduce action
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol True, if is a reduce action |
isReduceAction | public boolean isReduceAction(int state)(Code) | | If is a reduce action.
Parameters: state - Index of the state. True, if is a reduce action. |
isShiftAction | public boolean isShiftAction(int state, int tsymbol)(Code) | | If is a shift action
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol True, if is a shift action |
setAcceptAction | public void setAcceptAction(int state, int production)(Code) | | Sets a accept action for a given state and terminal symbol
Parameters: state - Index of the state Parameters: production - Index of the production, which should be reduced |
setErrorAction | public void setErrorAction(int state, int tsymbol, int nextstate)(Code) | | Sets a error action for a given state and terminal symbol
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol Parameters: nextstate - Destination state |
setErrorAction | public void setErrorAction(int state, int nextstate)(Code) | | Sets a error action for a given state and terminal symbol
Parameters: state - Index of the state Parameters: nextstate - Destination state |
setErrorMessage | public void setErrorMessage(int index, String message)(Code) | | Sets the message for an error.
Parameters: index - Index of the error. Parameters: message - Message of the error. |
setNonterminal | public void setNonterminal(int index, String symbol)(Code) | | Sets the name of a nonterminal symbol.
Parameters: index - Index of the symbol. Parameters: symbol - Name of the symbol. |
setProductionLength | public void setProductionLength(int index, int length)(Code) | | Set the length of a production.
Parameters: index - Index of the production. Parameters: length - Length of the production. |
setProductionSymbol | public void setProductionSymbol(int index, int symbol)(Code) | | Sets the symbol for a production
Parameters: index - Index of the production Parameters: symbolindex - Index of the nonterminal symbol |
setReduceAction | public void setReduceAction(int state, int tsymbol, int production)(Code) | | Sets a reduce action for a given state and terminal symbol
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol Parameters: production - Index of the production, which should be reduced |
setReduceAction | public void setReduceAction(int state, int production)(Code) | | Set a reduce action for a given state and for the end of the file.
Parameters: state - Index of state. Parameters: production - Production, which shoudl be reduced. |
setShiftAction | public void setShiftAction(int state, int tsymbol, int nextstate)(Code) | | Sets a shift action for a given state and terminal symbol
Parameters: state - Index of the state Parameters: tsymbol - Index of the terminal symbol Parameters: nextstate - Destination state |
setTerminal | public void setTerminal(int index, String symbol)(Code) | | Sets the name of a terminal symbol.
Parameters: index - Index of the symbol. Parameters: symbol - Name of the symbol. |
setTransition | public void setTransition(int state, int ntsymbol, int nextstate)(Code) | | Sets transition for a given state and nonterminal symbol.
Parameters: state - Index of the state. Parameters: ntsymbol - Index of the nonterminal symbol. Parameters: nextstate - Index of destination state. |
toString | public String toString()(Code) | | Return a string representation of the automaton.
String representation of the automaton. |
|
|