//---------------------------------------------------- // The following code was generated by CUP v0.10k // Sun Jun 13 21:22:14 CDT 2004 //---------------------------------------------------- import java_cup.runtime.*; /** CUP v0.10k generated parser. * @version Sun Jun 13 21:22:14 CDT 2004 */ public class parser extends java_cup.runtime.lr_parser { /** Default constructor. */ public parser() {super();} /** Constructor which sets the default scanner. */ public parser(java_cup.runtime.Scanner s) {super(s);} /** Production table. */ protected static final short _production_table[][] = unpackFromStrings(new String[] { "\000\025\000\002\003\010\000\002\002\004\000\002\004" + "\005\000\002\004\003\000\002\005\003\000\002\006\005" + "\000\002\006\003\000\002\007\003\000\002\013\003\000" + "\002\013\005\000\002\014\003\000\002\014\003\000\002" + "\011\005\000\002\011\005\000\002\012\005\000\002\010" + "\003\000\002\010\003\000\002\010\003\000\002\010\003" + "\000\002\010\003\000\002\010\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\044\000\004\004\004\001\002\000\004\010\007\001" + "\002\000\004\002\006\001\002\000\004\002\000\001\002" + "\000\026\002\ufffd\005\ufffd\007\ufffd\011\ufffd\013\ufffd\014" + "\ufffd\015\ufffd\016\ufffd\017\ufffd\020\ufffd\001\002\000\006" + "\005\ufffe\007\ufffe\001\002\000\006\005\013\007\012\001" + "\002\000\004\010\007\001\002\000\004\010\014\001\002" + "\000\006\006\ufffa\007\ufffa\001\002\000\006\006\ufffb\007" + "\ufffb\001\002\000\006\006\020\007\017\001\002\000\004" + "\010\014\001\002\000\006\010\007\012\024\001\002\000" + "\006\002\001\011\043\001\002\000\006\002\ufff6\011\ufff6" + "\001\002\000\016\013\037\014\035\015\027\016\032\017" + "\031\020\033\001\002\000\016\013\030\014\035\015\027" + "\016\032\017\031\020\033\001\002\000\006\002\ufff7\011" + "\ufff7\001\002\000\006\002\ufff9\011\ufff9\001\002\000\006" + "\010\ufff0\012\ufff0\001\002\000\004\010\ufff2\001\002\000" + "\006\010\uffee\012\uffee\001\002\000\006\010\uffef\012\uffef" + "\001\002\000\006\010\uffed\012\uffed\001\002\000\004\010" + "\007\001\002\000\006\010\ufff1\012\ufff1\001\002\000\006" + "\002\ufff5\011\ufff5\001\002\000\006\010\007\012\ufff2\001" + "\002\000\004\012\041\001\002\000\006\002\ufff4\011\ufff4" + "\001\002\000\006\002\ufff3\011\ufff3\001\002\000\006\010" + "\007\012\024\001\002\000\006\002\ufff8\011\ufff8\001\002" + "\000\006\006\ufffc\007\ufffc\001\002\000\006\005\uffff\007" + "\uffff\001\002" }); /** Access to parse-action table. */ public short[][] action_table() {return _action_table;} /** reduce_goto table. */ protected static final short[][] _reduce_table = unpackFromStrings(new String[] { "\000\044\000\004\003\004\001\001\000\006\004\010\005" + "\007\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\004\005" + "\045\001\001\000\006\006\015\007\014\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\004\007" + "\044\001\001\000\014\005\022\011\024\012\021\013\020" + "\014\025\001\001\000\002\001\001\000\002\001\001\000" + "\004\010\037\001\001\000\004\010\033\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" + "\000\004\005\035\001\001\000\002\001\001\000\002\001" + "\001\000\004\005\041\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\012\005\022\011\024\012" + "\021\014\043\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001" }); /** Access to reduce_goto table. */ public short[][] reduce_table() {return _reduce_table;} /** Instance of action encapsulation class. */ protected CUP$parser$actions action_obj; /** Action encapsulation object initializer. */ protected void init_actions() { action_obj = new CUP$parser$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$parser$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;} /** EOF Symbol index. */ public int EOF_sym() {return 0;} /** error Symbol index. */ public int error_sym() {return 1;} } /** Cup generated class to encapsulate user supplied action code.*/ class CUP$parser$actions { private final parser parser; /** Constructor */ CUP$parser$actions(parser parser) { this.parser = parser; } /** Method with the actual generated action code. */ public final java_cup.runtime.Symbol CUP$parser$do_action( int CUP$parser$act_num, java_cup.runtime.lr_parser CUP$parser$parser, java.util.Stack CUP$parser$stack, int CUP$parser$top) throws java.lang.Exception { /* Symbol object for return from actions */ java_cup.runtime.Symbol CUP$parser$result; /* select the action based on the action number */ switch (CUP$parser$act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 20: // binop ::= GE { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(6/*binop*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 19: // binop ::= GT { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(6/*binop*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 18: // binop ::= LE { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(6/*binop*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 17: // binop ::= LT { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(6/*binop*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 16: // binop ::= NE { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(6/*binop*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 15: // binop ::= EQ { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(6/*binop*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 14: // joinExpression ::= column EQ column { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(8/*joinExpression*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 13: // filterExpression ::= column binop INT { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(7/*filterExpression*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 12: // filterExpression ::= INT binop column { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(7/*filterExpression*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 11: // primaryExpression ::= joinExpression { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(10/*primaryExpression*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 10: // primaryExpression ::= filterExpression { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(10/*primaryExpression*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 9: // whereExpression ::= whereExpression AND primaryExpression { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(9/*whereExpression*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 8: // whereExpression ::= primaryExpression { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(9/*whereExpression*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 7: // table ::= ID { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(5/*table*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 6: // tableList ::= table { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(4/*tableList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // tableList ::= tableList COMMA table { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(4/*tableList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 4: // column ::= ID { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(3/*column*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 3: // columnList ::= column { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(2/*columnList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 2: // columnList ::= columnList COMMA column { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(2/*columnList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // $START ::= selectStatement EOF { Object RESULT = null; int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; RESULT = start_val; CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } /* ACCEPT */ CUP$parser$parser.done_parsing(); return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 0: // selectStatement ::= SELECT columnList FROM tableList WHERE whereExpression { Object RESULT = null; CUP$parser$result = new java_cup.runtime.Symbol(1/*selectStatement*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /* . . . . . .*/ default: throw new Exception( "Invalid action number found in internal parse table"); } } }