0001: //----------------------------------------------------
0002: // The following code was generated by CUP v0.11a beta 20050920
0003: // Fri Feb 15 16:09:35 CET 2008
0004: //----------------------------------------------------
0005:
0006: package hu.netmind.persistence.parser;
0007:
0008: import java_cup.runtime.*;
0009: import java.util.Set;
0010: import java.util.HashSet;
0011: import java.util.Date;
0012: import java.util.Stack;
0013: import java.util.Vector;
0014: import java.util.Collections;
0015: import java.util.List;
0016: import java.util.Calendar;
0017: import org.apache.log4j.Logger;
0018: import java.io.StringReader;
0019: import hu.netmind.persistence.*;
0020:
0021: /** CUP v0.11a beta 20050920 generated parser.
0022: * @version Fri Feb 15 16:09:35 CET 2008
0023: */
0024: public class Parser extends java_cup.runtime.lr_parser {
0025:
0026: /** Default constructor. */
0027: public Parser() {
0028: super ();
0029: }
0030:
0031: /** Constructor which sets the default scanner. */
0032: public Parser(java_cup.runtime.Scanner s) {
0033: super (s);
0034: }
0035:
0036: /** Production table. */
0037: protected static final short _production_table[][] = unpackFromStrings(new String[] { "\000\062\000\002\002\004\000\002\010\003\000\002\010"
0038: + "\005\000\002\010\005\000\002\011\004\000\002\011\006"
0039: + "\000\002\011\010\000\002\011\006\000\002\011\006\000"
0040: + "\002\011\010\000\002\011\012\000\002\011\010\000\002"
0041: + "\011\004\000\002\011\006\000\002\011\010\000\002\011"
0042: + "\006\000\002\012\003\000\002\012\005\000\002\013\003"
0043: + "\000\002\013\004\000\002\002\005\000\002\002\005\000"
0044: + "\002\002\004\000\002\002\003\000\002\003\005\000\002"
0045: + "\003\004\000\002\004\003\000\002\004\003\000\002\004"
0046: + "\003\000\002\004\003\000\002\004\003\000\002\004\005"
0047: + "\000\002\004\003\000\002\017\004\000\002\017\003\000"
0048: + "\002\017\006\000\002\017\005\000\002\005\005\000\002"
0049: + "\005\003\000\002\006\003\000\002\006\005\000\002\007"
0050: + "\003\000\002\007\011\000\002\007\006\000\002\007\006"
0051: + "\000\002\015\003\000\002\014\003\000\002\014\006\000"
0052: + "\002\016\003\000\002\016\005" });
0053:
0054: /** Access to production table. */
0055: public short[][] production_table() {
0056: return _production_table;
0057: }
0058:
0059: /** Parse-action table. */
0060: protected static final short[][] _action_table = unpackFromStrings(new String[] { "\000\126\000\006\027\004\030\005\001\002\000\004\017"
0061: + "\017\001\002\000\004\017\017\001\002\000\004\002\013"
0062: + "\001\002\000\006\002\000\021\010\001\002\000\006\013"
0063: + "\012\016\011\001\002\000\004\002\ufffe\001\002\000\004"
0064: + "\002\uffff\001\002\000\004\002\001\001\002\000\016\002"
0065: + "\uffdf\017\105\021\uffdf\022\104\025\uffdf\026\uffdf\001\002"
0066: + "\000\022\002\uffdb\017\uffdb\020\102\021\uffdb\022\uffdb\025"
0067: + "\uffdb\026\uffdb\031\uffdb\001\002\000\012\002\ufff5\021\ufff5"
0068: + "\025\027\026\026\001\002\000\034\002\uffd3\004\020\005"
0069: + "\uffd3\006\uffd3\010\uffd3\011\uffd3\017\uffd3\020\uffd3\021\uffd3"
0070: + "\022\uffd3\025\uffd3\026\uffd3\031\uffd3\001\002\000\004\017"
0071: + "\021\001\002\000\006\005\uffd1\020\uffd1\001\002\000\006"
0072: + "\005\024\020\023\001\002\000\004\017\025\001\002\000"
0073: + "\032\002\uffd2\005\uffd2\006\uffd2\010\uffd2\011\uffd2\017\uffd2"
0074: + "\020\uffd2\021\uffd2\022\uffd2\025\uffd2\026\uffd2\031\uffd2\001"
0075: + "\002\000\006\005\uffd0\020\uffd0\001\002\000\004\017\017"
0076: + "\001\002\000\022\004\041\007\042\012\037\013\030\014"
0077: + "\036\015\032\016\035\017\017\001\002\000\020\002\uffe5"
0078: + "\005\uffe5\006\uffe5\010\uffe5\011\uffe5\021\uffe5\026\uffe5\001"
0079: + "\002\000\014\002\uffea\005\uffea\006\uffea\021\uffea\026\uffea"
0080: + "\001\002\000\020\002\uffe6\005\uffe6\006\uffe6\010\uffe6\011"
0081: + "\uffe6\021\uffe6\026\uffe6\001\002\000\022\002\uffe1\005\uffe1"
0082: + "\006\uffe1\010\uffe1\011\uffe1\020\062\021\uffe1\026\uffe1\001"
0083: + "\002\000\006\010\060\011\057\001\002\000\020\002\uffe3"
0084: + "\005\uffe3\006\uffe3\010\uffe3\011\uffe3\021\uffe3\026\uffe3\001"
0085: + "\002\000\020\002\uffe4\005\uffe4\006\uffe4\010\uffe4\011\uffe4"
0086: + "\021\uffe4\026\uffe4\001\002\000\020\002\uffe7\005\uffe7\006"
0087: + "\uffe7\010\uffe7\011\uffe7\021\uffe7\026\uffe7\001\002\000\012"
0088: + "\002\ufff4\006\044\021\ufff4\026\050\001\002\000\022\004"
0089: + "\041\007\042\012\037\013\030\014\036\015\032\016\035"
0090: + "\017\017\001\002\000\022\004\041\007\042\012\037\013"
0091: + "\030\014\036\015\032\016\035\017\017\001\002\000\014"
0092: + "\002\uffeb\005\uffeb\006\uffeb\021\uffeb\026\uffeb\001\002\000"
0093: + "\022\004\041\007\042\012\037\013\030\014\036\015\032"
0094: + "\016\035\017\017\001\002\000\014\002\uffec\005\uffec\006"
0095: + "\uffec\021\uffec\026\uffec\001\002\000\006\005\047\006\044"
0096: + "\001\002\000\014\002\uffed\005\uffed\006\uffed\021\uffed\026"
0097: + "\uffed\001\002\000\004\017\017\001\002\000\012\002\uffef"
0098: + "\021\uffef\022\uffef\031\056\001\002\000\006\002\ufff3\021"
0099: + "\ufff3\001\002\000\010\002\ufff1\021\ufff1\022\054\001\002"
0100: + "\000\004\017\017\001\002\000\006\002\ufff0\021\ufff0\001"
0101: + "\002\000\010\002\uffee\021\uffee\022\uffee\001\002\000\016"
0102: + "\012\037\013\030\014\036\015\032\016\035\017\017\001"
0103: + "\002\000\014\002\uffe8\005\uffe8\006\uffe8\021\uffe8\026\uffe8"
0104: + "\001\002\000\014\002\uffe9\005\uffe9\006\uffe9\021\uffe9\026"
0105: + "\uffe9\001\002\000\004\017\065\001\002\000\032\002\uffda"
0106: + "\005\uffda\006\uffda\010\uffda\011\uffda\017\uffda\020\uffda\021"
0107: + "\uffda\022\uffda\025\uffda\026\uffda\031\uffda\001\002\000\022"
0108: + "\002\uffe2\005\uffe2\006\uffe2\010\uffe2\011\uffe2\020\077\021"
0109: + "\uffe2\026\uffe2\001\002\000\036\002\uffd8\004\066\005\uffd8"
0110: + "\006\uffd8\010\uffd8\011\uffd8\017\uffd8\020\uffd8\021\uffd8\022"
0111: + "\uffd8\023\067\025\uffd8\026\uffd8\031\uffd8\001\002\000\004"
0112: + "\017\075\001\002\000\004\012\070\001\002\000\004\024"
0113: + "\071\001\002\000\034\002\uffd5\004\072\005\uffd5\006\uffd5"
0114: + "\010\uffd5\011\uffd5\017\uffd5\020\uffd5\021\uffd5\022\uffd5\025"
0115: + "\uffd5\026\uffd5\031\uffd5\001\002\000\004\017\073\001\002"
0116: + "\000\004\005\074\001\002\000\032\002\uffd7\005\uffd7\006"
0117: + "\uffd7\010\uffd7\011\uffd7\017\uffd7\020\uffd7\021\uffd7\022\uffd7"
0118: + "\025\uffd7\026\uffd7\031\uffd7\001\002\000\004\005\076\001"
0119: + "\002\000\032\002\uffd6\005\uffd6\006\uffd6\010\uffd6\011\uffd6"
0120: + "\017\uffd6\020\uffd6\021\uffd6\022\uffd6\025\uffd6\026\uffd6\031"
0121: + "\uffd6\001\002\000\004\017\065\001\002\000\032\002\uffd9"
0122: + "\005\uffd9\006\uffd9\010\uffd9\011\uffd9\017\uffd9\020\uffd9\021"
0123: + "\uffd9\022\uffd9\025\uffd9\026\uffd9\031\uffd9\001\002\000\006"
0124: + "\002\ufff2\021\ufff2\001\002\000\004\017\065\001\002\000"
0125: + "\022\002\uffdc\017\uffdc\020\077\021\uffdc\022\uffdc\025\uffdc"
0126: + "\026\uffdc\031\uffdc\001\002\000\004\017\017\001\002\000"
0127: + "\014\002\uffe0\021\uffe0\022\106\025\uffe0\026\uffe0\001\002"
0128: + "\000\004\017\017\001\002\000\012\002\uffde\021\uffde\025"
0129: + "\uffde\026\uffde\001\002\000\012\002\uffdd\021\uffdd\025\uffdd"
0130: + "\026\uffdd\001\002\000\014\002\uffd4\021\uffd4\022\uffd4\025"
0131: + "\uffd4\026\uffd4\001\002\000\014\002\ufffd\021\ufffd\022\115"
0132: + "\025\114\026\113\001\002\000\004\017\017\001\002\000"
0133: + "\022\004\041\007\042\012\037\013\030\014\036\015\032"
0134: + "\016\035\017\017\001\002\000\004\017\017\001\002\000"
0135: + "\012\002\ufff9\021\ufff9\025\120\026\117\001\002\000\004"
0136: + "\017\017\001\002\000\022\004\041\007\042\012\037\013"
0137: + "\030\014\036\015\032\016\035\017\017\001\002\000\012"
0138: + "\002\ufff8\006\044\021\ufff8\026\122\001\002\000\004\017"
0139: + "\017\001\002\000\006\002\ufff7\021\ufff7\001\002\000\006"
0140: + "\002\ufff6\021\ufff6\001\002\000\012\002\ufffc\006\044\021"
0141: + "\ufffc\026\126\001\002\000\004\017\017\001\002\000\006"
0142: + "\002\ufffb\021\ufffb\001\002\000\006\002\ufffa\021\ufffa\001"
0143: + "\002" });
0144:
0145: /** Access to parse-action table. */
0146: public short[][] action_table() {
0147: return _action_table;
0148: }
0149:
0150: /** <code>reduce_goto</code> table. */
0151: protected static final short[][] _reduce_table = unpackFromStrings(new String[] { "\000\126\000\006\010\005\011\006\001\001\000\006\014"
0152: + "\110\015\111\001\001\000\010\005\013\014\014\017\015"
0153: + "\001\001\000\002\001\001\000\002\001\001\000\002\001"
0154: + "\001\000\002\001\001\000\002\001\001\000\002\001\001"
0155: + "\000\002\001\001\000\002\001\001\000\002\001\001\000"
0156: + "\002\001\001\000\004\016\021\001\001\000\002\001\001"
0157: + "\000\002\001\001\000\002\001\001\000\002\001\001\000"
0158: + "\002\001\001\000\012\005\050\012\100\013\052\014\014"
0159: + "\001\001\000\012\002\037\003\030\004\033\014\032\001"
0160: + "\001\000\002\001\001\000\002\001\001\000\002\001\001"
0161: + "\000\002\001\001\000\002\001\001\000\002\001\001\000"
0162: + "\002\001\001\000\002\001\001\000\002\001\001\000\012"
0163: + "\002\045\003\030\004\033\014\032\001\001\000\012\002"
0164: + "\042\003\030\004\033\014\032\001\001\000\002\001\001"
0165: + "\000\012\002\044\003\030\004\033\014\032\001\001\000"
0166: + "\002\001\001\000\002\001\001\000\002\001\001\000\012"
0167: + "\005\050\012\051\013\052\014\014\001\001\000\002\001"
0168: + "\001\000\002\001\001\000\002\001\001\000\012\005\050"
0169: + "\012\054\013\052\014\014\001\001\000\002\001\001\000"
0170: + "\002\001\001\000\006\004\060\014\032\001\001\000\002"
0171: + "\001\001\000\002\001\001\000\006\006\063\007\062\001"
0172: + "\001\000\002\001\001\000\002\001\001\000\002\001\001"
0173: + "\000\002\001\001\000\002\001\001\000\002\001\001\000"
0174: + "\002\001\001\000\002\001\001\000\002\001\001\000\002"
0175: + "\001\001\000\002\001\001\000\002\001\001\000\004\007"
0176: + "\077\001\001\000\002\001\001\000\002\001\001\000\006"
0177: + "\006\102\007\062\001\001\000\002\001\001\000\010\005"
0178: + "\013\014\014\017\107\001\001\000\002\001\001\000\010"
0179: + "\005\013\014\014\017\106\001\001\000\002\001\001\000"
0180: + "\002\001\001\000\002\001\001\000\002\001\001\000\012"
0181: + "\005\050\012\127\013\052\014\014\001\001\000\012\002"
0182: + "\124\003\030\004\033\014\032\001\001\000\010\005\013"
0183: + "\014\014\017\115\001\001\000\002\001\001\000\012\005"
0184: + "\050\012\123\013\052\014\014\001\001\000\012\002\120"
0185: + "\003\030\004\033\014\032\001\001\000\002\001\001\000"
0186: + "\012\005\050\012\122\013\052\014\014\001\001\000\002"
0187: + "\001\001\000\002\001\001\000\002\001\001\000\012\005"
0188: + "\050\012\126\013\052\014\014\001\001\000\002\001\001"
0189: + "\000\002\001\001" });
0190:
0191: /** Access to <code>reduce_goto</code> table. */
0192: public short[][] reduce_table() {
0193: return _reduce_table;
0194: }
0195:
0196: /** Instance of action encapsulation class. */
0197: protected CUP$Parser$actions action_obj;
0198:
0199: /** Action encapsulation object initializer. */
0200: protected void init_actions() {
0201: action_obj = new CUP$Parser$actions(this );
0202: }
0203:
0204: /** Invoke a user supplied parse action. */
0205: public java_cup.runtime.Symbol do_action(int act_num,
0206: java_cup.runtime.lr_parser parser, java.util.Stack stack,
0207: int top) throws java.lang.Exception {
0208: /* call code in generated class */
0209: return action_obj.CUP$Parser$do_action(act_num, parser, stack,
0210: top);
0211: }
0212:
0213: /** Indicates start state. */
0214: public int start_state() {
0215: return 0;
0216: }
0217:
0218: /** Indicates start production. */
0219: public int start_production() {
0220: return 0;
0221: }
0222:
0223: /** <code>EOF</code> Symbol index. */
0224: public int EOF_sym() {
0225: return 0;
0226: }
0227:
0228: /** <code>error</code> Symbol index. */
0229: public int error_sym() {
0230: return 1;
0231: }
0232:
0233: protected static Logger logger = Logger.getLogger(Parser.class);
0234: private Resolver resolver;
0235: private TimeControl timeControl;
0236: private Set modifiedTables;
0237: private String query;
0238:
0239: public void setQuery(String query) {
0240: this .query = query;
0241: }
0242:
0243: public Set getModifiedTables() {
0244: return modifiedTables;
0245: }
0246:
0247: public void setModifiedTables(Set modifiedTables) {
0248: this .modifiedTables = modifiedTables;
0249: }
0250:
0251: public Resolver getResolver() {
0252: return resolver;
0253: }
0254:
0255: public void setResolver(Resolver resolver) {
0256: this .resolver = resolver;
0257: }
0258:
0259: public TimeControl getTimeControl() {
0260: return timeControl;
0261: }
0262:
0263: public void setTimeControl(TimeControl timeControl) {
0264: this .timeControl = timeControl;
0265: }
0266:
0267: /**
0268: * Parse the given string expression, with given parameters.
0269: */
0270: public static QueryStatementList parse(String whereClause,
0271: Resolver resolver, Object[] parameters,
0272: TimeControl timeControl, Set modifiedTables) {
0273: // Initialize lexer
0274: Yylex lexer = new Yylex(new StringReader(whereClause));
0275: lexer.setParameters(parameters);
0276: // Create and initialize parser
0277: Parser parser = new Parser(lexer);
0278: parser.setQuery(whereClause);
0279: parser.setResolver(resolver);
0280: parser.setTimeControl(timeControl);
0281: parser.setModifiedTables(modifiedTables);
0282: // Run parser
0283: try {
0284: logger.debug("parsing statement: " + whereClause);
0285: Symbol parsedSymbol = parser.parse();
0286: // Run final generation algorithm
0287: QueryStatement stmt = (QueryStatement) parsedSymbol.value;
0288: // Return result (which is a list of queries)
0289: return resolver.generate(stmt);
0290: } catch (ParserException e) {
0291: throw e;
0292: } catch (Exception e) {
0293: throw new ParserException(ParserException.ABORT,
0294: "Syntax error: " + e.getMessage()
0295: + ", statement was: " + whereClause, e);
0296: }
0297: }
0298:
0299: /**
0300: * Override standard CUP method.
0301: */
0302: public void report_error(String message, Object info) {
0303: logger.warn("query statement parser reports error: " + message
0304: + ", addition info: " + info);
0305: }
0306:
0307: /**
0308: * Override standard CUP method.
0309: */
0310: public void report_fatal_error(String message, Object info) {
0311: report_error(message, info);
0312: done_parsing();
0313: Yylex lexer = (Yylex) getScanner();
0314: throw new ParserException(ParserException.ABORT, ""
0315: + lexer.yyline() + ":" + lexer.yychar() + ": "
0316: + message + ". Query was: " + query);
0317: }
0318:
0319: }
0320:
0321: /** Cup generated class to encapsulate user supplied action code.*/
0322: class CUP$Parser$actions {
0323: private final Parser parser;
0324:
0325: /** Constructor */
0326: CUP$Parser$actions(Parser parser) {
0327: this .parser = parser;
0328: }
0329:
0330: /** Method with the actual generated action code. */
0331: public final java_cup.runtime.Symbol CUP$Parser$do_action(
0332: int CUP$Parser$act_num,
0333: java_cup.runtime.lr_parser CUP$Parser$parser,
0334: java.util.Stack CUP$Parser$stack, int CUP$Parser$top)
0335: throws java.lang.Exception {
0336: /* Symbol object for return from actions */
0337: java_cup.runtime.Symbol CUP$Parser$result;
0338:
0339: /* select the action based on the action number */
0340: switch (CUP$Parser$act_num) {
0341: /*. . . . . . . . . . . . . . . . . . . .*/
0342: case 49: // qualified_identifier ::= qualified_identifier SEP IDENTIFIER
0343: {
0344: String RESULT = null;
0345: int partleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0346: .elementAt(CUP$Parser$top - 2)).left;
0347: int partright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0348: .elementAt(CUP$Parser$top - 2)).right;
0349: String part = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0350: .elementAt(CUP$Parser$top - 2)).value;
0351: int classnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0352: .peek()).left;
0353: int classnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0354: .peek()).right;
0355: String classname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0356: .peek()).value;
0357: RESULT = part + "." + classname;
0358: CUP$Parser$result = new java_cup.runtime.Symbol(
0359: 12/*qualified_identifier*/,
0360: ((java_cup.runtime.Symbol) CUP$Parser$stack
0361: .elementAt(CUP$Parser$top - 2)).left,
0362: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0363: RESULT);
0364: }
0365: return CUP$Parser$result;
0366:
0367: /*. . . . . . . . . . . . . . . . . . . .*/
0368: case 48: // qualified_identifier ::= IDENTIFIER
0369: {
0370: String RESULT = null;
0371: int classnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0372: .peek()).left;
0373: int classnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0374: .peek()).right;
0375: String classname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0376: .peek()).value;
0377: RESULT = classname;
0378: CUP$Parser$result = new java_cup.runtime.Symbol(
0379: 12/*qualified_identifier*/,
0380: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0381: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0382: RESULT);
0383: }
0384: return CUP$Parser$result;
0385:
0386: /*. . . . . . . . . . . . . . . . . . . .*/
0387: case 47: // tablespec ::= IDENTIFIER LPAREN qualified_identifier RPAREN
0388: {
0389: ClassSpecifier RESULT = null;
0390: int aliasleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0391: .elementAt(CUP$Parser$top - 3)).left;
0392: int aliasright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0393: .elementAt(CUP$Parser$top - 3)).right;
0394: String alias = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0395: .elementAt(CUP$Parser$top - 3)).value;
0396: int classnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0397: .elementAt(CUP$Parser$top - 1)).left;
0398: int classnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0399: .elementAt(CUP$Parser$top - 1)).right;
0400: String classname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0401: .elementAt(CUP$Parser$top - 1)).value;
0402:
0403: parser.logger.debug("tablespec found: <identifier>:"
0404: + alias + "(<qualified_identifier>:" + classname
0405: + ")");
0406: RESULT = new ClassSpecifier(classname, alias);
0407:
0408: CUP$Parser$result = new java_cup.runtime.Symbol(
0409: 10/*tablespec*/,
0410: ((java_cup.runtime.Symbol) CUP$Parser$stack
0411: .elementAt(CUP$Parser$top - 3)).left,
0412: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0413: RESULT);
0414: }
0415: return CUP$Parser$result;
0416:
0417: /*. . . . . . . . . . . . . . . . . . . .*/
0418: case 46: // tablespec ::= IDENTIFIER
0419: {
0420: ClassSpecifier RESULT = null;
0421: int classnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0422: .peek()).left;
0423: int classnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0424: .peek()).right;
0425: String classname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0426: .peek()).value;
0427:
0428: parser.logger.debug("tablespec found: <identifier>:"
0429: + classname);
0430: RESULT = new ClassSpecifier(classname, null);
0431:
0432: CUP$Parser$result = new java_cup.runtime.Symbol(
0433: 10/*tablespec*/,
0434: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0435: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0436: RESULT);
0437: }
0438: return CUP$Parser$result;
0439:
0440: /*. . . . . . . . . . . . . . . . . . . .*/
0441: case 45: // maintable ::= tablespec
0442: {
0443: TableTerm RESULT = null;
0444: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0445: .peek()).left;
0446: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0447: .peek()).right;
0448: ClassSpecifier tbl = (ClassSpecifier) ((java_cup.runtime.Symbol) CUP$Parser$stack
0449: .peek()).value;
0450:
0451: parser.logger.debug("maintable found: <tablespec>:" + tbl);
0452: RESULT = parser.getResolver().resolve(tbl, true);
0453:
0454: CUP$Parser$result = new java_cup.runtime.Symbol(
0455: 11/*maintable*/,
0456: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0457: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0458: RESULT);
0459: }
0460: return CUP$Parser$result;
0461:
0462: /*. . . . . . . . . . . . . . . . . . . .*/
0463: case 44: // attribute ::= IDENTIFIER LBRACKET STRING RBRACKET
0464: {
0465: AttributeSpecifier RESULT = null;
0466: int idleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0467: .elementAt(CUP$Parser$top - 3)).left;
0468: int idright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0469: .elementAt(CUP$Parser$top - 3)).right;
0470: String id = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0471: .elementAt(CUP$Parser$top - 3)).value;
0472: int subnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0473: .elementAt(CUP$Parser$top - 1)).left;
0474: int subnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0475: .elementAt(CUP$Parser$top - 1)).right;
0476: String subname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0477: .elementAt(CUP$Parser$top - 1)).value;
0478:
0479: parser.logger.debug("attribute found: <identifier>:" + id
0480: + " [ <STRING>:subname ]");
0481: RESULT = new AttributeSpecifier(id, null, subname);
0482:
0483: CUP$Parser$result = new java_cup.runtime.Symbol(
0484: 5/*attribute*/,
0485: ((java_cup.runtime.Symbol) CUP$Parser$stack
0486: .elementAt(CUP$Parser$top - 3)).left,
0487: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0488: RESULT);
0489: }
0490: return CUP$Parser$result;
0491:
0492: /*. . . . . . . . . . . . . . . . . . . .*/
0493: case 43: // attribute ::= IDENTIFIER LPAREN IDENTIFIER RPAREN
0494: {
0495: AttributeSpecifier RESULT = null;
0496: int idleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0497: .elementAt(CUP$Parser$top - 3)).left;
0498: int idright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0499: .elementAt(CUP$Parser$top - 3)).right;
0500: String id = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0501: .elementAt(CUP$Parser$top - 3)).value;
0502: int classnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0503: .elementAt(CUP$Parser$top - 1)).left;
0504: int classnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0505: .elementAt(CUP$Parser$top - 1)).right;
0506: String classname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0507: .elementAt(CUP$Parser$top - 1)).value;
0508:
0509: parser.logger.debug("attribute found: <identifier>:" + id
0510: + " ( <identifier>:classname )");
0511: RESULT = new AttributeSpecifier(id, classname, null);
0512:
0513: CUP$Parser$result = new java_cup.runtime.Symbol(
0514: 5/*attribute*/,
0515: ((java_cup.runtime.Symbol) CUP$Parser$stack
0516: .elementAt(CUP$Parser$top - 3)).left,
0517: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0518: RESULT);
0519: }
0520: return CUP$Parser$result;
0521:
0522: /*. . . . . . . . . . . . . . . . . . . .*/
0523: case 42: // attribute ::= IDENTIFIER LBRACKET STRING RBRACKET LPAREN IDENTIFIER RPAREN
0524: {
0525: AttributeSpecifier RESULT = null;
0526: int idleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0527: .elementAt(CUP$Parser$top - 6)).left;
0528: int idright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0529: .elementAt(CUP$Parser$top - 6)).right;
0530: String id = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0531: .elementAt(CUP$Parser$top - 6)).value;
0532: int subnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0533: .elementAt(CUP$Parser$top - 4)).left;
0534: int subnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0535: .elementAt(CUP$Parser$top - 4)).right;
0536: String subname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0537: .elementAt(CUP$Parser$top - 4)).value;
0538: int classnameleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0539: .elementAt(CUP$Parser$top - 1)).left;
0540: int classnameright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0541: .elementAt(CUP$Parser$top - 1)).right;
0542: String classname = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0543: .elementAt(CUP$Parser$top - 1)).value;
0544:
0545: parser.logger
0546: .debug("attribute found: <identifier>:"
0547: + id
0548: + " [ <STRING>:subname ] ( <identifier>:classname )");
0549: RESULT = new AttributeSpecifier(id, classname, subname);
0550:
0551: CUP$Parser$result = new java_cup.runtime.Symbol(
0552: 5/*attribute*/,
0553: ((java_cup.runtime.Symbol) CUP$Parser$stack
0554: .elementAt(CUP$Parser$top - 6)).left,
0555: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0556: RESULT);
0557: }
0558: return CUP$Parser$result;
0559:
0560: /*. . . . . . . . . . . . . . . . . . . .*/
0561: case 41: // attribute ::= IDENTIFIER
0562: {
0563: AttributeSpecifier RESULT = null;
0564: int idleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0565: .peek()).left;
0566: int idright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0567: .peek()).right;
0568: String id = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0569: .peek()).value;
0570:
0571: parser.logger.debug("attribute found: <identifier>:" + id);
0572: RESULT = new AttributeSpecifier(id, null, null);
0573:
0574: CUP$Parser$result = new java_cup.runtime.Symbol(
0575: 5/*attribute*/,
0576: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0577: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0578: RESULT);
0579: }
0580: return CUP$Parser$result;
0581:
0582: /*. . . . . . . . . . . . . . . . . . . .*/
0583: case 40: // attrspec ::= attrspec SEP attribute
0584: {
0585: List RESULT = null;
0586: int asleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0587: .elementAt(CUP$Parser$top - 2)).left;
0588: int asright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0589: .elementAt(CUP$Parser$top - 2)).right;
0590: List as = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
0591: .elementAt(CUP$Parser$top - 2)).value;
0592: int attrleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0593: .peek()).left;
0594: int attrright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0595: .peek()).right;
0596: AttributeSpecifier attr = (AttributeSpecifier) ((java_cup.runtime.Symbol) CUP$Parser$stack
0597: .peek()).value;
0598:
0599: as.add(attr);
0600: RESULT = as;
0601:
0602: CUP$Parser$result = new java_cup.runtime.Symbol(
0603: 4/*attrspec*/,
0604: ((java_cup.runtime.Symbol) CUP$Parser$stack
0605: .elementAt(CUP$Parser$top - 2)).left,
0606: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0607: RESULT);
0608: }
0609: return CUP$Parser$result;
0610:
0611: /*. . . . . . . . . . . . . . . . . . . .*/
0612: case 39: // attrspec ::= attribute
0613: {
0614: List RESULT = null;
0615: int attrleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0616: .peek()).left;
0617: int attrright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0618: .peek()).right;
0619: AttributeSpecifier attr = (AttributeSpecifier) ((java_cup.runtime.Symbol) CUP$Parser$stack
0620: .peek()).value;
0621:
0622: Vector result = new Vector();
0623: result.add(attr);
0624: RESULT = result;
0625:
0626: CUP$Parser$result = new java_cup.runtime.Symbol(
0627: 4/*attrspec*/,
0628: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0629: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0630: RESULT);
0631: }
0632: return CUP$Parser$result;
0633:
0634: /*. . . . . . . . . . . . . . . . . . . .*/
0635: case 38: // refterm ::= tablespec
0636: {
0637: ReferenceTerm RESULT = null;
0638: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0639: .peek()).left;
0640: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0641: .peek()).right;
0642: ClassSpecifier tbl = (ClassSpecifier) ((java_cup.runtime.Symbol) CUP$Parser$stack
0643: .peek()).value;
0644:
0645: parser.logger.debug("term found: <tablespec>");
0646: RESULT = parser.getResolver().resolve(tbl, null, false);
0647:
0648: CUP$Parser$result = new java_cup.runtime.Symbol(
0649: 3/*refterm*/,
0650: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0651: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0652: RESULT);
0653: }
0654: return CUP$Parser$result;
0655:
0656: /*. . . . . . . . . . . . . . . . . . . .*/
0657: case 37: // refterm ::= tablespec SEP attrspec
0658: {
0659: ReferenceTerm RESULT = null;
0660: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0661: .elementAt(CUP$Parser$top - 2)).left;
0662: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0663: .elementAt(CUP$Parser$top - 2)).right;
0664: ClassSpecifier tbl = (ClassSpecifier) ((java_cup.runtime.Symbol) CUP$Parser$stack
0665: .elementAt(CUP$Parser$top - 2)).value;
0666: int asleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0667: .peek()).left;
0668: int asright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0669: .peek()).right;
0670: List as = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
0671: .peek()).value;
0672:
0673: parser.logger
0674: .debug("refterm found: <tablespec>.<attrspec>");
0675: RESULT = parser.getResolver().resolve(tbl, as, false);
0676:
0677: CUP$Parser$result = new java_cup.runtime.Symbol(
0678: 3/*refterm*/,
0679: ((java_cup.runtime.Symbol) CUP$Parser$stack
0680: .elementAt(CUP$Parser$top - 2)).left,
0681: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0682: RESULT);
0683: }
0684: return CUP$Parser$result;
0685:
0686: /*. . . . . . . . . . . . . . . . . . . .*/
0687: case 36: // references ::= refterm OSEP references
0688: {
0689: List RESULT = null;
0690: int refleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0691: .elementAt(CUP$Parser$top - 2)).left;
0692: int refright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0693: .elementAt(CUP$Parser$top - 2)).right;
0694: ReferenceTerm ref = (ReferenceTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
0695: .elementAt(CUP$Parser$top - 2)).value;
0696: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0697: .peek()).left;
0698: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0699: .peek()).right;
0700: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
0701: .peek()).value;
0702:
0703: refs.add(0, ref);
0704: RESULT = refs;
0705:
0706: CUP$Parser$result = new java_cup.runtime.Symbol(
0707: 13/*references*/,
0708: ((java_cup.runtime.Symbol) CUP$Parser$stack
0709: .elementAt(CUP$Parser$top - 2)).left,
0710: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0711: RESULT);
0712: }
0713: return CUP$Parser$result;
0714:
0715: /*. . . . . . . . . . . . . . . . . . . .*/
0716: case 35: // references ::= refterm IDENTIFIER OSEP references
0717: {
0718: List RESULT = null;
0719: int refleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0720: .elementAt(CUP$Parser$top - 3)).left;
0721: int refright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0722: .elementAt(CUP$Parser$top - 3)).right;
0723: ReferenceTerm ref = (ReferenceTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
0724: .elementAt(CUP$Parser$top - 3)).value;
0725: int idleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0726: .elementAt(CUP$Parser$top - 2)).left;
0727: int idright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0728: .elementAt(CUP$Parser$top - 2)).right;
0729: String id = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0730: .elementAt(CUP$Parser$top - 2)).value;
0731: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0732: .peek()).left;
0733: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0734: .peek()).right;
0735: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
0736: .peek()).value;
0737:
0738: ref.setColumnAlias(id);
0739: refs.add(0, ref);
0740: RESULT = refs;
0741:
0742: CUP$Parser$result = new java_cup.runtime.Symbol(
0743: 13/*references*/,
0744: ((java_cup.runtime.Symbol) CUP$Parser$stack
0745: .elementAt(CUP$Parser$top - 3)).left,
0746: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0747: RESULT);
0748: }
0749: return CUP$Parser$result;
0750:
0751: /*. . . . . . . . . . . . . . . . . . . .*/
0752: case 34: // references ::= refterm
0753: {
0754: List RESULT = null;
0755: int refleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0756: .peek()).left;
0757: int refright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0758: .peek()).right;
0759: ReferenceTerm ref = (ReferenceTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
0760: .peek()).value;
0761:
0762: Vector list = new Vector();
0763: list.add(ref);
0764: RESULT = list;
0765:
0766: CUP$Parser$result = new java_cup.runtime.Symbol(
0767: 13/*references*/,
0768: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0769: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0770: RESULT);
0771: }
0772: return CUP$Parser$result;
0773:
0774: /*. . . . . . . . . . . . . . . . . . . .*/
0775: case 33: // references ::= refterm IDENTIFIER
0776: {
0777: List RESULT = null;
0778: int refleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0779: .elementAt(CUP$Parser$top - 1)).left;
0780: int refright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0781: .elementAt(CUP$Parser$top - 1)).right;
0782: ReferenceTerm ref = (ReferenceTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
0783: .elementAt(CUP$Parser$top - 1)).value;
0784: int idleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0785: .peek()).left;
0786: int idright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0787: .peek()).right;
0788: String id = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0789: .peek()).value;
0790:
0791: ref.setColumnAlias(id);
0792: Vector list = new Vector();
0793: list.add(ref);
0794: RESULT = list;
0795:
0796: CUP$Parser$result = new java_cup.runtime.Symbol(
0797: 13/*references*/,
0798: ((java_cup.runtime.Symbol) CUP$Parser$stack
0799: .elementAt(CUP$Parser$top - 1)).left,
0800: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0801: RESULT);
0802: }
0803: return CUP$Parser$result;
0804:
0805: /*. . . . . . . . . . . . . . . . . . . .*/
0806: case 32: // term ::= tablespec
0807: {
0808: Object RESULT = null;
0809: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0810: .peek()).left;
0811: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0812: .peek()).right;
0813: ClassSpecifier tbl = (ClassSpecifier) ((java_cup.runtime.Symbol) CUP$Parser$stack
0814: .peek()).value;
0815:
0816: parser.logger.debug("term found: <tablespec>");
0817: RESULT = parser.getResolver().resolve(tbl, null, false);
0818:
0819: CUP$Parser$result = new java_cup.runtime.Symbol(
0820: 2/*term*/,
0821: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0822: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0823: RESULT);
0824: }
0825: return CUP$Parser$result;
0826:
0827: /*. . . . . . . . . . . . . . . . . . . .*/
0828: case 31: // term ::= tablespec SEP attrspec
0829: {
0830: Object RESULT = null;
0831: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0832: .elementAt(CUP$Parser$top - 2)).left;
0833: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0834: .elementAt(CUP$Parser$top - 2)).right;
0835: ClassSpecifier tbl = (ClassSpecifier) ((java_cup.runtime.Symbol) CUP$Parser$stack
0836: .elementAt(CUP$Parser$top - 2)).value;
0837: int asleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0838: .peek()).left;
0839: int asright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0840: .peek()).right;
0841: List as = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
0842: .peek()).value;
0843:
0844: parser.logger.debug("term found: <tablespec>.<attrspec>");
0845: RESULT = parser.getResolver().resolve(tbl, as, false);
0846:
0847: CUP$Parser$result = new java_cup.runtime.Symbol(
0848: 2/*term*/,
0849: ((java_cup.runtime.Symbol) CUP$Parser$stack
0850: .elementAt(CUP$Parser$top - 2)).left,
0851: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0852: RESULT);
0853: }
0854: return CUP$Parser$result;
0855:
0856: /*. . . . . . . . . . . . . . . . . . . .*/
0857: case 30: // term ::= OBJECT
0858: {
0859: Object RESULT = null;
0860: int valueleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0861: .peek()).left;
0862: int valueright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0863: .peek()).right;
0864: Object value = (Object) ((java_cup.runtime.Symbol) CUP$Parser$stack
0865: .peek()).value;
0866:
0867: parser.logger.debug("term found: <OBJECT>");
0868: if (value instanceof Identifier) {
0869: ConstantTerm term = new ConstantTerm(
0870: ((Identifier) value).getId());
0871: term.setId();
0872: RESULT = term;
0873: } else {
0874: RESULT = new ConstantTerm(value);
0875: }
0876:
0877: CUP$Parser$result = new java_cup.runtime.Symbol(
0878: 2/*term*/,
0879: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0880: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0881: RESULT);
0882: }
0883: return CUP$Parser$result;
0884:
0885: /*. . . . . . . . . . . . . . . . . . . .*/
0886: case 29: // term ::= BOOLEAN
0887: {
0888: Object RESULT = null;
0889: int valueleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0890: .peek()).left;
0891: int valueright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0892: .peek()).right;
0893: Boolean value = (Boolean) ((java_cup.runtime.Symbol) CUP$Parser$stack
0894: .peek()).value;
0895:
0896: parser.logger.debug("term found: <BOOLEAN>");
0897: RESULT = new ConstantTerm(value);
0898:
0899: CUP$Parser$result = new java_cup.runtime.Symbol(
0900: 2/*term*/,
0901: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0902: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0903: RESULT);
0904: }
0905: return CUP$Parser$result;
0906:
0907: /*. . . . . . . . . . . . . . . . . . . .*/
0908: case 28: // term ::= DATE
0909: {
0910: Object RESULT = null;
0911: int valueleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0912: .peek()).left;
0913: int valueright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0914: .peek()).right;
0915: Date value = (Date) ((java_cup.runtime.Symbol) CUP$Parser$stack
0916: .peek()).value;
0917:
0918: parser.logger.debug("term found: <DATE>");
0919: RESULT = new ConstantTerm(value);
0920:
0921: CUP$Parser$result = new java_cup.runtime.Symbol(
0922: 2/*term*/,
0923: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0924: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0925: RESULT);
0926: }
0927: return CUP$Parser$result;
0928:
0929: /*. . . . . . . . . . . . . . . . . . . .*/
0930: case 27: // term ::= NUMBER
0931: {
0932: Object RESULT = null;
0933: int valueleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0934: .peek()).left;
0935: int valueright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0936: .peek()).right;
0937: Long value = (Long) ((java_cup.runtime.Symbol) CUP$Parser$stack
0938: .peek()).value;
0939:
0940: parser.logger.debug("term found: <NUMBER>");
0941: RESULT = new ConstantTerm(value);
0942:
0943: CUP$Parser$result = new java_cup.runtime.Symbol(
0944: 2/*term*/,
0945: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0946: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0947: RESULT);
0948: }
0949: return CUP$Parser$result;
0950:
0951: /*. . . . . . . . . . . . . . . . . . . .*/
0952: case 26: // term ::= STRING
0953: {
0954: Object RESULT = null;
0955: int valueleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0956: .peek()).left;
0957: int valueright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0958: .peek()).right;
0959: String value = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0960: .peek()).value;
0961:
0962: parser.logger.debug("term found: <STRING>");
0963: RESULT = new ConstantTerm(value);
0964:
0965: CUP$Parser$result = new java_cup.runtime.Symbol(
0966: 2/*term*/,
0967: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
0968: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
0969: RESULT);
0970: }
0971: return CUP$Parser$result;
0972:
0973: /*. . . . . . . . . . . . . . . . . . . .*/
0974: case 25: // condition ::= term UNARY_OPERATOR
0975: {
0976: Expression RESULT = null;
0977: int termleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0978: .elementAt(CUP$Parser$top - 1)).left;
0979: int termright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0980: .elementAt(CUP$Parser$top - 1)).right;
0981: Object term = (Object) ((java_cup.runtime.Symbol) CUP$Parser$stack
0982: .elementAt(CUP$Parser$top - 1)).value;
0983: int opleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
0984: .peek()).left;
0985: int opright = ((java_cup.runtime.Symbol) CUP$Parser$stack
0986: .peek()).right;
0987: String op = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
0988: .peek()).value;
0989:
0990: Expression result = new Expression();
0991: result.add(term);
0992: result.add(op);
0993: RESULT = result;
0994:
0995: CUP$Parser$result = new java_cup.runtime.Symbol(
0996: 1/*condition*/,
0997: ((java_cup.runtime.Symbol) CUP$Parser$stack
0998: .elementAt(CUP$Parser$top - 1)).left,
0999: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1000: RESULT);
1001: }
1002: return CUP$Parser$result;
1003:
1004: /*. . . . . . . . . . . . . . . . . . . .*/
1005: case 24: // condition ::= term OPERATOR term
1006: {
1007: Expression RESULT = null;
1008: int term1left = ((java_cup.runtime.Symbol) CUP$Parser$stack
1009: .elementAt(CUP$Parser$top - 2)).left;
1010: int term1right = ((java_cup.runtime.Symbol) CUP$Parser$stack
1011: .elementAt(CUP$Parser$top - 2)).right;
1012: Object term1 = (Object) ((java_cup.runtime.Symbol) CUP$Parser$stack
1013: .elementAt(CUP$Parser$top - 2)).value;
1014: int opleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1015: .elementAt(CUP$Parser$top - 1)).left;
1016: int opright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1017: .elementAt(CUP$Parser$top - 1)).right;
1018: String op = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
1019: .elementAt(CUP$Parser$top - 1)).value;
1020: int term2left = ((java_cup.runtime.Symbol) CUP$Parser$stack
1021: .peek()).left;
1022: int term2right = ((java_cup.runtime.Symbol) CUP$Parser$stack
1023: .peek()).right;
1024: Object term2 = (Object) ((java_cup.runtime.Symbol) CUP$Parser$stack
1025: .peek()).value;
1026:
1027: // If term1 is a ConstantTerm then swap
1028: // the two terms, so the constant term is always
1029: // on the right
1030: if (term1 instanceof ConstantTerm) {
1031: Object tmp = term2;
1032: term2 = term1;
1033: term1 = tmp;
1034: }
1035: // Do logic
1036: Expression result = new Expression();
1037: result.add(term1);
1038: if (("=".equals(op)) && (term2 instanceof ConstantTerm)
1039: && (((ConstantTerm) term2).getValue() == null))
1040: result.add("is null");
1041: else if (("<>".equals(op))
1042: && (term2 instanceof ConstantTerm)
1043: && (((ConstantTerm) term2).getValue() == null))
1044: result.add("is not null");
1045: else {
1046: result.add(op);
1047: result.add(term2);
1048: // If term2 is a primitive constant type,
1049: // and term1 is persistence_id, then we have
1050: // to invoke a workaround so not persistence_id
1051: // is matched, but the primitive type.
1052: parser.getResolver().fixPrimitiveExpression(result);
1053: }
1054: RESULT = result;
1055:
1056: CUP$Parser$result = new java_cup.runtime.Symbol(
1057: 1/*condition*/,
1058: ((java_cup.runtime.Symbol) CUP$Parser$stack
1059: .elementAt(CUP$Parser$top - 2)).left,
1060: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1061: RESULT);
1062: }
1063: return CUP$Parser$result;
1064:
1065: /*. . . . . . . . . . . . . . . . . . . .*/
1066: case 23: // expression ::= condition
1067: {
1068: Expression RESULT = null;
1069: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1070: .peek()).left;
1071: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1072: .peek()).right;
1073: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1074: .peek()).value;
1075:
1076: parser.logger.debug("expression found: <condition>");
1077: RESULT = expr;
1078:
1079: CUP$Parser$result = new java_cup.runtime.Symbol(
1080: 0/*expression*/,
1081: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
1082: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1083: RESULT);
1084: }
1085: return CUP$Parser$result;
1086:
1087: /*. . . . . . . . . . . . . . . . . . . .*/
1088: case 22: // expression ::= UNARY_LOGICAL_OPERATOR expression
1089: {
1090: Expression RESULT = null;
1091: int opleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1092: .elementAt(CUP$Parser$top - 1)).left;
1093: int opright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1094: .elementAt(CUP$Parser$top - 1)).right;
1095: String op = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
1096: .elementAt(CUP$Parser$top - 1)).value;
1097: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1098: .peek()).left;
1099: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1100: .peek()).right;
1101: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1102: .peek()).value;
1103:
1104: parser.logger
1105: .debug("expression found: <unaryop> <expression>");
1106: Expression result;
1107: if (expr.isMarkedBlock()) {
1108: result = new Expression();
1109: result.add(op);
1110: result.add(expr);
1111: } else {
1112: result = expr;
1113: result.add(0, op);
1114: }
1115: RESULT = result;
1116:
1117: CUP$Parser$result = new java_cup.runtime.Symbol(
1118: 0/*expression*/,
1119: ((java_cup.runtime.Symbol) CUP$Parser$stack
1120: .elementAt(CUP$Parser$top - 1)).left,
1121: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1122: RESULT);
1123: }
1124: return CUP$Parser$result;
1125:
1126: /*. . . . . . . . . . . . . . . . . . . .*/
1127: case 21: // expression ::= expression LOGICAL_OPERATOR expression
1128: {
1129: Expression RESULT = null;
1130: int expr1left = ((java_cup.runtime.Symbol) CUP$Parser$stack
1131: .elementAt(CUP$Parser$top - 2)).left;
1132: int expr1right = ((java_cup.runtime.Symbol) CUP$Parser$stack
1133: .elementAt(CUP$Parser$top - 2)).right;
1134: Expression expr1 = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1135: .elementAt(CUP$Parser$top - 2)).value;
1136: int opleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1137: .elementAt(CUP$Parser$top - 1)).left;
1138: int opright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1139: .elementAt(CUP$Parser$top - 1)).right;
1140: String op = (String) ((java_cup.runtime.Symbol) CUP$Parser$stack
1141: .elementAt(CUP$Parser$top - 1)).value;
1142: int expr2left = ((java_cup.runtime.Symbol) CUP$Parser$stack
1143: .peek()).left;
1144: int expr2right = ((java_cup.runtime.Symbol) CUP$Parser$stack
1145: .peek()).right;
1146: Expression expr2 = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1147: .peek()).value;
1148:
1149: parser.logger
1150: .debug("expression found: <expression> <op> <expression>");
1151: Expression result = null;
1152: if (expr1.isMarkedBlock() && expr2.isMarkedBlock()) {
1153: result = new Expression();
1154: result.add(expr1);
1155: result.add(op);
1156: result.add(expr2);
1157: } else if ((!expr1.isMarkedBlock())
1158: && (!expr2.isMarkedBlock())) {
1159: expr1.add(op);
1160: expr1.addAll(expr2);
1161: result = expr1;
1162: } else if ((expr1.isMarkedBlock())
1163: && (!expr2.isMarkedBlock())) {
1164: expr2.add(0, op);
1165: expr2.add(0, expr1);
1166: result = expr2;
1167: } else if ((!expr1.isMarkedBlock())
1168: && (expr2.isMarkedBlock())) {
1169: expr1.add(op);
1170: expr1.add(expr2);
1171: result = expr1;
1172: }
1173: RESULT = result;
1174:
1175: CUP$Parser$result = new java_cup.runtime.Symbol(
1176: 0/*expression*/,
1177: ((java_cup.runtime.Symbol) CUP$Parser$stack
1178: .elementAt(CUP$Parser$top - 2)).left,
1179: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1180: RESULT);
1181: }
1182: return CUP$Parser$result;
1183:
1184: /*. . . . . . . . . . . . . . . . . . . .*/
1185: case 20: // expression ::= LPAREN expression RPAREN
1186: {
1187: Expression RESULT = null;
1188: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1189: .elementAt(CUP$Parser$top - 1)).left;
1190: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1191: .elementAt(CUP$Parser$top - 1)).right;
1192: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1193: .elementAt(CUP$Parser$top - 1)).value;
1194:
1195: parser.logger.debug("expression found: ( <expression> )");
1196: expr.setMarkedBlock(true);
1197: RESULT = expr;
1198:
1199: CUP$Parser$result = new java_cup.runtime.Symbol(
1200: 0/*expression*/,
1201: ((java_cup.runtime.Symbol) CUP$Parser$stack
1202: .elementAt(CUP$Parser$top - 2)).left,
1203: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1204: RESULT);
1205: }
1206: return CUP$Parser$result;
1207:
1208: /*. . . . . . . . . . . . . . . . . . . .*/
1209: case 19: // orderby ::= refterm DIRECTION
1210: {
1211: OrderBy RESULT = null;
1212: int refleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1213: .elementAt(CUP$Parser$top - 1)).left;
1214: int refright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1215: .elementAt(CUP$Parser$top - 1)).right;
1216: ReferenceTerm ref = (ReferenceTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1217: .elementAt(CUP$Parser$top - 1)).value;
1218: int dirleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1219: .peek()).left;
1220: int dirright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1221: .peek()).right;
1222: Integer dir = (Integer) ((java_cup.runtime.Symbol) CUP$Parser$stack
1223: .peek()).value;
1224: RESULT = new OrderBy(ref, dir.intValue());
1225: CUP$Parser$result = new java_cup.runtime.Symbol(
1226: 9/*orderby*/,
1227: ((java_cup.runtime.Symbol) CUP$Parser$stack
1228: .elementAt(CUP$Parser$top - 1)).left,
1229: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1230: RESULT);
1231: }
1232: return CUP$Parser$result;
1233:
1234: /*. . . . . . . . . . . . . . . . . . . .*/
1235: case 18: // orderby ::= refterm
1236: {
1237: OrderBy RESULT = null;
1238: int refleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1239: .peek()).left;
1240: int refright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1241: .peek()).right;
1242: ReferenceTerm ref = (ReferenceTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1243: .peek()).value;
1244: RESULT = new OrderBy(ref, OrderBy.ASCENDING);
1245: CUP$Parser$result = new java_cup.runtime.Symbol(
1246: 9/*orderby*/,
1247: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
1248: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1249: RESULT);
1250: }
1251: return CUP$Parser$result;
1252:
1253: /*. . . . . . . . . . . . . . . . . . . .*/
1254: case 17: // orderbys ::= orderby OSEP orderbys
1255: {
1256: List RESULT = null;
1257: int obleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1258: .elementAt(CUP$Parser$top - 2)).left;
1259: int obright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1260: .elementAt(CUP$Parser$top - 2)).right;
1261: OrderBy ob = (OrderBy) ((java_cup.runtime.Symbol) CUP$Parser$stack
1262: .elementAt(CUP$Parser$top - 2)).value;
1263: int oblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1264: .peek()).left;
1265: int oblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1266: .peek()).right;
1267: List obl = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1268: .peek()).value;
1269:
1270: obl.add(0, ob);
1271: RESULT = obl;
1272:
1273: CUP$Parser$result = new java_cup.runtime.Symbol(
1274: 8/*orderbys*/,
1275: ((java_cup.runtime.Symbol) CUP$Parser$stack
1276: .elementAt(CUP$Parser$top - 2)).left,
1277: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1278: RESULT);
1279: }
1280: return CUP$Parser$result;
1281:
1282: /*. . . . . . . . . . . . . . . . . . . .*/
1283: case 16: // orderbys ::= orderby
1284: {
1285: List RESULT = null;
1286: int obleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1287: .peek()).left;
1288: int obright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1289: .peek()).right;
1290: OrderBy ob = (OrderBy) ((java_cup.runtime.Symbol) CUP$Parser$stack
1291: .peek()).value;
1292:
1293: Vector orderByList = new Vector();
1294: orderByList.add(ob);
1295: RESULT = orderByList;
1296:
1297: CUP$Parser$result = new java_cup.runtime.Symbol(
1298: 8/*orderbys*/,
1299: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
1300: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1301: RESULT);
1302: }
1303: return CUP$Parser$result;
1304:
1305: /*. . . . . . . . . . . . . . . . . . . .*/
1306: case 15: // query_body ::= VIEW references ORDERBY orderbys
1307: {
1308: QueryStatement RESULT = null;
1309: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1310: .elementAt(CUP$Parser$top - 2)).left;
1311: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1312: .elementAt(CUP$Parser$top - 2)).right;
1313: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1314: .elementAt(CUP$Parser$top - 2)).value;
1315: int oblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1316: .peek()).left;
1317: int oblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1318: .peek()).right;
1319: List obl = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1320: .peek()).value;
1321:
1322: parser.logger
1323: .debug("syntax will be: VIEW <tablespec> ORDERBY <orderbys>");
1324: RESULT = new QueryStatement(refs, null, obl);
1325: RESULT.setMode(QueryStatement.MODE_VIEW);
1326:
1327: CUP$Parser$result = new java_cup.runtime.Symbol(
1328: 7/*query_body*/,
1329: ((java_cup.runtime.Symbol) CUP$Parser$stack
1330: .elementAt(CUP$Parser$top - 3)).left,
1331: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1332: RESULT);
1333: }
1334: return CUP$Parser$result;
1335:
1336: /*. . . . . . . . . . . . . . . . . . . .*/
1337: case 14: // query_body ::= VIEW references WHERE expression ORDERBY orderbys
1338: {
1339: QueryStatement RESULT = null;
1340: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1341: .elementAt(CUP$Parser$top - 4)).left;
1342: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1343: .elementAt(CUP$Parser$top - 4)).right;
1344: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1345: .elementAt(CUP$Parser$top - 4)).value;
1346: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1347: .elementAt(CUP$Parser$top - 2)).left;
1348: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1349: .elementAt(CUP$Parser$top - 2)).right;
1350: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1351: .elementAt(CUP$Parser$top - 2)).value;
1352: int oblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1353: .peek()).left;
1354: int oblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1355: .peek()).right;
1356: List obl = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1357: .peek()).value;
1358:
1359: parser.logger
1360: .debug("syntax will be: VIEW <tablespec> WHERE <expression>");
1361: RESULT = new QueryStatement(refs, expr, obl);
1362: RESULT.setMode(QueryStatement.MODE_VIEW);
1363:
1364: CUP$Parser$result = new java_cup.runtime.Symbol(
1365: 7/*query_body*/,
1366: ((java_cup.runtime.Symbol) CUP$Parser$stack
1367: .elementAt(CUP$Parser$top - 5)).left,
1368: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1369: RESULT);
1370: }
1371: return CUP$Parser$result;
1372:
1373: /*. . . . . . . . . . . . . . . . . . . .*/
1374: case 13: // query_body ::= VIEW references WHERE expression
1375: {
1376: QueryStatement RESULT = null;
1377: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1378: .elementAt(CUP$Parser$top - 2)).left;
1379: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1380: .elementAt(CUP$Parser$top - 2)).right;
1381: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1382: .elementAt(CUP$Parser$top - 2)).value;
1383: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1384: .peek()).left;
1385: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1386: .peek()).right;
1387: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1388: .peek()).value;
1389:
1390: parser.logger
1391: .debug("syntax will be: VIEW <tablespec> WHERE <expression>");
1392: RESULT = new QueryStatement(refs, expr, null);
1393: RESULT.setMode(QueryStatement.MODE_VIEW);
1394:
1395: CUP$Parser$result = new java_cup.runtime.Symbol(
1396: 7/*query_body*/,
1397: ((java_cup.runtime.Symbol) CUP$Parser$stack
1398: .elementAt(CUP$Parser$top - 3)).left,
1399: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1400: RESULT);
1401: }
1402: return CUP$Parser$result;
1403:
1404: /*. . . . . . . . . . . . . . . . . . . .*/
1405: case 12: // query_body ::= VIEW references
1406: {
1407: QueryStatement RESULT = null;
1408: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1409: .peek()).left;
1410: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1411: .peek()).right;
1412: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1413: .peek()).value;
1414:
1415: parser.logger.debug("syntax will be: VIEW <tablespec>");
1416: RESULT = new QueryStatement(refs, null, null);
1417: RESULT.setMode(QueryStatement.MODE_VIEW);
1418:
1419: CUP$Parser$result = new java_cup.runtime.Symbol(
1420: 7/*query_body*/,
1421: ((java_cup.runtime.Symbol) CUP$Parser$stack
1422: .elementAt(CUP$Parser$top - 1)).left,
1423: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1424: RESULT);
1425: }
1426: return CUP$Parser$result;
1427:
1428: /*. . . . . . . . . . . . . . . . . . . .*/
1429: case 11: // query_body ::= FIND maintable OSEP references ORDERBY orderbys
1430: {
1431: QueryStatement RESULT = null;
1432: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1433: .elementAt(CUP$Parser$top - 4)).left;
1434: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1435: .elementAt(CUP$Parser$top - 4)).right;
1436: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1437: .elementAt(CUP$Parser$top - 4)).value;
1438: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1439: .elementAt(CUP$Parser$top - 2)).left;
1440: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1441: .elementAt(CUP$Parser$top - 2)).right;
1442: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1443: .elementAt(CUP$Parser$top - 2)).value;
1444: int oblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1445: .peek()).left;
1446: int oblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1447: .peek()).right;
1448: List obl = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1449: .peek()).value;
1450:
1451: parser.logger
1452: .debug("syntax will be: FIND <tablespec> ORDERBY <orderbys>");
1453: RESULT = new QueryStatement(tbl, null, obl);
1454: RESULT.getSelectTerms().addAll(refs);
1455: RESULT.setMode(QueryStatement.MODE_FIND);
1456:
1457: CUP$Parser$result = new java_cup.runtime.Symbol(
1458: 7/*query_body*/,
1459: ((java_cup.runtime.Symbol) CUP$Parser$stack
1460: .elementAt(CUP$Parser$top - 5)).left,
1461: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1462: RESULT);
1463: }
1464: return CUP$Parser$result;
1465:
1466: /*. . . . . . . . . . . . . . . . . . . .*/
1467: case 10: // query_body ::= FIND maintable OSEP references WHERE expression ORDERBY orderbys
1468: {
1469: QueryStatement RESULT = null;
1470: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1471: .elementAt(CUP$Parser$top - 6)).left;
1472: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1473: .elementAt(CUP$Parser$top - 6)).right;
1474: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1475: .elementAt(CUP$Parser$top - 6)).value;
1476: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1477: .elementAt(CUP$Parser$top - 4)).left;
1478: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1479: .elementAt(CUP$Parser$top - 4)).right;
1480: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1481: .elementAt(CUP$Parser$top - 4)).value;
1482: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1483: .elementAt(CUP$Parser$top - 2)).left;
1484: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1485: .elementAt(CUP$Parser$top - 2)).right;
1486: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1487: .elementAt(CUP$Parser$top - 2)).value;
1488: int oblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1489: .peek()).left;
1490: int oblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1491: .peek()).right;
1492: List obl = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1493: .peek()).value;
1494:
1495: parser.logger
1496: .debug("syntax will be: FIND <tablespec> WHERE <expression>");
1497: RESULT = new QueryStatement(tbl, expr, obl);
1498: RESULT.getSelectTerms().addAll(refs);
1499: RESULT.setMode(QueryStatement.MODE_FIND);
1500:
1501: CUP$Parser$result = new java_cup.runtime.Symbol(
1502: 7/*query_body*/,
1503: ((java_cup.runtime.Symbol) CUP$Parser$stack
1504: .elementAt(CUP$Parser$top - 7)).left,
1505: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1506: RESULT);
1507: }
1508: return CUP$Parser$result;
1509:
1510: /*. . . . . . . . . . . . . . . . . . . .*/
1511: case 9: // query_body ::= FIND maintable OSEP references WHERE expression
1512: {
1513: QueryStatement RESULT = null;
1514: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1515: .elementAt(CUP$Parser$top - 4)).left;
1516: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1517: .elementAt(CUP$Parser$top - 4)).right;
1518: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1519: .elementAt(CUP$Parser$top - 4)).value;
1520: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1521: .elementAt(CUP$Parser$top - 2)).left;
1522: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1523: .elementAt(CUP$Parser$top - 2)).right;
1524: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1525: .elementAt(CUP$Parser$top - 2)).value;
1526: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1527: .peek()).left;
1528: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1529: .peek()).right;
1530: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1531: .peek()).value;
1532:
1533: parser.logger
1534: .debug("syntax will be: FIND <tablespec> WHERE <expression>");
1535: RESULT = new QueryStatement(tbl, expr, null);
1536: RESULT.getSelectTerms().addAll(refs);
1537: RESULT.setMode(QueryStatement.MODE_FIND);
1538:
1539: CUP$Parser$result = new java_cup.runtime.Symbol(
1540: 7/*query_body*/,
1541: ((java_cup.runtime.Symbol) CUP$Parser$stack
1542: .elementAt(CUP$Parser$top - 5)).left,
1543: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1544: RESULT);
1545: }
1546: return CUP$Parser$result;
1547:
1548: /*. . . . . . . . . . . . . . . . . . . .*/
1549: case 8: // query_body ::= FIND maintable OSEP references
1550: {
1551: QueryStatement RESULT = null;
1552: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1553: .elementAt(CUP$Parser$top - 2)).left;
1554: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1555: .elementAt(CUP$Parser$top - 2)).right;
1556: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1557: .elementAt(CUP$Parser$top - 2)).value;
1558: int refsleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1559: .peek()).left;
1560: int refsright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1561: .peek()).right;
1562: List refs = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1563: .peek()).value;
1564:
1565: parser.logger.debug("syntax will be: FIND <tablespec>");
1566: RESULT = new QueryStatement(tbl, null, null);
1567: RESULT.getSelectTerms().addAll(refs);
1568: RESULT.setMode(QueryStatement.MODE_FIND);
1569:
1570: CUP$Parser$result = new java_cup.runtime.Symbol(
1571: 7/*query_body*/,
1572: ((java_cup.runtime.Symbol) CUP$Parser$stack
1573: .elementAt(CUP$Parser$top - 3)).left,
1574: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1575: RESULT);
1576: }
1577: return CUP$Parser$result;
1578:
1579: /*. . . . . . . . . . . . . . . . . . . .*/
1580: case 7: // query_body ::= FIND maintable ORDERBY orderbys
1581: {
1582: QueryStatement RESULT = null;
1583: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1584: .elementAt(CUP$Parser$top - 2)).left;
1585: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1586: .elementAt(CUP$Parser$top - 2)).right;
1587: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1588: .elementAt(CUP$Parser$top - 2)).value;
1589: int oblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1590: .peek()).left;
1591: int oblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1592: .peek()).right;
1593: List obl = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1594: .peek()).value;
1595:
1596: parser.logger
1597: .debug("syntax will be: FIND <tablespec> ORDERBY <orderbys>");
1598: RESULT = new QueryStatement(tbl, null, obl);
1599: RESULT.setMode(QueryStatement.MODE_FIND);
1600:
1601: CUP$Parser$result = new java_cup.runtime.Symbol(
1602: 7/*query_body*/,
1603: ((java_cup.runtime.Symbol) CUP$Parser$stack
1604: .elementAt(CUP$Parser$top - 3)).left,
1605: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1606: RESULT);
1607: }
1608: return CUP$Parser$result;
1609:
1610: /*. . . . . . . . . . . . . . . . . . . .*/
1611: case 6: // query_body ::= FIND maintable WHERE expression ORDERBY orderbys
1612: {
1613: QueryStatement RESULT = null;
1614: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1615: .elementAt(CUP$Parser$top - 4)).left;
1616: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1617: .elementAt(CUP$Parser$top - 4)).right;
1618: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1619: .elementAt(CUP$Parser$top - 4)).value;
1620: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1621: .elementAt(CUP$Parser$top - 2)).left;
1622: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1623: .elementAt(CUP$Parser$top - 2)).right;
1624: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1625: .elementAt(CUP$Parser$top - 2)).value;
1626: int oblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1627: .peek()).left;
1628: int oblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1629: .peek()).right;
1630: List obl = (List) ((java_cup.runtime.Symbol) CUP$Parser$stack
1631: .peek()).value;
1632:
1633: parser.logger
1634: .debug("syntax will be: FIND <tablespec> WHERE <expression>");
1635: RESULT = new QueryStatement(tbl, expr, obl);
1636: RESULT.setMode(QueryStatement.MODE_FIND);
1637:
1638: CUP$Parser$result = new java_cup.runtime.Symbol(
1639: 7/*query_body*/,
1640: ((java_cup.runtime.Symbol) CUP$Parser$stack
1641: .elementAt(CUP$Parser$top - 5)).left,
1642: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1643: RESULT);
1644: }
1645: return CUP$Parser$result;
1646:
1647: /*. . . . . . . . . . . . . . . . . . . .*/
1648: case 5: // query_body ::= FIND maintable WHERE expression
1649: {
1650: QueryStatement RESULT = null;
1651: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1652: .elementAt(CUP$Parser$top - 2)).left;
1653: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1654: .elementAt(CUP$Parser$top - 2)).right;
1655: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1656: .elementAt(CUP$Parser$top - 2)).value;
1657: int exprleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1658: .peek()).left;
1659: int exprright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1660: .peek()).right;
1661: Expression expr = (Expression) ((java_cup.runtime.Symbol) CUP$Parser$stack
1662: .peek()).value;
1663:
1664: parser.logger
1665: .debug("syntax will be: FIND <tablespec> WHERE <expression>");
1666: RESULT = new QueryStatement(tbl, expr, null);
1667: RESULT.setMode(QueryStatement.MODE_FIND);
1668:
1669: CUP$Parser$result = new java_cup.runtime.Symbol(
1670: 7/*query_body*/,
1671: ((java_cup.runtime.Symbol) CUP$Parser$stack
1672: .elementAt(CUP$Parser$top - 3)).left,
1673: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1674: RESULT);
1675: }
1676: return CUP$Parser$result;
1677:
1678: /*. . . . . . . . . . . . . . . . . . . .*/
1679: case 4: // query_body ::= FIND maintable
1680: {
1681: QueryStatement RESULT = null;
1682: int tblleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1683: .peek()).left;
1684: int tblright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1685: .peek()).right;
1686: TableTerm tbl = (TableTerm) ((java_cup.runtime.Symbol) CUP$Parser$stack
1687: .peek()).value;
1688:
1689: parser.logger.debug("syntax will be: FIND <tablespec>");
1690: RESULT = new QueryStatement(tbl, null, null);
1691: RESULT.setMode(QueryStatement.MODE_FIND);
1692:
1693: CUP$Parser$result = new java_cup.runtime.Symbol(
1694: 7/*query_body*/,
1695: ((java_cup.runtime.Symbol) CUP$Parser$stack
1696: .elementAt(CUP$Parser$top - 1)).left,
1697: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1698: RESULT);
1699: }
1700: return CUP$Parser$result;
1701:
1702: /*. . . . . . . . . . . . . . . . . . . .*/
1703: case 3: // query ::= query_body AT OBJECT
1704: {
1705: QueryStatement RESULT = null;
1706: int stmtleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1707: .elementAt(CUP$Parser$top - 2)).left;
1708: int stmtright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1709: .elementAt(CUP$Parser$top - 2)).right;
1710: QueryStatement stmt = (QueryStatement) ((java_cup.runtime.Symbol) CUP$Parser$stack
1711: .elementAt(CUP$Parser$top - 2)).value;
1712: int valueleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1713: .peek()).left;
1714: int valueright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1715: .peek()).right;
1716: Object value = (Object) ((java_cup.runtime.Symbol) CUP$Parser$stack
1717: .peek()).value;
1718:
1719: stmt.setTimeControl(parser.getTimeControl());
1720: if ((value != null) && (value instanceof Date))
1721: stmt.getTimeControl().setQueryDate((Date) value);
1722: stmt.setTables(stmt.computeTables());
1723: if (parser.logger.isDebugEnabled())
1724: parser.logger.debug("modified tables: "
1725: + parser.getModifiedTables()
1726: + ", statement tables: " + stmt.getTables());
1727: parser.getModifiedTables().retainAll(stmt.getTables());
1728: if (parser.getModifiedTables().size() == 0)
1729: stmt.getTimeControl().setApplyTransaction(
1730: false || stmt.getTimeControl()
1731: .isApplyTransaction());
1732: RESULT = stmt;
1733:
1734: CUP$Parser$result = new java_cup.runtime.Symbol(
1735: 6/*query*/,
1736: ((java_cup.runtime.Symbol) CUP$Parser$stack
1737: .elementAt(CUP$Parser$top - 2)).left,
1738: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1739: RESULT);
1740: }
1741: return CUP$Parser$result;
1742:
1743: /*. . . . . . . . . . . . . . . . . . . .*/
1744: case 2: // query ::= query_body AT DATE
1745: {
1746: QueryStatement RESULT = null;
1747: int stmtleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1748: .elementAt(CUP$Parser$top - 2)).left;
1749: int stmtright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1750: .elementAt(CUP$Parser$top - 2)).right;
1751: QueryStatement stmt = (QueryStatement) ((java_cup.runtime.Symbol) CUP$Parser$stack
1752: .elementAt(CUP$Parser$top - 2)).value;
1753: int dleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1754: .peek()).left;
1755: int dright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1756: .peek()).right;
1757: Date d = (Date) ((java_cup.runtime.Symbol) CUP$Parser$stack
1758: .peek()).value;
1759:
1760: stmt.setTimeControl(parser.getTimeControl());
1761: if (d != null)
1762: stmt.getTimeControl().setQueryDate(d);
1763: stmt.setTables(stmt.computeTables());
1764: if (parser.logger.isDebugEnabled())
1765: parser.logger.debug("modified tables: "
1766: + parser.getModifiedTables()
1767: + ", statement tables: " + stmt.getTables());
1768: parser.getModifiedTables().retainAll(stmt.getTables());
1769: if (parser.getModifiedTables().size() == 0)
1770: stmt.getTimeControl().setApplyTransaction(
1771: false || stmt.getTimeControl()
1772: .isApplyTransaction());
1773: RESULT = stmt;
1774:
1775: CUP$Parser$result = new java_cup.runtime.Symbol(
1776: 6/*query*/,
1777: ((java_cup.runtime.Symbol) CUP$Parser$stack
1778: .elementAt(CUP$Parser$top - 2)).left,
1779: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1780: RESULT);
1781: }
1782: return CUP$Parser$result;
1783:
1784: /*. . . . . . . . . . . . . . . . . . . .*/
1785: case 1: // query ::= query_body
1786: {
1787: QueryStatement RESULT = null;
1788: int stmtleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1789: .peek()).left;
1790: int stmtright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1791: .peek()).right;
1792: QueryStatement stmt = (QueryStatement) ((java_cup.runtime.Symbol) CUP$Parser$stack
1793: .peek()).value;
1794:
1795: stmt.setTimeControl(parser.getTimeControl());
1796: stmt.setTables(stmt.computeTables());
1797: if (parser.logger.isDebugEnabled())
1798: parser.logger.debug("modified tables: "
1799: + parser.getModifiedTables()
1800: + ", statement tables: " + stmt.getTables());
1801: parser.getModifiedTables().retainAll(stmt.getTables());
1802: if (parser.getModifiedTables().size() == 0)
1803: stmt.getTimeControl().setApplyTransaction(
1804: false || stmt.getTimeControl()
1805: .isApplyTransaction());
1806: RESULT = stmt;
1807:
1808: CUP$Parser$result = new java_cup.runtime.Symbol(
1809: 6/*query*/,
1810: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).left,
1811: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1812: RESULT);
1813: }
1814: return CUP$Parser$result;
1815:
1816: /*. . . . . . . . . . . . . . . . . . . .*/
1817: case 0: // $START ::= query EOF
1818: {
1819: Object RESULT = null;
1820: int start_valleft = ((java_cup.runtime.Symbol) CUP$Parser$stack
1821: .elementAt(CUP$Parser$top - 1)).left;
1822: int start_valright = ((java_cup.runtime.Symbol) CUP$Parser$stack
1823: .elementAt(CUP$Parser$top - 1)).right;
1824: QueryStatement start_val = (QueryStatement) ((java_cup.runtime.Symbol) CUP$Parser$stack
1825: .elementAt(CUP$Parser$top - 1)).value;
1826: RESULT = start_val;
1827: CUP$Parser$result = new java_cup.runtime.Symbol(
1828: 0/*$START*/,
1829: ((java_cup.runtime.Symbol) CUP$Parser$stack
1830: .elementAt(CUP$Parser$top - 1)).left,
1831: ((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).right,
1832: RESULT);
1833: }
1834: /* ACCEPT */
1835: CUP$Parser$parser.done_parsing();
1836: return CUP$Parser$result;
1837:
1838: /* . . . . . .*/
1839: default:
1840: throw new Exception(
1841: "Invalid action number found in internal parse table");
1842:
1843: }
1844: }
1845: }
|