Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----------------------------------------------------
- // The following code was generated by CUP v0.11b 20150326 (SVN rev 63)
- //----------------------------------------------------
- package szabivan.cup;
- import java_cup.runtime.*;
- import formula.data.*;
- import java_cup.runtime.XMLElement;
- /** CUP v0.11b 20150326 (SVN rev 63) generated parser.
- */
- @SuppressWarnings({"rawtypes"})
- public class FormulaParser extends java_cup.runtime.lr_parser {
- public final Class getSymbolContainer() {
- return FormulaParserSym.class;
- }
- /** Default constructor. */
- @Deprecated
- public FormulaParser() {super();}
- /** Constructor which sets the default scanner. */
- @Deprecated
- public FormulaParser(java_cup.runtime.Scanner s) {super(s);}
- /** Constructor which sets the default scanner. */
- public FormulaParser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
- /** Production table. */
- protected static final short _production_table[][] =
- unpackFromStrings(new String[] {
- "\000\012\000\002\002\003\000\002\002\004\000\002\002" +
- "\005\000\002\002\005\000\002\002\005\000\002\002\005" +
- "\000\002\002\005\000\002\002\004\000\002\002\003\000" +
- "\002\002\003" });
- /** Access to production table. */
- public short[][] production_table() {return _production_table;}
- /** Parse-action table. */
- protected static final short[][] _action_table =
- unpackFromStrings(new String[] {
- "\000\023\000\014\010\006\012\004\013\005\014\007\015" +
- "\010\001\002\000\016\002\ufff9\004\ufff9\005\ufff9\006\ufff9" +
- "\007\ufff9\011\ufff9\001\002\000\016\002\ufff8\004\ufff8\005" +
- "\ufff8\006\ufff8\007\ufff8\011\ufff8\001\002\000\014\010\006" +
- "\012\004\013\005\014\007\015\010\001\002\000\014\010" +
- "\006\012\004\013\005\014\007\015\010\001\002\000\016" +
- "\002\001\004\001\005\001\006\001\007\001\011\001\001" +
- "\002\000\014\002\015\004\016\005\013\006\012\007\014" +
- "\001\002\000\014\010\006\012\004\013\005\014\007\015" +
- "\010\001\002\000\014\010\006\012\004\013\005\014\007" +
- "\015\010\001\002\000\014\010\006\012\004\013\005\014" +
- "\007\015\010\001\002\000\004\002\000\001\002\000\014" +
- "\010\006\012\004\013\005\014\007\015\010\001\002\000" +
- "\016\002\ufffe\004\ufffe\005\013\006\ufffe\007\ufffe\011\ufffe" +
- "\001\002\000\016\002\ufffb\004\016\005\013\006\012\007" +
- "\ufffb\011\ufffb\001\002\000\016\002\ufffd\004\ufffd\005\ufffd" +
- "\006\ufffd\007\ufffd\011\ufffd\001\002\000\016\002\ufffc\004" +
- "\016\005\013\006\012\007\ufffc\011\ufffc\001\002\000\016" +
- "\002\ufffa\004\ufffa\005\ufffa\006\ufffa\007\ufffa\011\ufffa\001" +
- "\002\000\014\004\016\005\013\006\012\007\014\011\025" +
- "\001\002\000\016\002\uffff\004\uffff\005\uffff\006\uffff\007" +
- "\uffff\011\uffff\001\002" });
- /** Access to parse-action table. */
- public short[][] action_table() {return _action_table;}
- /** <code>reduce_goto</code> table. */
- protected static final short[][] _reduce_table =
- unpackFromStrings(new String[] {
- "\000\023\000\004\002\010\001\001\000\002\001\001\000" +
- "\002\001\001\000\004\002\023\001\001\000\004\002\022" +
- "\001\001\000\002\001\001\000\002\001\001\000\004\002" +
- "\021\001\001\000\004\002\020\001\001\000\004\002\017" +
- "\001\001\000\002\001\001\000\004\002\016\001\001\000" +
- "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
- "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
- "\001" });
- /** Access to <code>reduce_goto</code> table. */
- public short[][] reduce_table() {return _reduce_table;}
- /** Instance of action encapsulation class. */
- protected CUP$FormulaParser$actions action_obj;
- /** Action encapsulation object initializer. */
- protected void init_actions()
- {
- action_obj = new CUP$FormulaParser$actions(this);
- }
- /** Invoke a user supplied parse action. */
- public java_cup.runtime.Symbol do_action(
- int act_num,
- java_cup.runtime.lr_parser parser,
- java.util.Stack stack,
- int top)
- throws java.lang.Exception
- {
- /* call code in generated class */
- return action_obj.CUP$FormulaParser$do_action(act_num, parser, stack, top);
- }
- /** Indicates start state. */
- public int start_state() {return 0;}
- /** Indicates start production. */
- public int start_production() {return 1;}
- /** <code>EOF</code> Symbol index. */
- public int EOF_sym() {return 0;}
- /** <code>error</code> Symbol index. */
- public int error_sym() {return 1;}
- /** Cup generated class to encapsulate user supplied action code.*/
- @SuppressWarnings({"rawtypes", "unchecked", "unused"})
- class CUP$FormulaParser$actions {
- private final FormulaParser parser;
- /** Constructor */
- CUP$FormulaParser$actions(FormulaParser parser) {
- this.parser = parser;
- }
- /** Method 0 with the actual generated action code for actions 0 to 300. */
- public final java_cup.runtime.Symbol CUP$FormulaParser$do_action_part00000000(
- int CUP$FormulaParser$act_num,
- java_cup.runtime.lr_parser CUP$FormulaParser$parser,
- java.util.Stack CUP$FormulaParser$stack,
- int CUP$FormulaParser$top)
- throws java.lang.Exception
- {
- /* Symbol object for return from actions */
- java_cup.runtime.Symbol CUP$FormulaParser$result;
- /* select the action based on the action number */
- switch (CUP$FormulaParser$act_num)
- {
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 0: // formula ::= VARIABLE
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 1: // $START ::= formula EOF
- {
- Object RESULT =null;
- int start_valleft = ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-1)).left;
- int start_valright = ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-1)).right;
- Formula start_val = (Formula)((java_cup.runtime.Symbol) CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-1)).value;
- RESULT = start_val;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("$START",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-1)), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- /* ACCEPT */
- CUP$FormulaParser$parser.done_parsing();
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 2: // formula ::= LPAREN formula RPAREN
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-2)), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 3: // formula ::= formula VEE formula
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-2)), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 4: // formula ::= formula WEDGE formula
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-2)), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 5: // formula ::= formula IMPLIES formula
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-2)), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 6: // formula ::= formula IFF formula
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-2)), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 7: // formula ::= NEGATION formula
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.elementAt(CUP$FormulaParser$top-1)), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 8: // formula ::= UP
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /*. . . . . . . . . . . . . . . . . . . .*/
- case 9: // formula ::= DOWN
- {
- Formula RESULT =null;
- CUP$FormulaParser$result = parser.getSymbolFactory().newSymbol("formula",0, ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), ((java_cup.runtime.Symbol)CUP$FormulaParser$stack.peek()), RESULT);
- }
- return CUP$FormulaParser$result;
- /* . . . . . .*/
- default:
- throw new Exception(
- "Invalid action number "+CUP$FormulaParser$act_num+"found in internal parse table");
- }
- } /* end of method */
- /** Method splitting the generated action code into several parts. */
- public final java_cup.runtime.Symbol CUP$FormulaParser$do_action(
- int CUP$FormulaParser$act_num,
- java_cup.runtime.lr_parser CUP$FormulaParser$parser,
- java.util.Stack CUP$FormulaParser$stack,
- int CUP$FormulaParser$top)
- throws java.lang.Exception
- {
- return CUP$FormulaParser$do_action_part00000000(
- CUP$FormulaParser$act_num,
- CUP$FormulaParser$parser,
- CUP$FormulaParser$stack,
- CUP$FormulaParser$top);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement