Source Code Cross Referenced for SQLParser.java in  » Database-DBMS » Quadcap-Embeddable-Database » com » quadcap » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » Quadcap Embeddable Database » com.quadcap.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        // $ANTLR 2.7.2a2 (20020112-1): "sql.g" -> "SQLParser.java"$
0002:
0003:        package com.quadcap.sql;
0004:
0005:        import antlr.TokenBuffer;
0006:        import antlr.TokenStreamException;
0007:        import antlr.TokenStreamIOException;
0008:        import antlr.ANTLRException;
0009:        import antlr.LLkParser;
0010:        import antlr.Token;
0011:        import antlr.TokenStream;
0012:        import antlr.RecognitionException;
0013:        import antlr.NoViableAltException;
0014:        import antlr.MismatchedTokenException;
0015:        import antlr.SemanticException;
0016:        import antlr.ParserSharedInputState;
0017:        import antlr.collections.impl.BitSet;
0018:
0019:        import java.io.*;
0020:        import java.sql.ResultSet;
0021:        import java.sql.SQLException;
0022:        import java.sql.Types;
0023:        import java.util.Vector;
0024:        import com.quadcap.sql.types.Type;
0025:        import com.quadcap.sql.types.TypeReal;
0026:        import com.quadcap.sql.types.*;
0027:
0028:        public class SQLParser extends antlr.LLkParser implements  SQLTokenTypes {
0029:
0030:            Vector parameters = new Vector();
0031:            Session session = null;
0032:            Connection qConn = null;
0033:
0034:            void addParameter(ParameterExpression e) {
0035:                parameters.addElement(e);
0036:            }
0037:
0038:            public Vector getParameters() {
0039:                return parameters;
0040:            }
0041:
0042:            public SQLParser(Session session, String cmd, boolean esc) {
0043:                super ((esc ? (TokenStream) (new JdbcEscapeTokenStream(
0044:                        new SQLLexer(new StringReader(cmd))))
0045:                        : (TokenStream) (new SQLLexer(new StringReader(cmd)))),
0046:                        2);
0047:                this .session = session;
0048:                this .qConn = session.getConnection();
0049:                tokenNames = _tokenNames;
0050:            }
0051:
0052:            String fixIdTerm(String s) {
0053:                if (s.charAt(0) == '"') {
0054:                    boolean bad = false;
0055:                    for (int i = 1; !bad && i < s.length() - 1; i++) {
0056:                        char c = s.charAt(i);
0057:                        if (Character.isUpperCase(c)
0058:                                || (i > 1 && Character.isDigit(c) || c == '_')) {
0059:                        } else {
0060:                            bad = true;
0061:                        }
0062:                    }
0063:                    if (bad) {
0064:                        return s;
0065:                    } else {
0066:                        return s.substring(1, s.length() - 1).toUpperCase();
0067:                    }
0068:                } else {
0069:                    return s.toUpperCase();
0070:                }
0071:            }
0072:
0073:            protected SQLParser(TokenBuffer tokenBuf, int k) {
0074:                super (tokenBuf, k);
0075:                tokenNames = _tokenNames;
0076:            }
0077:
0078:            public SQLParser(TokenBuffer tokenBuf) {
0079:                this (tokenBuf, 2);
0080:            }
0081:
0082:            protected SQLParser(TokenStream lexer, int k) {
0083:                super (lexer, k);
0084:                tokenNames = _tokenNames;
0085:            }
0086:
0087:            public SQLParser(TokenStream lexer) {
0088:                this (lexer, 2);
0089:            }
0090:
0091:            public SQLParser(ParserSharedInputState state) {
0092:                super (state, 2);
0093:                tokenNames = _tokenNames;
0094:            }
0095:
0096:            public final Stmt statement() throws RecognitionException,
0097:                    TokenStreamException {
0098:                Stmt s;
0099:
0100:                s = null;
0101:                parameters.clear();
0102:
0103:                switch (LA(1)) {
0104:                case LITERAL_alter: {
0105:                    s = alterTableStmt();
0106:                    break;
0107:                }
0108:                case LITERAL_delete: {
0109:                    s = deleteStmt();
0110:                    break;
0111:                }
0112:                case LITERAL_grant: {
0113:                    s = grantStmt();
0114:                    break;
0115:                }
0116:                case LITERAL_insert: {
0117:                    s = insertStmt();
0118:                    break;
0119:                }
0120:                case LITERAL_table:
0121:                case LPAREN:
0122:                case LITERAL_select:
0123:                case LITERAL_values:
0124:                case ID: {
0125:                    s = selectStmt();
0126:                    break;
0127:                }
0128:                case LITERAL_update: {
0129:                    s = updateStmt();
0130:                    break;
0131:                }
0132:                case LITERAL_commit: {
0133:                    s = commitStmt();
0134:                    break;
0135:                }
0136:                case LITERAL_rollback: {
0137:                    s = rollbackStmt();
0138:                    break;
0139:                }
0140:                default:
0141:                    boolean synPredMatched4 = false;
0142:                    if (((LA(1) == LITERAL_create) && (LA(2) == LITERAL_unique || LA(2) == LITERAL_index))) {
0143:                        int _m4 = mark();
0144:                        synPredMatched4 = true;
0145:                        inputState.guessing++;
0146:                        try {
0147:                            {
0148:                                match(LITERAL_create);
0149:                                {
0150:                                    switch (LA(1)) {
0151:                                    case LITERAL_unique: {
0152:                                        match(LITERAL_unique);
0153:                                        break;
0154:                                    }
0155:                                    case LITERAL_index: {
0156:                                        break;
0157:                                    }
0158:                                    default: {
0159:                                        throw new NoViableAltException(LT(1),
0160:                                                getFilename());
0161:                                    }
0162:                                    }
0163:                                }
0164:                                match(LITERAL_index);
0165:                            }
0166:                        } catch (RecognitionException pe) {
0167:                            synPredMatched4 = false;
0168:                        }
0169:                        rewind(_m4);
0170:                        inputState.guessing--;
0171:                    }
0172:                    if (synPredMatched4) {
0173:                        s = createIndexStmt();
0174:                    } else {
0175:                        boolean synPredMatched6 = false;
0176:                        if (((LA(1) == LITERAL_create) && (LA(2) == LITERAL_schema))) {
0177:                            int _m6 = mark();
0178:                            synPredMatched6 = true;
0179:                            inputState.guessing++;
0180:                            try {
0181:                                {
0182:                                    match(LITERAL_create);
0183:                                    match(LITERAL_schema);
0184:                                }
0185:                            } catch (RecognitionException pe) {
0186:                                synPredMatched6 = false;
0187:                            }
0188:                            rewind(_m6);
0189:                            inputState.guessing--;
0190:                        }
0191:                        if (synPredMatched6) {
0192:                            s = createSchemaStmt();
0193:                        } else {
0194:                            boolean synPredMatched9 = false;
0195:                            if (((LA(1) == LITERAL_create) && (LA(2) == LITERAL_temporary
0196:                                    || LA(2) == LITERAL_table
0197:                                    || LA(2) == LITERAL_global || LA(2) == LITERAL_local))) {
0198:                                int _m9 = mark();
0199:                                synPredMatched9 = true;
0200:                                inputState.guessing++;
0201:                                try {
0202:                                    {
0203:                                        match(LITERAL_create);
0204:                                        {
0205:                                            switch (LA(1)) {
0206:                                            case LITERAL_temporary: {
0207:                                                match(LITERAL_temporary);
0208:                                                break;
0209:                                            }
0210:                                            case LITERAL_table: {
0211:                                                break;
0212:                                            }
0213:                                            default: {
0214:                                                throw new NoViableAltException(
0215:                                                        LT(1), getFilename());
0216:                                            }
0217:                                            }
0218:                                        }
0219:                                        match(LITERAL_table);
0220:                                    }
0221:                                } catch (RecognitionException pe) {
0222:                                    synPredMatched9 = false;
0223:                                }
0224:                                rewind(_m9);
0225:                                inputState.guessing--;
0226:                            }
0227:                            if (synPredMatched9) {
0228:                                s = createTableStmt();
0229:                            } else {
0230:                                boolean synPredMatched11 = false;
0231:                                if (((LA(1) == LITERAL_create) && (LA(2) == LITERAL_view))) {
0232:                                    int _m11 = mark();
0233:                                    synPredMatched11 = true;
0234:                                    inputState.guessing++;
0235:                                    try {
0236:                                        {
0237:                                            match(LITERAL_create);
0238:                                            match(LITERAL_view);
0239:                                        }
0240:                                    } catch (RecognitionException pe) {
0241:                                        synPredMatched11 = false;
0242:                                    }
0243:                                    rewind(_m11);
0244:                                    inputState.guessing--;
0245:                                }
0246:                                if (synPredMatched11) {
0247:                                    s = createViewStmt();
0248:                                } else {
0249:                                    boolean synPredMatched14 = false;
0250:                                    if (((LA(1) == LITERAL_drop) && (LA(2) == LITERAL_table || LA(2) == LITERAL_view))) {
0251:                                        int _m14 = mark();
0252:                                        synPredMatched14 = true;
0253:                                        inputState.guessing++;
0254:                                        try {
0255:                                            {
0256:                                                match(LITERAL_drop);
0257:                                                {
0258:                                                    switch (LA(1)) {
0259:                                                    case LITERAL_table: {
0260:                                                        match(LITERAL_table);
0261:                                                        break;
0262:                                                    }
0263:                                                    case LITERAL_view: {
0264:                                                        match(LITERAL_view);
0265:                                                        break;
0266:                                                    }
0267:                                                    default: {
0268:                                                        throw new NoViableAltException(
0269:                                                                LT(1),
0270:                                                                getFilename());
0271:                                                    }
0272:                                                    }
0273:                                                }
0274:                                            }
0275:                                        } catch (RecognitionException pe) {
0276:                                            synPredMatched14 = false;
0277:                                        }
0278:                                        rewind(_m14);
0279:                                        inputState.guessing--;
0280:                                    }
0281:                                    if (synPredMatched14) {
0282:                                        s = dropTableStmt();
0283:                                    } else {
0284:                                        boolean synPredMatched16 = false;
0285:                                        if (((LA(1) == LITERAL_drop) && (LA(2) == LITERAL_index))) {
0286:                                            int _m16 = mark();
0287:                                            synPredMatched16 = true;
0288:                                            inputState.guessing++;
0289:                                            try {
0290:                                                {
0291:                                                    match(LITERAL_drop);
0292:                                                    match(LITERAL_index);
0293:                                                }
0294:                                            } catch (RecognitionException pe) {
0295:                                                synPredMatched16 = false;
0296:                                            }
0297:                                            rewind(_m16);
0298:                                            inputState.guessing--;
0299:                                        }
0300:                                        if (synPredMatched16) {
0301:                                            s = dropIndexStmt();
0302:                                        } else {
0303:                                            throw new NoViableAltException(
0304:                                                    LT(1), getFilename());
0305:                                        }
0306:                                    }
0307:                                }
0308:                            }
0309:                        }
0310:                    }
0311:                }
0312:                return s;
0313:            }
0314:
0315:            public final Stmt alterTableStmt() throws RecognitionException,
0316:                    TokenStreamException {
0317:                Stmt s;
0318:
0319:                s = null;
0320:                String id = null;
0321:
0322:                match(LITERAL_alter);
0323:                match(LITERAL_table);
0324:                id = sqlId();
0325:                if (inputState.guessing == 0) {
0326:                    id = qConn.resolveName(id);
0327:                }
0328:                {
0329:                    switch (LA(1)) {
0330:                    case LITERAL_alter: {
0331:                        s = alterColumn(id);
0332:                        break;
0333:                    }
0334:                    case LITERAL_rename: {
0335:                        s = renameTable(id);
0336:                        break;
0337:                    }
0338:                    default:
0339:                        boolean synPredMatched28 = false;
0340:                        if (((LA(1) == LITERAL_add) && (LA(2) == LITERAL_unique
0341:                                || LA(2) == LITERAL_constraint
0342:                                || LA(2) == LITERAL_primary
0343:                                || LA(2) == LITERAL_foreign || LA(2) == LITERAL_check))) {
0344:                            int _m28 = mark();
0345:                            synPredMatched28 = true;
0346:                            inputState.guessing++;
0347:                            try {
0348:                                {
0349:                                    match(LITERAL_add);
0350:                                    {
0351:                                        switch (LA(1)) {
0352:                                        case LITERAL_constraint: {
0353:                                            match(LITERAL_constraint);
0354:                                            break;
0355:                                        }
0356:                                        case LITERAL_primary: {
0357:                                            match(LITERAL_primary);
0358:                                            break;
0359:                                        }
0360:                                        case LITERAL_unique: {
0361:                                            match(LITERAL_unique);
0362:                                            break;
0363:                                        }
0364:                                        case LITERAL_foreign: {
0365:                                            match(LITERAL_foreign);
0366:                                            break;
0367:                                        }
0368:                                        case LITERAL_check: {
0369:                                            match(LITERAL_check);
0370:                                            break;
0371:                                        }
0372:                                        default: {
0373:                                            throw new NoViableAltException(
0374:                                                    LT(1), getFilename());
0375:                                        }
0376:                                        }
0377:                                    }
0378:                                }
0379:                            } catch (RecognitionException pe) {
0380:                                synPredMatched28 = false;
0381:                            }
0382:                            rewind(_m28);
0383:                            inputState.guessing--;
0384:                        }
0385:                        if (synPredMatched28) {
0386:                            s = addConstraint(id);
0387:                        } else {
0388:                            boolean synPredMatched30 = false;
0389:                            if (((LA(1) == LITERAL_add) && (LA(2) == LITERAL_column || LA(2) == ID))) {
0390:                                int _m30 = mark();
0391:                                synPredMatched30 = true;
0392:                                inputState.guessing++;
0393:                                try {
0394:                                    {
0395:                                        match(LITERAL_add);
0396:                                    }
0397:                                } catch (RecognitionException pe) {
0398:                                    synPredMatched30 = false;
0399:                                }
0400:                                rewind(_m30);
0401:                                inputState.guessing--;
0402:                            }
0403:                            if (synPredMatched30) {
0404:                                s = addColumn(id);
0405:                            } else {
0406:                                boolean synPredMatched32 = false;
0407:                                if (((LA(1) == LITERAL_drop) && (LA(2) == LITERAL_constraint))) {
0408:                                    int _m32 = mark();
0409:                                    synPredMatched32 = true;
0410:                                    inputState.guessing++;
0411:                                    try {
0412:                                        {
0413:                                            match(LITERAL_drop);
0414:                                            match(LITERAL_constraint);
0415:                                        }
0416:                                    } catch (RecognitionException pe) {
0417:                                        synPredMatched32 = false;
0418:                                    }
0419:                                    rewind(_m32);
0420:                                    inputState.guessing--;
0421:                                }
0422:                                if (synPredMatched32) {
0423:                                    s = dropConstraint(id);
0424:                                } else {
0425:                                    boolean synPredMatched34 = false;
0426:                                    if (((LA(1) == LITERAL_drop) && (LA(2) == LITERAL_column || LA(2) == ID))) {
0427:                                        int _m34 = mark();
0428:                                        synPredMatched34 = true;
0429:                                        inputState.guessing++;
0430:                                        try {
0431:                                            {
0432:                                                match(LITERAL_drop);
0433:                                            }
0434:                                        } catch (RecognitionException pe) {
0435:                                            synPredMatched34 = false;
0436:                                        }
0437:                                        rewind(_m34);
0438:                                        inputState.guessing--;
0439:                                    }
0440:                                    if (synPredMatched34) {
0441:                                        s = dropColumn(id);
0442:                                    } else {
0443:                                        throw new NoViableAltException(LT(1),
0444:                                                getFilename());
0445:                                    }
0446:                                }
0447:                            }
0448:                        }
0449:                    }
0450:                }
0451:                return s;
0452:            }
0453:
0454:            public final Stmt createIndexStmt() throws RecognitionException,
0455:                    TokenStreamException {
0456:                Stmt s;
0457:
0458:                s = null;
0459:                String indexName = null;
0460:                String tableName = null;
0461:                Vector columns;
0462:                boolean unique = false;
0463:                boolean text = false;
0464:
0465:                match(LITERAL_create);
0466:                {
0467:                    switch (LA(1)) {
0468:                    case LITERAL_unique: {
0469:                        match(LITERAL_unique);
0470:                        if (inputState.guessing == 0) {
0471:                            unique = true;
0472:                        }
0473:                        break;
0474:                    }
0475:                    case LITERAL_index: {
0476:                        break;
0477:                    }
0478:                    default: {
0479:                        throw new NoViableAltException(LT(1), getFilename());
0480:                    }
0481:                    }
0482:                }
0483:                match(LITERAL_index);
0484:                indexName = sqlId();
0485:                match(LITERAL_on);
0486:                tableName = sqlId();
0487:                match(LPAREN);
0488:                columns = idList();
0489:                match(RPAREN);
0490:                if (inputState.guessing == 0) {
0491:
0492:                    tableName = qConn.resolveName(tableName);
0493:                    indexName = qConn.resolveName(indexName);
0494:                    s = new StmtCreateIndex(indexName, tableName, columns,
0495:                            unique, text);
0496:
0497:                }
0498:                return s;
0499:            }
0500:
0501:            public final StmtCreateSchema createSchemaStmt()
0502:                    throws RecognitionException, TokenStreamException {
0503:                StmtCreateSchema s;
0504:
0505:                s = null;
0506:                String name = null;
0507:                String auth = null;
0508:                Stmt s1 = null;
0509:
0510:                match(LITERAL_create);
0511:                match(LITERAL_schema);
0512:                {
0513:                    switch (LA(1)) {
0514:                    case ID: {
0515:                        name = sqlId();
0516:                        {
0517:                            switch (LA(1)) {
0518:                            case LITERAL_authorization: {
0519:                                match(LITERAL_authorization);
0520:                                auth = sqlId();
0521:                                break;
0522:                            }
0523:                            case EOF:
0524:                            case LITERAL_create:
0525:                            case LITERAL_grant: {
0526:                                break;
0527:                            }
0528:                            default: {
0529:                                throw new NoViableAltException(LT(1),
0530:                                        getFilename());
0531:                            }
0532:                            }
0533:                        }
0534:                        break;
0535:                    }
0536:                    case LITERAL_authorization: {
0537:                        match(LITERAL_authorization);
0538:                        name = sqlId();
0539:                        if (inputState.guessing == 0) {
0540:                            auth = name;
0541:                        }
0542:                        break;
0543:                    }
0544:                    default: {
0545:                        throw new NoViableAltException(LT(1), getFilename());
0546:                    }
0547:                    }
0548:                }
0549:                if (inputState.guessing == 0) {
0550:
0551:                    try {
0552:                        s = new StmtCreateSchema(name, auth);
0553:                        qConn.setAuth(name, null);
0554:                    } catch (SQLException ex) {
0555:                        throw new RecognitionException("Bad auth");
0556:                    }
0557:
0558:                }
0559:                {
0560:                    _loop71: do {
0561:                        if ((LA(1) == LITERAL_create || LA(1) == LITERAL_grant)) {
0562:                            s1 = schemaStatement();
0563:                            if (inputState.guessing == 0) {
0564:                                s.addStatement(s1);
0565:                            }
0566:                        } else {
0567:                            break _loop71;
0568:                        }
0569:
0570:                    } while (true);
0571:                }
0572:                return s;
0573:            }
0574:
0575:            public final Stmt createTableStmt() throws RecognitionException,
0576:                    TokenStreamException {
0577:                Stmt s;
0578:
0579:                s = null;
0580:                Column col = null;
0581:                Constraint con = null;
0582:                Vector constraints = new Vector();
0583:                Table t = null;
0584:                String id = null;
0585:                int modifiers = 0;
0586:
0587:                match(LITERAL_create);
0588:                {
0589:                    switch (LA(1)) {
0590:                    case LITERAL_global: {
0591:                        match(LITERAL_global);
0592:                        if (inputState.guessing == 0) {
0593:                            modifiers |= Table.GLOBAL;
0594:                        }
0595:                        break;
0596:                    }
0597:                    case LITERAL_local: {
0598:                        match(LITERAL_local);
0599:                        if (inputState.guessing == 0) {
0600:                            modifiers |= Table.LOCAL;
0601:                        }
0602:                        break;
0603:                    }
0604:                    case LITERAL_temporary:
0605:                    case LITERAL_table: {
0606:                        break;
0607:                    }
0608:                    default: {
0609:                        throw new NoViableAltException(LT(1), getFilename());
0610:                    }
0611:                    }
0612:                }
0613:                {
0614:                    switch (LA(1)) {
0615:                    case LITERAL_temporary: {
0616:                        match(LITERAL_temporary);
0617:                        if (inputState.guessing == 0) {
0618:                            modifiers |= Table.TEMPORARY;
0619:                        }
0620:                        break;
0621:                    }
0622:                    case LITERAL_table: {
0623:                        break;
0624:                    }
0625:                    default: {
0626:                        throw new NoViableAltException(LT(1), getFilename());
0627:                    }
0628:                    }
0629:                }
0630:                match(LITERAL_table);
0631:                id = sqlId();
0632:                match(LPAREN);
0633:                if (inputState.guessing == 0) {
0634:
0635:                    t = new Table(qConn.resolveName(id), modifiers);
0636:
0637:                }
0638:                {
0639:                    switch (LA(1)) {
0640:                    case ID: {
0641:                        col = columnDefinition();
0642:                        if (inputState.guessing == 0) {
0643:
0644:                            try {
0645:                                t.addColumn(col);
0646:                            } catch (SQLException e) {
0647:                                throw new DbException(e);
0648:                            }
0649:
0650:                        }
0651:                        break;
0652:                    }
0653:                    case LITERAL_unique:
0654:                    case LITERAL_constraint:
0655:                    case LITERAL_primary:
0656:                    case LITERAL_foreign:
0657:                    case LITERAL_check: {
0658:                        con = tableConstraint();
0659:                        if (inputState.guessing == 0) {
0660:
0661:                            constraints.addElement(con);
0662:
0663:                        }
0664:                        break;
0665:                    }
0666:                    case RPAREN:
0667:                    case COMMA: {
0668:                        break;
0669:                    }
0670:                    default: {
0671:                        throw new NoViableAltException(LT(1), getFilename());
0672:                    }
0673:                    }
0674:                }
0675:                {
0676:                    _loop87: do {
0677:                        if ((LA(1) == COMMA)) {
0678:                            match(COMMA);
0679:                            {
0680:                                switch (LA(1)) {
0681:                                case ID: {
0682:                                    col = columnDefinition();
0683:                                    if (inputState.guessing == 0) {
0684:
0685:                                        try {
0686:                                            t.addColumn(col);
0687:                                        } catch (SQLException e) {
0688:                                            throw new DbException(e);
0689:                                        }
0690:
0691:                                    }
0692:                                    break;
0693:                                }
0694:                                case LITERAL_unique:
0695:                                case LITERAL_constraint:
0696:                                case LITERAL_primary:
0697:                                case LITERAL_foreign:
0698:                                case LITERAL_check: {
0699:                                    con = tableConstraint();
0700:                                    if (inputState.guessing == 0) {
0701:
0702:                                        constraints.addElement(con);
0703:
0704:                                    }
0705:                                    break;
0706:                                }
0707:                                default: {
0708:                                    throw new NoViableAltException(LT(1),
0709:                                            getFilename());
0710:                                }
0711:                                }
0712:                            }
0713:                        } else {
0714:                            break _loop87;
0715:                        }
0716:
0717:                    } while (true);
0718:                }
0719:                match(RPAREN);
0720:                if (inputState.guessing == 0) {
0721:
0722:                    s = new StmtCreateTable(t, constraints);
0723:
0724:                }
0725:                return s;
0726:            }
0727:
0728:            public final StmtCreateView createViewStmt()
0729:                    throws RecognitionException, TokenStreamException {
0730:                StmtCreateView s;
0731:
0732:                s = null;
0733:                Vector columns = null;
0734:                TableExpression te = null;
0735:                int check = View.NOCHECK;
0736:                String id = null;
0737:
0738:                match(LITERAL_create);
0739:                match(LITERAL_view);
0740:                id = sqlId();
0741:                {
0742:                    switch (LA(1)) {
0743:                    case LPAREN: {
0744:                        match(LPAREN);
0745:                        columns = idList();
0746:                        match(RPAREN);
0747:                        break;
0748:                    }
0749:                    case LITERAL_as: {
0750:                        break;
0751:                    }
0752:                    default: {
0753:                        throw new NoViableAltException(LT(1), getFilename());
0754:                    }
0755:                    }
0756:                }
0757:                match(LITERAL_as);
0758:                te = queryExpression();
0759:                {
0760:                    switch (LA(1)) {
0761:                    case LITERAL_with: {
0762:                        match(LITERAL_with);
0763:                        if (inputState.guessing == 0) {
0764:                            check = View.CASCADED;
0765:                        }
0766:                        {
0767:                            switch (LA(1)) {
0768:                            case LITERAL_cascaded: {
0769:                                match(LITERAL_cascaded);
0770:                                break;
0771:                            }
0772:                            case LITERAL_check: {
0773:                                break;
0774:                            }
0775:                            default: {
0776:                                throw new NoViableAltException(LT(1),
0777:                                        getFilename());
0778:                            }
0779:                            }
0780:                        }
0781:                        match(LITERAL_check);
0782:                        match(LITERAL_option);
0783:                        break;
0784:                    }
0785:                    case EOF:
0786:                    case LITERAL_create:
0787:                    case LITERAL_grant: {
0788:                        break;
0789:                    }
0790:                    default: {
0791:                        throw new NoViableAltException(LT(1), getFilename());
0792:                    }
0793:                    }
0794:                }
0795:                if (inputState.guessing == 0) {
0796:
0797:                    String name = qConn.resolveName(id);
0798:                    View view = new View(name, columns, te, check);
0799:                    s = new StmtCreateView(session, view);
0800:
0801:                }
0802:                return s;
0803:            }
0804:
0805:            public final Stmt deleteStmt() throws RecognitionException,
0806:                    TokenStreamException {
0807:                Stmt s;
0808:
0809:                s = null;
0810:                Expression e = null;
0811:                String id = null;
0812:
0813:                match(LITERAL_delete);
0814:                match(LITERAL_from);
0815:                id = sqlId();
0816:                e = whereExpression();
0817:                if (inputState.guessing == 0) {
0818:
0819:                    String n = qConn.resolveName(id);
0820:                    s = new StmtDelete(n, e);
0821:
0822:                }
0823:                return s;
0824:            }
0825:
0826:            public final Stmt dropTableStmt() throws RecognitionException,
0827:                    TokenStreamException {
0828:                Stmt s;
0829:
0830:                s = null;
0831:                boolean restrict = true;
0832:                boolean view = false;
0833:                String id;
0834:                String n;
0835:
0836:                match(LITERAL_drop);
0837:                {
0838:                    switch (LA(1)) {
0839:                    case LITERAL_table: {
0840:                        match(LITERAL_table);
0841:                        break;
0842:                    }
0843:                    case LITERAL_view: {
0844:                        match(LITERAL_view);
0845:                        if (inputState.guessing == 0) {
0846:                            view = true;
0847:                        }
0848:                        break;
0849:                    }
0850:                    default: {
0851:                        throw new NoViableAltException(LT(1), getFilename());
0852:                    }
0853:                    }
0854:                }
0855:                id = sqlId();
0856:                {
0857:                    switch (LA(1)) {
0858:                    case LITERAL_cascade: {
0859:                        match(LITERAL_cascade);
0860:                        if (inputState.guessing == 0) {
0861:                            restrict = false;
0862:                        }
0863:                        break;
0864:                    }
0865:                    case LITERAL_restrict: {
0866:                        match(LITERAL_restrict);
0867:                        if (inputState.guessing == 0) {
0868:                            restrict = true;
0869:                        }
0870:                        break;
0871:                    }
0872:                    case EOF: {
0873:                        break;
0874:                    }
0875:                    default: {
0876:                        throw new NoViableAltException(LT(1), getFilename());
0877:                    }
0878:                    }
0879:                }
0880:                if (inputState.guessing == 0) {
0881:
0882:                    n = qConn.resolveName(id);
0883:                    s = new StmtDropTable(n, view, restrict);
0884:
0885:                }
0886:                return s;
0887:            }
0888:
0889:            public final Stmt dropIndexStmt() throws RecognitionException,
0890:                    TokenStreamException {
0891:                Stmt s;
0892:
0893:                s = null;
0894:                String indexName = null;
0895:
0896:                match(LITERAL_drop);
0897:                match(LITERAL_index);
0898:                indexName = sqlId();
0899:                if (inputState.guessing == 0) {
0900:
0901:                    indexName = qConn.resolveName(indexName);
0902:                    s = new StmtDropIndex(indexName);
0903:
0904:                }
0905:                return s;
0906:            }
0907:
0908:            public final Stmt grantStmt() throws RecognitionException,
0909:                    TokenStreamException {
0910:                Stmt s;
0911:
0912:                s = null;
0913:                String id = null;
0914:
0915:                match(LITERAL_grant);
0916:                privilege();
0917:                {
0918:                    _loop90: do {
0919:                        if ((LA(1) == COMMA)) {
0920:                            match(COMMA);
0921:                            privilege();
0922:                        } else {
0923:                            break _loop90;
0924:                        }
0925:
0926:                    } while (true);
0927:                }
0928:                match(LITERAL_on);
0929:                {
0930:                    switch (LA(1)) {
0931:                    case LITERAL_table: {
0932:                        match(LITERAL_table);
0933:                        break;
0934:                    }
0935:                    case ID: {
0936:                        break;
0937:                    }
0938:                    default: {
0939:                        throw new NoViableAltException(LT(1), getFilename());
0940:                    }
0941:                    }
0942:                }
0943:                id = sqlId();
0944:                match(LITERAL_to);
0945:                {
0946:                    switch (LA(1)) {
0947:                    case ID: {
0948:                        id = sqlId();
0949:                        {
0950:                            _loop94: do {
0951:                                if ((LA(1) == COMMA)) {
0952:                                    match(COMMA);
0953:                                    id = sqlId();
0954:                                } else {
0955:                                    break _loop94;
0956:                                }
0957:
0958:                            } while (true);
0959:                        }
0960:                        break;
0961:                    }
0962:                    case LITERAL_public: {
0963:                        match(LITERAL_public);
0964:                        break;
0965:                    }
0966:                    default: {
0967:                        throw new NoViableAltException(LT(1), getFilename());
0968:                    }
0969:                    }
0970:                }
0971:                {
0972:                    switch (LA(1)) {
0973:                    case LITERAL_with: {
0974:                        match(LITERAL_with);
0975:                        match(LITERAL_grant);
0976:                        match(LITERAL_option);
0977:                        break;
0978:                    }
0979:                    case EOF:
0980:                    case LITERAL_create:
0981:                    case LITERAL_grant: {
0982:                        break;
0983:                    }
0984:                    default: {
0985:                        throw new NoViableAltException(LT(1), getFilename());
0986:                    }
0987:                    }
0988:                }
0989:                if (inputState.guessing == 0) {
0990:                    s = new StmtNull();
0991:                }
0992:                return s;
0993:            }
0994:
0995:            public final StmtInsert insertStmt() throws RecognitionException,
0996:                    TokenStreamException {
0997:                StmtInsert s;
0998:
0999:                s = null;
1000:                ResultSet rs = null;
1001:                Vector columns = null;
1002:                Expression query = null;
1003:                String n = null;
1004:                String id = null;
1005:
1006:                match(LITERAL_insert);
1007:                match(LITERAL_into);
1008:                id = sqlId();
1009:                if (inputState.guessing == 0) {
1010:
1011:                    n = qConn.resolveName(id);
1012:                    s = new StmtInsert(n);
1013:
1014:                }
1015:                {
1016:                    if ((LA(1) == LPAREN) && (LA(2) == ID)) {
1017:                        match(LPAREN);
1018:                        columns = idList();
1019:                        if (inputState.guessing == 0) {
1020:                            s.setColumns(columns);
1021:                        }
1022:                        match(RPAREN);
1023:                    } else if ((LA(1) == LITERAL_table || LA(1) == LPAREN
1024:                            || LA(1) == LITERAL_default
1025:                            || LA(1) == LITERAL_select
1026:                            || LA(1) == LITERAL_values || LA(1) == ID)
1027:                            && (LA(2) == EOF || LA(2) == LITERAL_unique
1028:                                    || LA(2) == LITERAL_table
1029:                                    || LA(2) == LPAREN
1030:                                    || LA(2) == LITERAL_default
1031:                                    || LA(2) == LITERAL_as
1032:                                    || LA(2) == LITERAL_all
1033:                                    || LA(2) == LITERAL_select
1034:                                    || LA(2) == LITERAL_insert
1035:                                    || LA(2) == LITERAL_not
1036:                                    || LA(2) == LITERAL_null
1037:                                    || LA(2) == LITERAL_full
1038:                                    || LA(2) == LITERAL_char
1039:                                    || LA(2) == LITERAL_date
1040:                                    || LA(2) == LITERAL_time
1041:                                    || LA(2) == LITERAL_timestamp
1042:                                    || LA(2) == LITERAL_interval
1043:                                    || LA(2) == LITERAL_distinct
1044:                                    || LA(2) == STAR || LA(2) == LITERAL_values
1045:                                    || LA(2) == LITERAL_exists || LA(2) == PLUS
1046:                                    || LA(2) == MINUS
1047:                                    || LA(2) == STRING_LITERAL
1048:                                    || LA(2) == QUESTION || LA(2) == INT
1049:                                    || LA(2) == REAL || LA(2) == BINSTR
1050:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
1051:                                    || LA(2) == LITERAL_hour
1052:                                    || LA(2) == LITERAL_left
1053:                                    || LA(2) == LITERAL_minute
1054:                                    || LA(2) == LITERAL_month
1055:                                    || LA(2) == LITERAL_right
1056:                                    || LA(2) == LITERAL_second
1057:                                    || LA(2) == LITERAL_year
1058:                                    || LA(2) == LITERAL_user
1059:                                    || LA(2) == LITERAL_current_user
1060:                                    || LA(2) == LITERAL_session_user
1061:                                    || LA(2) == LITERAL_system_user
1062:                                    || LA(2) == LITERAL_current_date
1063:                                    || LA(2) == LITERAL_current_time
1064:                                    || LA(2) == LITERAL_current_timestamp
1065:                                    || LA(2) == LITERAL_sql_tsi_frac_second
1066:                                    || LA(2) == LITERAL_sql_tsi_second
1067:                                    || LA(2) == LITERAL_sql_tsi_minute
1068:                                    || LA(2) == LITERAL_sql_tsi_hour
1069:                                    || LA(2) == LITERAL_sql_tsi_day
1070:                                    || LA(2) == LITERAL_sql_tsi_week
1071:                                    || LA(2) == LITERAL_sql_tsi_month
1072:                                    || LA(2) == LITERAL_sql_tsi_quarter
1073:                                    || LA(2) == LITERAL_sql_tsi_year
1074:                                    || LA(2) == LITERAL_cast
1075:                                    || LA(2) == LITERAL_true
1076:                                    || LA(2) == LITERAL_false
1077:                                    || LA(2) == LITERAL_avg
1078:                                    || LA(2) == LITERAL_min
1079:                                    || LA(2) == LITERAL_max
1080:                                    || LA(2) == LITERAL_sum
1081:                                    || LA(2) == LITERAL_count
1082:                                    || LA(2) == LITERAL_cross
1083:                                    || LA(2) == LITERAL_join
1084:                                    || LA(2) == LITERAL_natural
1085:                                    || LA(2) == LITERAL_union
1086:                                    || LA(2) == LITERAL_inner
1087:                                    || LA(2) == LITERAL_intersect
1088:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
1089:                    } else {
1090:                        throw new NoViableAltException(LT(1), getFilename());
1091:                    }
1092:
1093:                }
1094:                {
1095:                    switch (LA(1)) {
1096:                    case LITERAL_table:
1097:                    case LPAREN:
1098:                    case LITERAL_select:
1099:                    case LITERAL_values:
1100:                    case ID: {
1101:                        query = queryExpression();
1102:                        if (inputState.guessing == 0) {
1103:                            s.setValues(query);
1104:                        }
1105:                        break;
1106:                    }
1107:                    case LITERAL_default: {
1108:                        match(LITERAL_default);
1109:                        match(LITERAL_values);
1110:                        if (inputState.guessing == 0) {
1111:                            s.setDefaultValue();
1112:                        }
1113:                        break;
1114:                    }
1115:                    default: {
1116:                        throw new NoViableAltException(LT(1), getFilename());
1117:                    }
1118:                    }
1119:                }
1120:                return s;
1121:            }
1122:
1123:            public final SelectStmt selectStmt() throws RecognitionException,
1124:                    TokenStreamException {
1125:                SelectStmt s;
1126:
1127:                s = null;
1128:                TableExpression te = null;
1129:                Vector ob = null;
1130:
1131:                te = queryExpression();
1132:                if (inputState.guessing == 0) {
1133:                    s = new SelectStmt(te);
1134:                }
1135:                {
1136:                    switch (LA(1)) {
1137:                    case LITERAL_order: {
1138:                        ob = orderBy();
1139:                        if (inputState.guessing == 0) {
1140:                            s.setOrder(ob);
1141:                        }
1142:                        break;
1143:                    }
1144:                    case LITERAL_for: {
1145:                        match(LITERAL_for);
1146:                        {
1147:                            switch (LA(1)) {
1148:                            case LITERAL_update: {
1149:                                match(LITERAL_update);
1150:                                break;
1151:                            }
1152:                            case LITERAL_read: {
1153:                                match(LITERAL_read);
1154:                                match(LITERAL_only);
1155:                                break;
1156:                            }
1157:                            default: {
1158:                                throw new NoViableAltException(LT(1),
1159:                                        getFilename());
1160:                            }
1161:                            }
1162:                        }
1163:                        break;
1164:                    }
1165:                    case EOF: {
1166:                        break;
1167:                    }
1168:                    default: {
1169:                        throw new NoViableAltException(LT(1), getFilename());
1170:                    }
1171:                    }
1172:                }
1173:                return s;
1174:            }
1175:
1176:            public final StmtUpdate updateStmt() throws RecognitionException,
1177:                    TokenStreamException {
1178:                StmtUpdate s;
1179:
1180:                s = null;
1181:                String n = null;
1182:                UpdateItem item = null;
1183:                Expression we = null;
1184:                String id = null;
1185:
1186:                match(LITERAL_update);
1187:                id = sqlId();
1188:                if (inputState.guessing == 0) {
1189:
1190:                    n = qConn.resolveName(id);
1191:                    s = new StmtUpdate(n);
1192:
1193:                }
1194:                match(LITERAL_set);
1195:                {
1196:                    switch (LA(1)) {
1197:                    case ID: {
1198:                        item = updateItem();
1199:                        if (inputState.guessing == 0) {
1200:
1201:                            s.addItem(item);
1202:
1203:                        }
1204:                        {
1205:                            _loop62: do {
1206:                                if ((LA(1) == COMMA)) {
1207:                                    match(COMMA);
1208:                                    item = updateItem();
1209:                                    if (inputState.guessing == 0) {
1210:
1211:                                        s.addItem(item);
1212:
1213:                                    }
1214:                                } else {
1215:                                    break _loop62;
1216:                                }
1217:
1218:                            } while (true);
1219:                        }
1220:                        break;
1221:                    }
1222:                    case EOF:
1223:                    case LITERAL_where: {
1224:                        break;
1225:                    }
1226:                    default: {
1227:                        throw new NoViableAltException(LT(1), getFilename());
1228:                    }
1229:                    }
1230:                }
1231:                we = whereExpression();
1232:                if (inputState.guessing == 0) {
1233:                    s.addWhere(we);
1234:                }
1235:                return s;
1236:            }
1237:
1238:            public final Stmt commitStmt() throws RecognitionException,
1239:                    TokenStreamException {
1240:                Stmt s;
1241:
1242:                s = null;
1243:
1244:                match(LITERAL_commit);
1245:                {
1246:                    switch (LA(1)) {
1247:                    case LITERAL_work: {
1248:                        match(LITERAL_work);
1249:                        break;
1250:                    }
1251:                    case EOF: {
1252:                        break;
1253:                    }
1254:                    default: {
1255:                        throw new NoViableAltException(LT(1), getFilename());
1256:                    }
1257:                    }
1258:                }
1259:                if (inputState.guessing == 0) {
1260:                    s = new StmtCommit();
1261:                }
1262:                return s;
1263:            }
1264:
1265:            public final Stmt rollbackStmt() throws RecognitionException,
1266:                    TokenStreamException {
1267:                Stmt s;
1268:
1269:                s = null;
1270:
1271:                match(LITERAL_rollback);
1272:                {
1273:                    switch (LA(1)) {
1274:                    case LITERAL_transaction: {
1275:                        match(LITERAL_transaction);
1276:                        break;
1277:                    }
1278:                    case EOF: {
1279:                        break;
1280:                    }
1281:                    default: {
1282:                        throw new NoViableAltException(LT(1), getFilename());
1283:                    }
1284:                    }
1285:                }
1286:                if (inputState.guessing == 0) {
1287:                    s = new StmtRollback();
1288:                }
1289:                return s;
1290:            }
1291:
1292:            public final String sqlId() throws RecognitionException,
1293:                    TokenStreamException {
1294:                String s;
1295:
1296:                Token id = null;
1297:
1298:                s = null;
1299:                StringBuffer sb = new StringBuffer();
1300:
1301:                id = LT(1);
1302:                match(ID);
1303:                if (inputState.guessing == 0) {
1304:
1305:                    String n = id.getText();
1306:                    int idx = TupleImpl.nextUnquotedPeriod(n);
1307:                    if (idx > 0) {
1308:                        sb.append(fixIdTerm(n.substring(0, idx)));
1309:                        sb.append('.');
1310:                        n = n.substring(idx + 1);
1311:                        idx = TupleImpl.nextUnquotedPeriod(n);
1312:                        if (idx > 0) {
1313:                            sb.append(fixIdTerm(n.substring(0, idx)));
1314:                            sb.append('.');
1315:                            n = n.substring(idx + 1);
1316:                        }
1317:                    }
1318:                    sb.append(fixIdTerm(n));
1319:                    s = sb.toString();
1320:
1321:                }
1322:                return s;
1323:            }
1324:
1325:            public final Vector idList() throws RecognitionException,
1326:                    TokenStreamException {
1327:                Vector v;
1328:
1329:                v = new Vector();
1330:                String id = null;
1331:
1332:                id = sqlId();
1333:                if (inputState.guessing == 0) {
1334:                    v.addElement(id);
1335:                }
1336:                {
1337:                    _loop332: do {
1338:                        if ((LA(1) == COMMA) && (LA(2) == ID)) {
1339:                            match(COMMA);
1340:                            id = sqlId();
1341:                            if (inputState.guessing == 0) {
1342:                                v.addElement(id);
1343:                            }
1344:                        } else {
1345:                            break _loop332;
1346:                        }
1347:
1348:                    } while (true);
1349:                }
1350:                return v;
1351:            }
1352:
1353:            public final Stmt addConstraint(String id)
1354:                    throws RecognitionException, TokenStreamException {
1355:                Stmt s;
1356:
1357:                s = null;
1358:                Constraint con = null;
1359:
1360:                match(LITERAL_add);
1361:                con = tableConstraint();
1362:                if (inputState.guessing == 0) {
1363:                    s = new StmtAddConstraint(id, con);
1364:                }
1365:                return s;
1366:            }
1367:
1368:            public final Stmt addColumn(String id) throws RecognitionException,
1369:                    TokenStreamException {
1370:                Stmt s;
1371:
1372:                s = null;
1373:                Column col = null;
1374:                String aname = null;
1375:
1376:                match(LITERAL_add);
1377:                {
1378:                    switch (LA(1)) {
1379:                    case LITERAL_column: {
1380:                        match(LITERAL_column);
1381:                        break;
1382:                    }
1383:                    case ID: {
1384:                        break;
1385:                    }
1386:                    default: {
1387:                        throw new NoViableAltException(LT(1), getFilename());
1388:                    }
1389:                    }
1390:                }
1391:                col = columnDefinition();
1392:                {
1393:                    switch (LA(1)) {
1394:                    case LITERAL_first: {
1395:                        match(LITERAL_first);
1396:                        if (inputState.guessing == 0) {
1397:                            aname = "";
1398:                        }
1399:                        break;
1400:                    }
1401:                    case LITERAL_after: {
1402:                        match(LITERAL_after);
1403:                        aname = sqlId();
1404:                        break;
1405:                    }
1406:                    case EOF: {
1407:                        break;
1408:                    }
1409:                    default: {
1410:                        throw new NoViableAltException(LT(1), getFilename());
1411:                    }
1412:                    }
1413:                }
1414:                if (inputState.guessing == 0) {
1415:                    s = new StmtAddColumn(id, col, aname);
1416:                }
1417:                return s;
1418:            }
1419:
1420:            public final Stmt dropConstraint(String id)
1421:                    throws RecognitionException, TokenStreamException {
1422:                Stmt s;
1423:
1424:                s = null;
1425:                String conName = null;
1426:                boolean restrict = true;
1427:
1428:                match(LITERAL_drop);
1429:                match(LITERAL_constraint);
1430:                conName = sqlId();
1431:                {
1432:                    switch (LA(1)) {
1433:                    case LITERAL_restrict: {
1434:                        match(LITERAL_restrict);
1435:                        break;
1436:                    }
1437:                    case LITERAL_cascade: {
1438:                        match(LITERAL_cascade);
1439:                        if (inputState.guessing == 0) {
1440:                            restrict = false;
1441:                        }
1442:                        break;
1443:                    }
1444:                    case EOF: {
1445:                        break;
1446:                    }
1447:                    default: {
1448:                        throw new NoViableAltException(LT(1), getFilename());
1449:                    }
1450:                    }
1451:                }
1452:                if (inputState.guessing == 0) {
1453:                    s = new StmtDropConstraint(id, conName, restrict);
1454:                }
1455:                return s;
1456:            }
1457:
1458:            public final Stmt dropColumn(String id)
1459:                    throws RecognitionException, TokenStreamException {
1460:                Stmt s;
1461:
1462:                s = null;
1463:                String colName = null;
1464:
1465:                match(LITERAL_drop);
1466:                {
1467:                    switch (LA(1)) {
1468:                    case LITERAL_column: {
1469:                        match(LITERAL_column);
1470:                        break;
1471:                    }
1472:                    case ID: {
1473:                        break;
1474:                    }
1475:                    default: {
1476:                        throw new NoViableAltException(LT(1), getFilename());
1477:                    }
1478:                    }
1479:                }
1480:                colName = sqlId();
1481:                {
1482:                    switch (LA(1)) {
1483:                    case LITERAL_restrict: {
1484:                        match(LITERAL_restrict);
1485:                        break;
1486:                    }
1487:                    case LITERAL_cascade: {
1488:                        match(LITERAL_cascade);
1489:                        break;
1490:                    }
1491:                    case EOF: {
1492:                        break;
1493:                    }
1494:                    default: {
1495:                        throw new NoViableAltException(LT(1), getFilename());
1496:                    }
1497:                    }
1498:                }
1499:                if (inputState.guessing == 0) {
1500:                    s = new StmtDropColumn(id, colName);
1501:                }
1502:                return s;
1503:            }
1504:
1505:            public final Stmt alterColumn(String id)
1506:                    throws RecognitionException, TokenStreamException {
1507:                Stmt s;
1508:
1509:                s = null;
1510:                String colName = null;
1511:                Expression def = null;
1512:
1513:                match(LITERAL_alter);
1514:                {
1515:                    switch (LA(1)) {
1516:                    case LITERAL_column: {
1517:                        match(LITERAL_column);
1518:                        break;
1519:                    }
1520:                    case ID: {
1521:                        break;
1522:                    }
1523:                    default: {
1524:                        throw new NoViableAltException(LT(1), getFilename());
1525:                    }
1526:                    }
1527:                }
1528:                colName = sqlId();
1529:                {
1530:                    switch (LA(1)) {
1531:                    case LITERAL_set: {
1532:                        match(LITERAL_set);
1533:                        match(LITERAL_default);
1534:                        def = expression();
1535:                        break;
1536:                    }
1537:                    case LITERAL_drop: {
1538:                        match(LITERAL_drop);
1539:                        match(LITERAL_default);
1540:                        break;
1541:                    }
1542:                    default: {
1543:                        throw new NoViableAltException(LT(1), getFilename());
1544:                    }
1545:                    }
1546:                }
1547:                if (inputState.guessing == 0) {
1548:                    s = new StmtAlterColumn(id, colName, def);
1549:                }
1550:                return s;
1551:            }
1552:
1553:            public final Stmt renameTable(String id)
1554:                    throws RecognitionException, TokenStreamException {
1555:                Stmt s;
1556:
1557:                s = null;
1558:                Constraint con = null;
1559:                String id2 = null;
1560:
1561:                match(LITERAL_rename);
1562:                match(LITERAL_to);
1563:                id2 = sqlId();
1564:                if (inputState.guessing == 0) {
1565:
1566:                    id2 = qConn.resolveName(id2);
1567:                    s = new StmtRenameTable(id, id2);
1568:
1569:                }
1570:                return s;
1571:            }
1572:
1573:            public final Constraint tableConstraint()
1574:                    throws RecognitionException, TokenStreamException {
1575:                Constraint con;
1576:
1577:                con = null;
1578:                String name = null;
1579:                Vector v = null;
1580:                Vector v2 = null;
1581:                int ref = 0;
1582:                String n = null;
1583:                String id = null;
1584:                Expression predicate = null;
1585:
1586:                {
1587:                    switch (LA(1)) {
1588:                    case LITERAL_constraint: {
1589:                        match(LITERAL_constraint);
1590:                        name = sqlId();
1591:                        break;
1592:                    }
1593:                    case LITERAL_unique:
1594:                    case LITERAL_primary:
1595:                    case LITERAL_foreign:
1596:                    case LITERAL_check: {
1597:                        break;
1598:                    }
1599:                    default: {
1600:                        throw new NoViableAltException(LT(1), getFilename());
1601:                    }
1602:                    }
1603:                }
1604:                {
1605:                    switch (LA(1)) {
1606:                    case LITERAL_primary: {
1607:                        match(LITERAL_primary);
1608:                        match(LITERAL_key);
1609:                        match(LPAREN);
1610:                        v = idList();
1611:                        match(RPAREN);
1612:                        if (inputState.guessing == 0) {
1613:                            con = new PrimaryKeyConstraint(name, v);
1614:                        }
1615:                        break;
1616:                    }
1617:                    case LITERAL_unique: {
1618:                        match(LITERAL_unique);
1619:                        match(LPAREN);
1620:                        v = idList();
1621:                        match(RPAREN);
1622:                        if (inputState.guessing == 0) {
1623:                            con = new UniqueConstraint(name, v);
1624:                        }
1625:                        break;
1626:                    }
1627:                    case LITERAL_foreign: {
1628:                        match(LITERAL_foreign);
1629:                        match(LITERAL_key);
1630:                        match(LPAREN);
1631:                        v = idList();
1632:                        match(RPAREN);
1633:                        match(LITERAL_references);
1634:                        id = sqlId();
1635:                        {
1636:                            switch (LA(1)) {
1637:                            case LPAREN: {
1638:                                match(LPAREN);
1639:                                v2 = idList();
1640:                                match(RPAREN);
1641:                                break;
1642:                            }
1643:                            case EOF:
1644:                            case LITERAL_on:
1645:                            case RPAREN:
1646:                            case COMMA:
1647:                            case LITERAL_match: {
1648:                                break;
1649:                            }
1650:                            default: {
1651:                                throw new NoViableAltException(LT(1),
1652:                                        getFilename());
1653:                            }
1654:                            }
1655:                        }
1656:                        ref = referentialSpec();
1657:                        if (inputState.guessing == 0) {
1658:
1659:                            n = qConn.resolveName(id);
1660:                            con = new ImportedKeyConstraint(name, v, n, v2);
1661:                            con.setRefSpec(ref);
1662:
1663:                        }
1664:                        break;
1665:                    }
1666:                    case LITERAL_check: {
1667:                        match(LITERAL_check);
1668:                        predicate = expression();
1669:                        if (inputState.guessing == 0) {
1670:                            con = new CheckConstraint(name, predicate);
1671:                        }
1672:                        break;
1673:                    }
1674:                    default: {
1675:                        throw new NoViableAltException(LT(1), getFilename());
1676:                    }
1677:                    }
1678:                }
1679:                return con;
1680:            }
1681:
1682:            public final Column columnDefinition() throws RecognitionException,
1683:                    TokenStreamException {
1684:                Column def;
1685:
1686:                def = null;
1687:                Type t = null;
1688:                Constraint constraint = null;
1689:                String id = null;
1690:                Expression p = null;
1691:
1692:                id = sqlId();
1693:                t = type();
1694:                if (inputState.guessing == 0) {
1695:                    def = new Column(id, t);
1696:                }
1697:                {
1698:                    _loop101: do {
1699:                        switch (LA(1)) {
1700:                        case LITERAL_unique:
1701:                        case LITERAL_constraint:
1702:                        case LITERAL_primary:
1703:                        case LITERAL_check:
1704:                        case LITERAL_with:
1705:                        case LITERAL_references:
1706:                        case LITERAL_not: {
1707:                            constraint = columnConstraint();
1708:                            if (inputState.guessing == 0) {
1709:                                def.addConstraint(constraint);
1710:                            }
1711:                            break;
1712:                        }
1713:                        case LITERAL_default: {
1714:                            match(LITERAL_default);
1715:                            p = expression();
1716:                            if (inputState.guessing == 0) {
1717:                                def.setDefault(p);
1718:                            }
1719:                            break;
1720:                        }
1721:                        default: {
1722:                            break _loop101;
1723:                        }
1724:                        }
1725:                    } while (true);
1726:                }
1727:                return def;
1728:            }
1729:
1730:            public final Expression expression() throws RecognitionException,
1731:                    TokenStreamException {
1732:                Expression e;
1733:
1734:                e = null;
1735:
1736:                e = scalarExpression();
1737:                return e;
1738:            }
1739:
1740:            public final TableExpression queryExpression()
1741:                    throws RecognitionException, TokenStreamException {
1742:                TableExpression item;
1743:
1744:                item = null;
1745:                int op = 0;
1746:                boolean all = false;
1747:                boolean corr = false;
1748:                Vector columns = null;
1749:                TableExpression item2 = null;
1750:                String id = null;
1751:
1752:                item = queryExpressionHead();
1753:                {
1754:                    _loop203: do {
1755:                        if ((LA(1) == LITERAL_union
1756:                                || LA(1) == LITERAL_intersect || LA(1) == LITERAL_except)
1757:                                && (LA(2) == LITERAL_table || LA(2) == LPAREN
1758:                                        || LA(2) == LITERAL_all
1759:                                        || LA(2) == LITERAL_select
1760:                                        || LA(2) == LITERAL_corresponding
1761:                                        || LA(2) == LITERAL_values || LA(2) == ID)) {
1762:                            op = combine();
1763:                            if (inputState.guessing == 0) {
1764:
1765:                                all = false;
1766:                                corr = false;
1767:                                columns = null;
1768:                                item2 = null;
1769:
1770:                            }
1771:                            {
1772:                                switch (LA(1)) {
1773:                                case LITERAL_all: {
1774:                                    match(LITERAL_all);
1775:                                    if (inputState.guessing == 0) {
1776:                                        all = true;
1777:                                    }
1778:                                    break;
1779:                                }
1780:                                case LITERAL_table:
1781:                                case LPAREN:
1782:                                case LITERAL_select:
1783:                                case LITERAL_corresponding:
1784:                                case LITERAL_values:
1785:                                case ID: {
1786:                                    break;
1787:                                }
1788:                                default: {
1789:                                    throw new NoViableAltException(LT(1),
1790:                                            getFilename());
1791:                                }
1792:                                }
1793:                            }
1794:                            {
1795:                                switch (LA(1)) {
1796:                                case LITERAL_corresponding: {
1797:                                    match(LITERAL_corresponding);
1798:                                    if (inputState.guessing == 0) {
1799:
1800:                                        corr = true;
1801:
1802:                                    }
1803:                                    {
1804:                                        switch (LA(1)) {
1805:                                        case LITERAL_by: {
1806:                                            match(LITERAL_by);
1807:                                            match(LPAREN);
1808:                                            columns = idList();
1809:                                            match(RPAREN);
1810:                                            break;
1811:                                        }
1812:                                        case LITERAL_table:
1813:                                        case LPAREN:
1814:                                        case LITERAL_select:
1815:                                        case LITERAL_values:
1816:                                        case ID: {
1817:                                            break;
1818:                                        }
1819:                                        default: {
1820:                                            throw new NoViableAltException(
1821:                                                    LT(1), getFilename());
1822:                                        }
1823:                                        }
1824:                                    }
1825:                                    break;
1826:                                }
1827:                                case LITERAL_table:
1828:                                case LPAREN:
1829:                                case LITERAL_select:
1830:                                case LITERAL_values:
1831:                                case ID: {
1832:                                    break;
1833:                                }
1834:                                default: {
1835:                                    throw new NoViableAltException(LT(1),
1836:                                            getFilename());
1837:                                }
1838:                                }
1839:                            }
1840:                            item2 = queryExpressionHead();
1841:                            if (inputState.guessing == 0) {
1842:
1843:                                item = new MergeExpression(op, all, item,
1844:                                        item2, columns, corr);
1845:
1846:                            }
1847:                        } else {
1848:                            break _loop203;
1849:                        }
1850:
1851:                    } while (true);
1852:                }
1853:                return item;
1854:            }
1855:
1856:            public final UpdateItem updateItem() throws RecognitionException,
1857:                    TokenStreamException {
1858:                UpdateItem item;
1859:
1860:                item = null;
1861:                Expression e = null;
1862:                String id = null;
1863:
1864:                id = sqlId();
1865:                match(EQ);
1866:                e = expression();
1867:                if (inputState.guessing == 0) {
1868:
1869:                    item = new UpdateItem(id, e);
1870:
1871:                }
1872:                return item;
1873:            }
1874:
1875:            public final Expression whereExpression()
1876:                    throws RecognitionException, TokenStreamException {
1877:                Expression e;
1878:
1879:                e = null;
1880:
1881:                {
1882:                    if ((LA(1) == LITERAL_where)
1883:                            && (LA(2) == LITERAL_unique || LA(2) == LPAREN
1884:                                    || LA(2) == LITERAL_default
1885:                                    || LA(2) == LITERAL_insert
1886:                                    || LA(2) == LITERAL_not
1887:                                    || LA(2) == LITERAL_null
1888:                                    || LA(2) == LITERAL_char
1889:                                    || LA(2) == LITERAL_date
1890:                                    || LA(2) == LITERAL_time
1891:                                    || LA(2) == LITERAL_timestamp
1892:                                    || LA(2) == LITERAL_interval
1893:                                    || LA(2) == LITERAL_exists || LA(2) == PLUS
1894:                                    || LA(2) == MINUS
1895:                                    || LA(2) == STRING_LITERAL
1896:                                    || LA(2) == QUESTION || LA(2) == INT
1897:                                    || LA(2) == REAL || LA(2) == BINSTR
1898:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
1899:                                    || LA(2) == LITERAL_hour
1900:                                    || LA(2) == LITERAL_left
1901:                                    || LA(2) == LITERAL_minute
1902:                                    || LA(2) == LITERAL_month
1903:                                    || LA(2) == LITERAL_right
1904:                                    || LA(2) == LITERAL_second
1905:                                    || LA(2) == LITERAL_year
1906:                                    || LA(2) == LITERAL_user
1907:                                    || LA(2) == LITERAL_current_user
1908:                                    || LA(2) == LITERAL_session_user
1909:                                    || LA(2) == LITERAL_system_user
1910:                                    || LA(2) == LITERAL_current_date
1911:                                    || LA(2) == LITERAL_current_time
1912:                                    || LA(2) == LITERAL_current_timestamp
1913:                                    || LA(2) == LITERAL_sql_tsi_frac_second
1914:                                    || LA(2) == LITERAL_sql_tsi_second
1915:                                    || LA(2) == LITERAL_sql_tsi_minute
1916:                                    || LA(2) == LITERAL_sql_tsi_hour
1917:                                    || LA(2) == LITERAL_sql_tsi_day
1918:                                    || LA(2) == LITERAL_sql_tsi_week
1919:                                    || LA(2) == LITERAL_sql_tsi_month
1920:                                    || LA(2) == LITERAL_sql_tsi_quarter
1921:                                    || LA(2) == LITERAL_sql_tsi_year
1922:                                    || LA(2) == LITERAL_cast
1923:                                    || LA(2) == LITERAL_true
1924:                                    || LA(2) == LITERAL_false
1925:                                    || LA(2) == LITERAL_avg
1926:                                    || LA(2) == LITERAL_min
1927:                                    || LA(2) == LITERAL_max
1928:                                    || LA(2) == LITERAL_sum
1929:                                    || LA(2) == LITERAL_count || LA(2) == ID)) {
1930:                        match(LITERAL_where);
1931:                        e = expression();
1932:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_create
1933:                            || LA(1) == LITERAL_unique || LA(1) == LITERAL_on
1934:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
1935:                            || LA(1) == LITERAL_primary
1936:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
1937:                            || LA(1) == LITERAL_after
1938:                            || LA(1) == LITERAL_default || LA(1) == LITERAL_as
1939:                            || LA(1) == LITERAL_with || LA(1) == COMMA
1940:                            || LA(1) == LITERAL_where || LA(1) == LITERAL_from
1941:                            || LA(1) == LITERAL_grant
1942:                            || LA(1) == LITERAL_references
1943:                            || LA(1) == LITERAL_not || LA(1) == LITERAL_full
1944:                            || LA(1) == LITERAL_initially
1945:                            || LA(1) == LITERAL_deferrable
1946:                            || LA(1) == LITERAL_for || LA(1) == LITERAL_order
1947:                            || LA(1) == LITERAL_having
1948:                            || LA(1) == LITERAL_using || LA(1) == LITERAL_group
1949:                            || LA(1) == CONCAT || LA(1) == LITERAL_or
1950:                            || LA(1) == LITERAL_and || LA(1) == LITERAL_when
1951:                            || LA(1) == LITERAL_then || LA(1) == LITERAL_else
1952:                            || LA(1) == LITERAL_end || LA(1) == LITERAL_left
1953:                            || LA(1) == LITERAL_right || LA(1) == LITERAL_cross
1954:                            || LA(1) == LITERAL_join
1955:                            || LA(1) == LITERAL_natural
1956:                            || LA(1) == LITERAL_union || LA(1) == LITERAL_inner
1957:                            || LA(1) == LITERAL_intersect
1958:                            || LA(1) == LITERAL_except || LA(1) == ID)
1959:                            && (LA(2) == EOF || LA(2) == LITERAL_create
1960:                                    || LA(2) == LITERAL_unique
1961:                                    || LA(2) == LITERAL_index
1962:                                    || LA(2) == LITERAL_temporary
1963:                                    || LA(2) == LITERAL_table
1964:                                    || LA(2) == LITERAL_view
1965:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
1966:                                    || LA(2) == RPAREN
1967:                                    || LA(2) == LITERAL_constraint
1968:                                    || LA(2) == LITERAL_primary
1969:                                    || LA(2) == LITERAL_foreign
1970:                                    || LA(2) == LITERAL_check
1971:                                    || LA(2) == LITERAL_first
1972:                                    || LA(2) == LITERAL_after
1973:                                    || LA(2) == LITERAL_default
1974:                                    || LA(2) == LITERAL_as
1975:                                    || LA(2) == LITERAL_with
1976:                                    || LA(2) == LITERAL_cascaded
1977:                                    || LA(2) == LITERAL_update
1978:                                    || LA(2) == COMMA || LA(2) == LITERAL_where
1979:                                    || LA(2) == EQ || LA(2) == LITERAL_delete
1980:                                    || LA(2) == LITERAL_from
1981:                                    || LA(2) == LITERAL_global
1982:                                    || LA(2) == LITERAL_local
1983:                                    || LA(2) == LITERAL_grant
1984:                                    || LA(2) == LITERAL_all
1985:                                    || LA(2) == LITERAL_select
1986:                                    || LA(2) == LITERAL_insert
1987:                                    || LA(2) == LITERAL_references
1988:                                    || LA(2) == LITERAL_usage
1989:                                    || LA(2) == LITERAL_not
1990:                                    || LA(2) == LITERAL_null
1991:                                    || LA(2) == LITERAL_key
1992:                                    || LA(2) == LITERAL_identity
1993:                                    || LA(2) == LITERAL_full
1994:                                    || LA(2) == LITERAL_initially
1995:                                    || LA(2) == LITERAL_deferred
1996:                                    || LA(2) == LITERAL_immediate
1997:                                    || LA(2) == LITERAL_deferrable
1998:                                    || LA(2) == LITERAL_bit
1999:                                    || LA(2) == LITERAL_varbinary
2000:                                    || LA(2) == LITERAL_binary
2001:                                    || LA(2) == LITERAL_blob
2002:                                    || LA(2) == LITERAL_clob
2003:                                    || LA(2) == LITERAL_character
2004:                                    || LA(2) == LITERAL_char
2005:                                    || LA(2) == LITERAL_varchar
2006:                                    || LA(2) == LITERAL_int
2007:                                    || LA(2) == LITERAL_integer
2008:                                    || LA(2) == LITERAL_smallint
2009:                                    || LA(2) == LITERAL_tinyint
2010:                                    || LA(2) == LITERAL_bigint
2011:                                    || LA(2) == LITERAL_dec
2012:                                    || LA(2) == LITERAL_decimal
2013:                                    || LA(2) == LITERAL_numeric
2014:                                    || LA(2) == LITERAL_real
2015:                                    || LA(2) == LITERAL_double
2016:                                    || LA(2) == LITERAL_float
2017:                                    || LA(2) == LITERAL_boolean
2018:                                    || LA(2) == LITERAL_date
2019:                                    || LA(2) == LITERAL_time
2020:                                    || LA(2) == LITERAL_timestamp
2021:                                    || LA(2) == LITERAL_interval
2022:                                    || LA(2) == LITERAL_for
2023:                                    || LA(2) == LITERAL_read
2024:                                    || LA(2) == LITERAL_order
2025:                                    || LA(2) == LITERAL_by || LA(2) == STAR
2026:                                    || LA(2) == LITERAL_having
2027:                                    || LA(2) == LITERAL_corresponding
2028:                                    || LA(2) == LITERAL_values
2029:                                    || LA(2) == LITERAL_using
2030:                                    || LA(2) == LITERAL_group
2031:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
2032:                                    || LA(2) == LITERAL_and
2033:                                    || LA(2) == LITERAL_is
2034:                                    || LA(2) == LITERAL_like
2035:                                    || LA(2) == LITERAL_between
2036:                                    || LA(2) == LITERAL_in
2037:                                    || LA(2) == LITERAL_exists
2038:                                    || LA(2) == LITERAL_escape || LA(2) == 120
2039:                                    || LA(2) == PLUS || LA(2) == MINUS
2040:                                    || LA(2) == STRING_LITERAL
2041:                                    || LA(2) == QUESTION || LA(2) == INT
2042:                                    || LA(2) == REAL || LA(2) == BINSTR
2043:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
2044:                                    || LA(2) == LITERAL_when
2045:                                    || LA(2) == LITERAL_then
2046:                                    || LA(2) == LITERAL_else
2047:                                    || LA(2) == LITERAL_end
2048:                                    || LA(2) == LITERAL_hour
2049:                                    || LA(2) == LITERAL_left
2050:                                    || LA(2) == LITERAL_minute
2051:                                    || LA(2) == LITERAL_month
2052:                                    || LA(2) == LITERAL_right
2053:                                    || LA(2) == LITERAL_second
2054:                                    || LA(2) == LITERAL_year
2055:                                    || LA(2) == LITERAL_user
2056:                                    || LA(2) == LITERAL_current_user
2057:                                    || LA(2) == LITERAL_session_user
2058:                                    || LA(2) == LITERAL_system_user
2059:                                    || LA(2) == LITERAL_current_date
2060:                                    || LA(2) == LITERAL_current_time
2061:                                    || LA(2) == LITERAL_current_timestamp
2062:                                    || LA(2) == LITERAL_sql_tsi_frac_second
2063:                                    || LA(2) == LITERAL_sql_tsi_second
2064:                                    || LA(2) == LITERAL_sql_tsi_minute
2065:                                    || LA(2) == LITERAL_sql_tsi_hour
2066:                                    || LA(2) == LITERAL_sql_tsi_day
2067:                                    || LA(2) == LITERAL_sql_tsi_week
2068:                                    || LA(2) == LITERAL_sql_tsi_month
2069:                                    || LA(2) == LITERAL_sql_tsi_quarter
2070:                                    || LA(2) == LITERAL_sql_tsi_year
2071:                                    || LA(2) == LITERAL_cast
2072:                                    || LA(2) == LITERAL_true
2073:                                    || LA(2) == LITERAL_false
2074:                                    || LA(2) == LITERAL_avg
2075:                                    || LA(2) == LITERAL_min
2076:                                    || LA(2) == LITERAL_max
2077:                                    || LA(2) == LITERAL_sum
2078:                                    || LA(2) == LITERAL_count || LA(2) == LT
2079:                                    || LA(2) == LE || LA(2) == GT
2080:                                    || LA(2) == GE || LA(2) == NE
2081:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
2082:                                    || LA(2) == LITERAL_join
2083:                                    || LA(2) == LITERAL_natural
2084:                                    || LA(2) == LITERAL_union
2085:                                    || LA(2) == LITERAL_inner
2086:                                    || LA(2) == LITERAL_outer
2087:                                    || LA(2) == LITERAL_intersect
2088:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
2089:                    } else {
2090:                        throw new NoViableAltException(LT(1), getFilename());
2091:                    }
2092:
2093:                }
2094:                return e;
2095:            }
2096:
2097:            public final Stmt schemaStatement() throws RecognitionException,
2098:                    TokenStreamException {
2099:                Stmt s;
2100:
2101:                s = null;
2102:
2103:                boolean synPredMatched75 = false;
2104:                if (((LA(1) == LITERAL_create) && (LA(2) == LITERAL_unique || LA(2) == LITERAL_index))) {
2105:                    int _m75 = mark();
2106:                    synPredMatched75 = true;
2107:                    inputState.guessing++;
2108:                    try {
2109:                        {
2110:                            match(LITERAL_create);
2111:                            {
2112:                                switch (LA(1)) {
2113:                                case LITERAL_unique: {
2114:                                    match(LITERAL_unique);
2115:                                    break;
2116:                                }
2117:                                case LITERAL_index: {
2118:                                    break;
2119:                                }
2120:                                default: {
2121:                                    throw new NoViableAltException(LT(1),
2122:                                            getFilename());
2123:                                }
2124:                                }
2125:                            }
2126:                            match(LITERAL_index);
2127:                        }
2128:                    } catch (RecognitionException pe) {
2129:                        synPredMatched75 = false;
2130:                    }
2131:                    rewind(_m75);
2132:                    inputState.guessing--;
2133:                }
2134:                if (synPredMatched75) {
2135:                    s = createIndexStmt();
2136:                } else {
2137:                    boolean synPredMatched78 = false;
2138:                    if (((LA(1) == LITERAL_create) && (LA(2) == LITERAL_temporary
2139:                            || LA(2) == LITERAL_table
2140:                            || LA(2) == LITERAL_global || LA(2) == LITERAL_local))) {
2141:                        int _m78 = mark();
2142:                        synPredMatched78 = true;
2143:                        inputState.guessing++;
2144:                        try {
2145:                            {
2146:                                match(LITERAL_create);
2147:                                {
2148:                                    switch (LA(1)) {
2149:                                    case LITERAL_temporary: {
2150:                                        match(LITERAL_temporary);
2151:                                        break;
2152:                                    }
2153:                                    case LITERAL_table: {
2154:                                        break;
2155:                                    }
2156:                                    default: {
2157:                                        throw new NoViableAltException(LT(1),
2158:                                                getFilename());
2159:                                    }
2160:                                    }
2161:                                }
2162:                                match(LITERAL_table);
2163:                            }
2164:                        } catch (RecognitionException pe) {
2165:                            synPredMatched78 = false;
2166:                        }
2167:                        rewind(_m78);
2168:                        inputState.guessing--;
2169:                    }
2170:                    if (synPredMatched78) {
2171:                        s = createTableStmt();
2172:                    } else {
2173:                        boolean synPredMatched80 = false;
2174:                        if (((LA(1) == LITERAL_create) && (LA(2) == LITERAL_view))) {
2175:                            int _m80 = mark();
2176:                            synPredMatched80 = true;
2177:                            inputState.guessing++;
2178:                            try {
2179:                                {
2180:                                    match(LITERAL_create);
2181:                                    match(LITERAL_view);
2182:                                }
2183:                            } catch (RecognitionException pe) {
2184:                                synPredMatched80 = false;
2185:                            }
2186:                            rewind(_m80);
2187:                            inputState.guessing--;
2188:                        }
2189:                        if (synPredMatched80) {
2190:                            s = createViewStmt();
2191:                        } else if ((LA(1) == LITERAL_grant)) {
2192:                            s = grantStmt();
2193:                        } else {
2194:                            throw new NoViableAltException(LT(1), getFilename());
2195:                        }
2196:                    }
2197:                }
2198:                return s;
2199:            }
2200:
2201:            public final void privilege() throws RecognitionException,
2202:                    TokenStreamException {
2203:
2204:                Vector v = null;
2205:
2206:                switch (LA(1)) {
2207:                case LITERAL_all: {
2208:                    match(LITERAL_all);
2209:                    match(LITERAL_privileges);
2210:                    break;
2211:                }
2212:                case LITERAL_select: {
2213:                    match(LITERAL_select);
2214:                    break;
2215:                }
2216:                case LITERAL_delete: {
2217:                    match(LITERAL_delete);
2218:                    break;
2219:                }
2220:                case LITERAL_update:
2221:                case LITERAL_insert:
2222:                case LITERAL_references: {
2223:                    {
2224:                        switch (LA(1)) {
2225:                        case LITERAL_insert: {
2226:                            match(LITERAL_insert);
2227:                            break;
2228:                        }
2229:                        case LITERAL_update: {
2230:                            match(LITERAL_update);
2231:                            break;
2232:                        }
2233:                        case LITERAL_references: {
2234:                            match(LITERAL_references);
2235:                            break;
2236:                        }
2237:                        default: {
2238:                            throw new NoViableAltException(LT(1), getFilename());
2239:                        }
2240:                        }
2241:                    }
2242:                    {
2243:                        switch (LA(1)) {
2244:                        case LPAREN: {
2245:                            match(LPAREN);
2246:                            v = idList();
2247:                            match(RPAREN);
2248:                            break;
2249:                        }
2250:                        case LITERAL_on:
2251:                        case COMMA: {
2252:                            break;
2253:                        }
2254:                        default: {
2255:                            throw new NoViableAltException(LT(1), getFilename());
2256:                        }
2257:                        }
2258:                    }
2259:                    break;
2260:                }
2261:                case LITERAL_usage: {
2262:                    match(LITERAL_usage);
2263:                    break;
2264:                }
2265:                default: {
2266:                    throw new NoViableAltException(LT(1), getFilename());
2267:                }
2268:                }
2269:            }
2270:
2271:            public final Type type() throws RecognitionException,
2272:                    TokenStreamException {
2273:                Type t;
2274:
2275:                t = null;
2276:                int max = -1;
2277:                int scale = 0;
2278:                int precision = 0;
2279:                boolean tz = false;
2280:
2281:                switch (LA(1)) {
2282:                case LITERAL_int:
2283:                case LITERAL_integer: {
2284:                    t = typeInt();
2285:                    break;
2286:                }
2287:                case LITERAL_tinyint: {
2288:                    t = typeTinyInt();
2289:                    break;
2290:                }
2291:                case LITERAL_smallint: {
2292:                    t = typeSmallInt();
2293:                    break;
2294:                }
2295:                case LITERAL_bigint: {
2296:                    t = typeBigInt();
2297:                    break;
2298:                }
2299:                case LITERAL_dec:
2300:                case LITERAL_decimal:
2301:                case LITERAL_numeric: {
2302:                    t = typeDecimal();
2303:                    break;
2304:                }
2305:                case LITERAL_real: {
2306:                    t = typeReal();
2307:                    break;
2308:                }
2309:                case LITERAL_double: {
2310:                    t = typeDouble();
2311:                    break;
2312:                }
2313:                case LITERAL_float: {
2314:                    t = typeFloat();
2315:                    break;
2316:                }
2317:                case LITERAL_boolean: {
2318:                    t = typeBoolean();
2319:                    break;
2320:                }
2321:                case LITERAL_date: {
2322:                    t = typeDate();
2323:                    break;
2324:                }
2325:                case LITERAL_time: {
2326:                    t = typeTime();
2327:                    break;
2328:                }
2329:                case LITERAL_timestamp: {
2330:                    t = typeTimestamp();
2331:                    break;
2332:                }
2333:                case LITERAL_interval: {
2334:                    t = typeInterval();
2335:                    break;
2336:                }
2337:                default:
2338:                    boolean synPredMatched127 = false;
2339:                    if (((LA(1) == LITERAL_bit || LA(1) == LITERAL_varbinary) && (LA(2) == EOF
2340:                            || LA(2) == LITERAL_unique
2341:                            || LA(2) == LPAREN
2342:                            || LA(2) == RPAREN
2343:                            || LA(2) == LITERAL_constraint
2344:                            || LA(2) == LITERAL_primary
2345:                            || LA(2) == LITERAL_check
2346:                            || LA(2) == LITERAL_first
2347:                            || LA(2) == LITERAL_after
2348:                            || LA(2) == LITERAL_default
2349:                            || LA(2) == LITERAL_with
2350:                            || LA(2) == COMMA
2351:                            || LA(2) == LITERAL_references
2352:                            || LA(2) == LITERAL_not || LA(2) == LITERAL_varying))) {
2353:                        int _m127 = mark();
2354:                        synPredMatched127 = true;
2355:                        inputState.guessing++;
2356:                        try {
2357:                            {
2358:                                switch (LA(1)) {
2359:                                case LITERAL_bit: {
2360:                                    match(LITERAL_bit);
2361:                                    match(LITERAL_varying);
2362:                                    break;
2363:                                }
2364:                                case LITERAL_varbinary: {
2365:                                    match(LITERAL_varbinary);
2366:                                    break;
2367:                                }
2368:                                default: {
2369:                                    throw new NoViableAltException(LT(1),
2370:                                            getFilename());
2371:                                }
2372:                                }
2373:                            }
2374:                        } catch (RecognitionException pe) {
2375:                            synPredMatched127 = false;
2376:                        }
2377:                        rewind(_m127);
2378:                        inputState.guessing--;
2379:                    }
2380:                    if (synPredMatched127) {
2381:                        t = typeVarBinary();
2382:                    } else {
2383:                        boolean synPredMatched129 = false;
2384:                        if (((LA(1) == LITERAL_bit || LA(1) == LITERAL_binary) && (LA(2) == EOF
2385:                                || LA(2) == LITERAL_unique
2386:                                || LA(2) == LPAREN
2387:                                || LA(2) == RPAREN
2388:                                || LA(2) == LITERAL_constraint
2389:                                || LA(2) == LITERAL_primary
2390:                                || LA(2) == LITERAL_check
2391:                                || LA(2) == LITERAL_first
2392:                                || LA(2) == LITERAL_after
2393:                                || LA(2) == LITERAL_default
2394:                                || LA(2) == LITERAL_with
2395:                                || LA(2) == COMMA
2396:                                || LA(2) == LITERAL_references || LA(2) == LITERAL_not))) {
2397:                            int _m129 = mark();
2398:                            synPredMatched129 = true;
2399:                            inputState.guessing++;
2400:                            try {
2401:                                {
2402:                                    switch (LA(1)) {
2403:                                    case LITERAL_bit: {
2404:                                        match(LITERAL_bit);
2405:                                        break;
2406:                                    }
2407:                                    case LITERAL_binary: {
2408:                                        match(LITERAL_binary);
2409:                                        break;
2410:                                    }
2411:                                    default: {
2412:                                        throw new NoViableAltException(LT(1),
2413:                                                getFilename());
2414:                                    }
2415:                                    }
2416:                                }
2417:                            } catch (RecognitionException pe) {
2418:                                synPredMatched129 = false;
2419:                            }
2420:                            rewind(_m129);
2421:                            inputState.guessing--;
2422:                        }
2423:                        if (synPredMatched129) {
2424:                            t = typeBit();
2425:                        } else {
2426:                            boolean synPredMatched131 = false;
2427:                            if (((LA(1) == LITERAL_binary || LA(1) == LITERAL_blob) && (LA(2) == EOF
2428:                                    || LA(2) == LITERAL_unique
2429:                                    || LA(2) == LPAREN
2430:                                    || LA(2) == RPAREN
2431:                                    || LA(2) == LITERAL_constraint
2432:                                    || LA(2) == LITERAL_primary
2433:                                    || LA(2) == LITERAL_check
2434:                                    || LA(2) == LITERAL_first
2435:                                    || LA(2) == LITERAL_after
2436:                                    || LA(2) == LITERAL_default
2437:                                    || LA(2) == LITERAL_with
2438:                                    || LA(2) == COMMA
2439:                                    || LA(2) == LITERAL_references
2440:                                    || LA(2) == LITERAL_not || LA(2) == LITERAL_large))) {
2441:                                int _m131 = mark();
2442:                                synPredMatched131 = true;
2443:                                inputState.guessing++;
2444:                                try {
2445:                                    {
2446:                                        switch (LA(1)) {
2447:                                        case LITERAL_blob: {
2448:                                            match(LITERAL_blob);
2449:                                            break;
2450:                                        }
2451:                                        case LITERAL_binary: {
2452:                                            match(LITERAL_binary);
2453:                                            match(LITERAL_large);
2454:                                            match(LITERAL_object);
2455:                                            break;
2456:                                        }
2457:                                        default: {
2458:                                            throw new NoViableAltException(
2459:                                                    LT(1), getFilename());
2460:                                        }
2461:                                        }
2462:                                    }
2463:                                } catch (RecognitionException pe) {
2464:                                    synPredMatched131 = false;
2465:                                }
2466:                                rewind(_m131);
2467:                                inputState.guessing--;
2468:                            }
2469:                            if (synPredMatched131) {
2470:                                t = typeBlob();
2471:                            } else {
2472:                                boolean synPredMatched133 = false;
2473:                                if (((LA(1) == LITERAL_clob || LA(1) == LITERAL_character) && (LA(2) == EOF
2474:                                        || LA(2) == LITERAL_unique
2475:                                        || LA(2) == LPAREN
2476:                                        || LA(2) == RPAREN
2477:                                        || LA(2) == LITERAL_constraint
2478:                                        || LA(2) == LITERAL_primary
2479:                                        || LA(2) == LITERAL_check
2480:                                        || LA(2) == LITERAL_first
2481:                                        || LA(2) == LITERAL_after
2482:                                        || LA(2) == LITERAL_default
2483:                                        || LA(2) == LITERAL_with
2484:                                        || LA(2) == COMMA
2485:                                        || LA(2) == LITERAL_references
2486:                                        || LA(2) == LITERAL_not || LA(2) == LITERAL_large))) {
2487:                                    int _m133 = mark();
2488:                                    synPredMatched133 = true;
2489:                                    inputState.guessing++;
2490:                                    try {
2491:                                        {
2492:                                            switch (LA(1)) {
2493:                                            case LITERAL_clob: {
2494:                                                match(LITERAL_clob);
2495:                                                break;
2496:                                            }
2497:                                            case LITERAL_character: {
2498:                                                match(LITERAL_character);
2499:                                                match(LITERAL_large);
2500:                                                match(LITERAL_object);
2501:                                                break;
2502:                                            }
2503:                                            default: {
2504:                                                throw new NoViableAltException(
2505:                                                        LT(1), getFilename());
2506:                                            }
2507:                                            }
2508:                                        }
2509:                                    } catch (RecognitionException pe) {
2510:                                        synPredMatched133 = false;
2511:                                    }
2512:                                    rewind(_m133);
2513:                                    inputState.guessing--;
2514:                                }
2515:                                if (synPredMatched133) {
2516:                                    t = typeClob();
2517:                                } else {
2518:                                    boolean synPredMatched135 = false;
2519:                                    if ((((LA(1) >= LITERAL_character && LA(1) <= LITERAL_varchar)) && (LA(2) == EOF
2520:                                            || LA(2) == LITERAL_unique
2521:                                            || LA(2) == LPAREN
2522:                                            || LA(2) == RPAREN
2523:                                            || LA(2) == LITERAL_constraint
2524:                                            || LA(2) == LITERAL_primary
2525:                                            || LA(2) == LITERAL_check
2526:                                            || LA(2) == LITERAL_first
2527:                                            || LA(2) == LITERAL_after
2528:                                            || LA(2) == LITERAL_default
2529:                                            || LA(2) == LITERAL_with
2530:                                            || LA(2) == COMMA
2531:                                            || LA(2) == LITERAL_references
2532:                                            || LA(2) == LITERAL_not || LA(2) == LITERAL_varying))) {
2533:                                        int _m135 = mark();
2534:                                        synPredMatched135 = true;
2535:                                        inputState.guessing++;
2536:                                        try {
2537:                                            {
2538:                                                switch (LA(1)) {
2539:                                                case LITERAL_char: {
2540:                                                    match(LITERAL_char);
2541:                                                    match(LITERAL_varying);
2542:                                                    break;
2543:                                                }
2544:                                                case LITERAL_character: {
2545:                                                    match(LITERAL_character);
2546:                                                    match(LITERAL_varying);
2547:                                                    break;
2548:                                                }
2549:                                                case LITERAL_varchar: {
2550:                                                    match(LITERAL_varchar);
2551:                                                    break;
2552:                                                }
2553:                                                default: {
2554:                                                    throw new NoViableAltException(
2555:                                                            LT(1),
2556:                                                            getFilename());
2557:                                                }
2558:                                                }
2559:                                            }
2560:                                        } catch (RecognitionException pe) {
2561:                                            synPredMatched135 = false;
2562:                                        }
2563:                                        rewind(_m135);
2564:                                        inputState.guessing--;
2565:                                    }
2566:                                    if (synPredMatched135) {
2567:                                        t = typeVarChar();
2568:                                    } else {
2569:                                        boolean synPredMatched137 = false;
2570:                                        if (((LA(1) == LITERAL_character || LA(1) == LITERAL_char) && (LA(2) == EOF
2571:                                                || LA(2) == LITERAL_unique
2572:                                                || LA(2) == LPAREN
2573:                                                || LA(2) == RPAREN
2574:                                                || LA(2) == LITERAL_constraint
2575:                                                || LA(2) == LITERAL_primary
2576:                                                || LA(2) == LITERAL_check
2577:                                                || LA(2) == LITERAL_first
2578:                                                || LA(2) == LITERAL_after
2579:                                                || LA(2) == LITERAL_default
2580:                                                || LA(2) == LITERAL_with
2581:                                                || LA(2) == COMMA
2582:                                                || LA(2) == LITERAL_references || LA(2) == LITERAL_not))) {
2583:                                            int _m137 = mark();
2584:                                            synPredMatched137 = true;
2585:                                            inputState.guessing++;
2586:                                            try {
2587:                                                {
2588:                                                    switch (LA(1)) {
2589:                                                    case LITERAL_char: {
2590:                                                        match(LITERAL_char);
2591:                                                        break;
2592:                                                    }
2593:                                                    case LITERAL_character: {
2594:                                                        match(LITERAL_character);
2595:                                                        break;
2596:                                                    }
2597:                                                    default: {
2598:                                                        throw new NoViableAltException(
2599:                                                                LT(1),
2600:                                                                getFilename());
2601:                                                    }
2602:                                                    }
2603:                                                }
2604:                                            } catch (RecognitionException pe) {
2605:                                                synPredMatched137 = false;
2606:                                            }
2607:                                            rewind(_m137);
2608:                                            inputState.guessing--;
2609:                                        }
2610:                                        if (synPredMatched137) {
2611:                                            t = typeChar();
2612:                                        } else {
2613:                                            throw new NoViableAltException(
2614:                                                    LT(1), getFilename());
2615:                                        }
2616:                                    }
2617:                                }
2618:                            }
2619:                        }
2620:                    }
2621:                }
2622:                return t;
2623:            }
2624:
2625:            public final Constraint columnConstraint()
2626:                    throws RecognitionException, TokenStreamException {
2627:                Constraint con;
2628:
2629:                con = null;
2630:                String name = null;
2631:                int ref = 0;
2632:                int def = 0;
2633:                ImportedKeyConstraint fk = null;
2634:                Expression predicate = null;
2635:                String n;
2636:                String id = null;
2637:
2638:                {
2639:                    switch (LA(1)) {
2640:                    case LITERAL_constraint: {
2641:                        match(LITERAL_constraint);
2642:                        name = sqlId();
2643:                        break;
2644:                    }
2645:                    case LITERAL_unique:
2646:                    case LITERAL_primary:
2647:                    case LITERAL_check:
2648:                    case LITERAL_with:
2649:                    case LITERAL_references:
2650:                    case LITERAL_not: {
2651:                        break;
2652:                    }
2653:                    default: {
2654:                        throw new NoViableAltException(LT(1), getFilename());
2655:                    }
2656:                    }
2657:                }
2658:                {
2659:                    switch (LA(1)) {
2660:                    case LITERAL_not: {
2661:                        match(LITERAL_not);
2662:                        match(LITERAL_null);
2663:                        if (inputState.guessing == 0) {
2664:                            con = new NotNullConstraint(name);
2665:                        }
2666:                        break;
2667:                    }
2668:                    case LITERAL_unique: {
2669:                        match(LITERAL_unique);
2670:                        if (inputState.guessing == 0) {
2671:                            con = new UniqueConstraint(name);
2672:                        }
2673:                        break;
2674:                    }
2675:                    case LITERAL_primary: {
2676:                        match(LITERAL_primary);
2677:                        match(LITERAL_key);
2678:                        if (inputState.guessing == 0) {
2679:                            con = new PrimaryKeyConstraint(name);
2680:                        }
2681:                        break;
2682:                    }
2683:                    case LITERAL_references: {
2684:                        match(LITERAL_references);
2685:                        id = sqlId();
2686:                        if (inputState.guessing == 0) {
2687:
2688:                            n = qConn.resolveName(id);
2689:                            con = fk = new ImportedKeyConstraint(name, n);
2690:
2691:                        }
2692:                        {
2693:                            switch (LA(1)) {
2694:                            case LPAREN: {
2695:                                match(LPAREN);
2696:                                id = sqlId();
2697:                                if (inputState.guessing == 0) {
2698:                                    fk.setForeignColumn(id);
2699:                                }
2700:                                match(RPAREN);
2701:                                break;
2702:                            }
2703:                            case EOF:
2704:                            case LITERAL_unique:
2705:                            case LITERAL_on:
2706:                            case RPAREN:
2707:                            case LITERAL_constraint:
2708:                            case LITERAL_primary:
2709:                            case LITERAL_check:
2710:                            case LITERAL_first:
2711:                            case LITERAL_after:
2712:                            case LITERAL_default:
2713:                            case LITERAL_with:
2714:                            case COMMA:
2715:                            case LITERAL_references:
2716:                            case LITERAL_not:
2717:                            case LITERAL_match:
2718:                            case LITERAL_initially:
2719:                            case LITERAL_deferrable: {
2720:                                break;
2721:                            }
2722:                            default: {
2723:                                throw new NoViableAltException(LT(1),
2724:                                        getFilename());
2725:                            }
2726:                            }
2727:                        }
2728:                        ref = referentialSpec();
2729:                        if (inputState.guessing == 0) {
2730:                            con.setRefSpec(ref);
2731:                        }
2732:                        break;
2733:                    }
2734:                    case LITERAL_check: {
2735:                        match(LITERAL_check);
2736:                        predicate = expression();
2737:                        if (inputState.guessing == 0) {
2738:                            con = new CheckConstraint(name, predicate);
2739:                        }
2740:                        break;
2741:                    }
2742:                    case LITERAL_with: {
2743:                        match(LITERAL_with);
2744:                        match(LITERAL_identity);
2745:                        if (inputState.guessing == 0) {
2746:                            con = new AutoNumberConstraint(name);
2747:                        }
2748:                        break;
2749:                    }
2750:                    default: {
2751:                        throw new NoViableAltException(LT(1), getFilename());
2752:                    }
2753:                    }
2754:                }
2755:                {
2756:                    boolean synPredMatched108 = false;
2757:                    if (((LA(1) == EOF || LA(1) == LITERAL_unique
2758:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
2759:                            || LA(1) == LITERAL_primary
2760:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
2761:                            || LA(1) == LITERAL_after
2762:                            || LA(1) == LITERAL_default
2763:                            || LA(1) == LITERAL_with || LA(1) == COMMA
2764:                            || LA(1) == LITERAL_references || LA(1) == LITERAL_not) && (LA(2) == EOF
2765:                            || LA(2) == LITERAL_create
2766:                            || LA(2) == LITERAL_unique
2767:                            || LA(2) == LPAREN
2768:                            || LA(2) == RPAREN
2769:                            || LA(2) == LITERAL_constraint
2770:                            || LA(2) == LITERAL_primary
2771:                            || LA(2) == LITERAL_foreign
2772:                            || LA(2) == LITERAL_check
2773:                            || LA(2) == LITERAL_first
2774:                            || LA(2) == LITERAL_after
2775:                            || LA(2) == LITERAL_default
2776:                            || LA(2) == LITERAL_with
2777:                            || LA(2) == COMMA
2778:                            || LA(2) == LITERAL_grant
2779:                            || LA(2) == LITERAL_insert
2780:                            || LA(2) == LITERAL_references
2781:                            || LA(2) == LITERAL_not
2782:                            || LA(2) == LITERAL_null
2783:                            || LA(2) == LITERAL_key
2784:                            || LA(2) == LITERAL_identity
2785:                            || LA(2) == LITERAL_initially
2786:                            || LA(2) == LITERAL_deferrable
2787:                            || LA(2) == LITERAL_char
2788:                            || LA(2) == LITERAL_date
2789:                            || LA(2) == LITERAL_time
2790:                            || LA(2) == LITERAL_timestamp
2791:                            || LA(2) == LITERAL_interval
2792:                            || LA(2) == LITERAL_exists
2793:                            || LA(2) == PLUS
2794:                            || LA(2) == MINUS
2795:                            || LA(2) == STRING_LITERAL
2796:                            || LA(2) == QUESTION
2797:                            || LA(2) == INT
2798:                            || LA(2) == REAL
2799:                            || LA(2) == BINSTR
2800:                            || LA(2) == HEXSTR
2801:                            || LA(2) == LITERAL_case
2802:                            || LA(2) == LITERAL_hour
2803:                            || LA(2) == LITERAL_left
2804:                            || LA(2) == LITERAL_minute
2805:                            || LA(2) == LITERAL_month
2806:                            || LA(2) == LITERAL_right
2807:                            || LA(2) == LITERAL_second
2808:                            || LA(2) == LITERAL_year
2809:                            || LA(2) == LITERAL_user
2810:                            || LA(2) == LITERAL_current_user
2811:                            || LA(2) == LITERAL_session_user
2812:                            || LA(2) == LITERAL_system_user
2813:                            || LA(2) == LITERAL_current_date
2814:                            || LA(2) == LITERAL_current_time
2815:                            || LA(2) == LITERAL_current_timestamp
2816:                            || LA(2) == LITERAL_sql_tsi_frac_second
2817:                            || LA(2) == LITERAL_sql_tsi_second
2818:                            || LA(2) == LITERAL_sql_tsi_minute
2819:                            || LA(2) == LITERAL_sql_tsi_hour
2820:                            || LA(2) == LITERAL_sql_tsi_day
2821:                            || LA(2) == LITERAL_sql_tsi_week
2822:                            || LA(2) == LITERAL_sql_tsi_month
2823:                            || LA(2) == LITERAL_sql_tsi_quarter
2824:                            || LA(2) == LITERAL_sql_tsi_year
2825:                            || LA(2) == LITERAL_cast
2826:                            || LA(2) == LITERAL_true
2827:                            || LA(2) == LITERAL_false
2828:                            || LA(2) == LITERAL_avg
2829:                            || LA(2) == LITERAL_min
2830:                            || LA(2) == LITERAL_max
2831:                            || LA(2) == LITERAL_sum || LA(2) == LITERAL_count || LA(2) == ID))) {
2832:                        int _m108 = mark();
2833:                        synPredMatched108 = true;
2834:                        inputState.guessing++;
2835:                        try {
2836:                            {
2837:                                match(LITERAL_not);
2838:                                match(LITERAL_null);
2839:                            }
2840:                        } catch (RecognitionException pe) {
2841:                            synPredMatched108 = false;
2842:                        }
2843:                        rewind(_m108);
2844:                        inputState.guessing--;
2845:                    }
2846:                    if (synPredMatched108) {
2847:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_unique
2848:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
2849:                            || LA(1) == LITERAL_primary
2850:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
2851:                            || LA(1) == LITERAL_after
2852:                            || LA(1) == LITERAL_default
2853:                            || LA(1) == LITERAL_with || LA(1) == COMMA
2854:                            || LA(1) == LITERAL_references
2855:                            || LA(1) == LITERAL_not
2856:                            || LA(1) == LITERAL_initially || LA(1) == LITERAL_deferrable)
2857:                            && (LA(2) == EOF || LA(2) == LITERAL_create
2858:                                    || LA(2) == LITERAL_unique
2859:                                    || LA(2) == LPAREN || LA(2) == RPAREN
2860:                                    || LA(2) == LITERAL_constraint
2861:                                    || LA(2) == LITERAL_primary
2862:                                    || LA(2) == LITERAL_foreign
2863:                                    || LA(2) == LITERAL_check
2864:                                    || LA(2) == LITERAL_first
2865:                                    || LA(2) == LITERAL_after
2866:                                    || LA(2) == LITERAL_default
2867:                                    || LA(2) == LITERAL_with || LA(2) == COMMA
2868:                                    || LA(2) == LITERAL_grant
2869:                                    || LA(2) == LITERAL_insert
2870:                                    || LA(2) == LITERAL_references
2871:                                    || LA(2) == LITERAL_not
2872:                                    || LA(2) == LITERAL_null
2873:                                    || LA(2) == LITERAL_key
2874:                                    || LA(2) == LITERAL_identity
2875:                                    || LA(2) == LITERAL_initially
2876:                                    || LA(2) == LITERAL_deferred
2877:                                    || LA(2) == LITERAL_immediate
2878:                                    || LA(2) == LITERAL_deferrable
2879:                                    || LA(2) == LITERAL_char
2880:                                    || LA(2) == LITERAL_date
2881:                                    || LA(2) == LITERAL_time
2882:                                    || LA(2) == LITERAL_timestamp
2883:                                    || LA(2) == LITERAL_interval
2884:                                    || LA(2) == LITERAL_exists || LA(2) == PLUS
2885:                                    || LA(2) == MINUS
2886:                                    || LA(2) == STRING_LITERAL
2887:                                    || LA(2) == QUESTION || LA(2) == INT
2888:                                    || LA(2) == REAL || LA(2) == BINSTR
2889:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
2890:                                    || LA(2) == LITERAL_hour
2891:                                    || LA(2) == LITERAL_left
2892:                                    || LA(2) == LITERAL_minute
2893:                                    || LA(2) == LITERAL_month
2894:                                    || LA(2) == LITERAL_right
2895:                                    || LA(2) == LITERAL_second
2896:                                    || LA(2) == LITERAL_year
2897:                                    || LA(2) == LITERAL_user
2898:                                    || LA(2) == LITERAL_current_user
2899:                                    || LA(2) == LITERAL_session_user
2900:                                    || LA(2) == LITERAL_system_user
2901:                                    || LA(2) == LITERAL_current_date
2902:                                    || LA(2) == LITERAL_current_time
2903:                                    || LA(2) == LITERAL_current_timestamp
2904:                                    || LA(2) == LITERAL_sql_tsi_frac_second
2905:                                    || LA(2) == LITERAL_sql_tsi_second
2906:                                    || LA(2) == LITERAL_sql_tsi_minute
2907:                                    || LA(2) == LITERAL_sql_tsi_hour
2908:                                    || LA(2) == LITERAL_sql_tsi_day
2909:                                    || LA(2) == LITERAL_sql_tsi_week
2910:                                    || LA(2) == LITERAL_sql_tsi_month
2911:                                    || LA(2) == LITERAL_sql_tsi_quarter
2912:                                    || LA(2) == LITERAL_sql_tsi_year
2913:                                    || LA(2) == LITERAL_cast
2914:                                    || LA(2) == LITERAL_true
2915:                                    || LA(2) == LITERAL_false
2916:                                    || LA(2) == LITERAL_avg
2917:                                    || LA(2) == LITERAL_min
2918:                                    || LA(2) == LITERAL_max
2919:                                    || LA(2) == LITERAL_sum
2920:                                    || LA(2) == LITERAL_count || LA(2) == ID)) {
2921:                        def = deferrableSpec();
2922:                        if (inputState.guessing == 0) {
2923:                            con.setDeferrable(def);
2924:                        }
2925:                    } else {
2926:                        throw new NoViableAltException(LT(1), getFilename());
2927:                    }
2928:
2929:                }
2930:                return con;
2931:            }
2932:
2933:            public final int referentialSpec() throws RecognitionException,
2934:                    TokenStreamException {
2935:                int ref;
2936:
2937:                ref = 0;
2938:                int type = 0;
2939:
2940:                {
2941:                    _loop119: do {
2942:                        switch (LA(1)) {
2943:                        case LITERAL_match: {
2944:                            match(LITERAL_match);
2945:                            {
2946:                                switch (LA(1)) {
2947:                                case LITERAL_full: {
2948:                                    match(LITERAL_full);
2949:                                    if (inputState.guessing == 0) {
2950:                                        ref |= Constraint.FULL;
2951:                                    }
2952:                                    break;
2953:                                }
2954:                                case LITERAL_partial: {
2955:                                    match(LITERAL_partial);
2956:                                    if (inputState.guessing == 0) {
2957:                                        ref |= Constraint.PARTIAL;
2958:                                    }
2959:                                    break;
2960:                                }
2961:                                default: {
2962:                                    throw new NoViableAltException(LT(1),
2963:                                            getFilename());
2964:                                }
2965:                                }
2966:                            }
2967:                            break;
2968:                        }
2969:                        case LITERAL_on: {
2970:                            match(LITERAL_on);
2971:                            {
2972:                                switch (LA(1)) {
2973:                                case LITERAL_update: {
2974:                                    match(LITERAL_update);
2975:                                    if (inputState.guessing == 0) {
2976:                                        type = Constraint.UPDATE;
2977:                                    }
2978:                                    break;
2979:                                }
2980:                                case LITERAL_delete: {
2981:                                    match(LITERAL_delete);
2982:                                    if (inputState.guessing == 0) {
2983:                                        type = Constraint.DELETE;
2984:                                    }
2985:                                    break;
2986:                                }
2987:                                default: {
2988:                                    throw new NoViableAltException(LT(1),
2989:                                            getFilename());
2990:                                }
2991:                                }
2992:                            }
2993:                            {
2994:                                switch (LA(1)) {
2995:                                case LITERAL_cascade: {
2996:                                    match(LITERAL_cascade);
2997:                                    if (inputState.guessing == 0) {
2998:                                        ref |= (Constraint.CASCADE << type);
2999:                                    }
3000:                                    break;
3001:                                }
3002:                                case LITERAL_set: {
3003:                                    match(LITERAL_set);
3004:                                    {
3005:                                        switch (LA(1)) {
3006:                                        case LITERAL_null: {
3007:                                            match(LITERAL_null);
3008:                                            if (inputState.guessing == 0) {
3009:                                                ref |= (Constraint.SETNULL << type);
3010:                                            }
3011:                                            break;
3012:                                        }
3013:                                        case LITERAL_default: {
3014:                                            match(LITERAL_default);
3015:                                            if (inputState.guessing == 0) {
3016:                                                ref |= (Constraint.SETDEFAULT << type);
3017:                                            }
3018:                                            break;
3019:                                        }
3020:                                        default: {
3021:                                            throw new NoViableAltException(
3022:                                                    LT(1), getFilename());
3023:                                        }
3024:                                        }
3025:                                    }
3026:                                    break;
3027:                                }
3028:                                case LITERAL_no: {
3029:                                    match(LITERAL_no);
3030:                                    match(LITERAL_action);
3031:                                    if (inputState.guessing == 0) {
3032:                                        ref |= (Constraint.NOACTION << type);
3033:                                    }
3034:                                    break;
3035:                                }
3036:                                default: {
3037:                                    throw new NoViableAltException(LT(1),
3038:                                            getFilename());
3039:                                }
3040:                                }
3041:                            }
3042:                            break;
3043:                        }
3044:                        default: {
3045:                            break _loop119;
3046:                        }
3047:                        }
3048:                    } while (true);
3049:                }
3050:                return ref;
3051:            }
3052:
3053:            public final int deferrableSpec() throws RecognitionException,
3054:                    TokenStreamException {
3055:                int def;
3056:
3057:                def = 0;
3058:
3059:                {
3060:                    switch (LA(1)) {
3061:                    case LITERAL_initially: {
3062:                        match(LITERAL_initially);
3063:                        {
3064:                            switch (LA(1)) {
3065:                            case LITERAL_deferred: {
3066:                                match(LITERAL_deferred);
3067:                                if (inputState.guessing == 0) {
3068:                                    def |= Constraint.INIT_DEFERRED;
3069:                                }
3070:                                break;
3071:                            }
3072:                            case LITERAL_immediate: {
3073:                                match(LITERAL_immediate);
3074:                                break;
3075:                            }
3076:                            default: {
3077:                                throw new NoViableAltException(LT(1),
3078:                                        getFilename());
3079:                            }
3080:                            }
3081:                        }
3082:                        break;
3083:                    }
3084:                    case LITERAL_deferrable: {
3085:                        match(LITERAL_deferrable);
3086:                        if (inputState.guessing == 0) {
3087:                            def |= Constraint.DEFERRABLE;
3088:                        }
3089:                        break;
3090:                    }
3091:                    default:
3092:                        boolean synPredMatched124 = false;
3093:                        if (((LA(1) == LITERAL_not) && (LA(2) == LITERAL_deferrable))) {
3094:                            int _m124 = mark();
3095:                            synPredMatched124 = true;
3096:                            inputState.guessing++;
3097:                            try {
3098:                                {
3099:                                    match(LITERAL_not);
3100:                                    match(LITERAL_deferrable);
3101:                                }
3102:                            } catch (RecognitionException pe) {
3103:                                synPredMatched124 = false;
3104:                            }
3105:                            rewind(_m124);
3106:                            inputState.guessing--;
3107:                        }
3108:                        if (synPredMatched124) {
3109:                            match(LITERAL_not);
3110:                            match(LITERAL_deferrable);
3111:                        } else if ((LA(1) == EOF || LA(1) == LITERAL_unique
3112:                                || LA(1) == RPAREN
3113:                                || LA(1) == LITERAL_constraint
3114:                                || LA(1) == LITERAL_primary
3115:                                || LA(1) == LITERAL_check
3116:                                || LA(1) == LITERAL_first
3117:                                || LA(1) == LITERAL_after
3118:                                || LA(1) == LITERAL_default
3119:                                || LA(1) == LITERAL_with || LA(1) == COMMA
3120:                                || LA(1) == LITERAL_references || LA(1) == LITERAL_not)
3121:                                && (LA(2) == EOF || LA(2) == LITERAL_create
3122:                                        || LA(2) == LITERAL_unique
3123:                                        || LA(2) == LPAREN || LA(2) == RPAREN
3124:                                        || LA(2) == LITERAL_constraint
3125:                                        || LA(2) == LITERAL_primary
3126:                                        || LA(2) == LITERAL_foreign
3127:                                        || LA(2) == LITERAL_check
3128:                                        || LA(2) == LITERAL_first
3129:                                        || LA(2) == LITERAL_after
3130:                                        || LA(2) == LITERAL_default
3131:                                        || LA(2) == LITERAL_with
3132:                                        || LA(2) == COMMA
3133:                                        || LA(2) == LITERAL_grant
3134:                                        || LA(2) == LITERAL_insert
3135:                                        || LA(2) == LITERAL_references
3136:                                        || LA(2) == LITERAL_not
3137:                                        || LA(2) == LITERAL_null
3138:                                        || LA(2) == LITERAL_key
3139:                                        || LA(2) == LITERAL_identity
3140:                                        || LA(2) == LITERAL_initially
3141:                                        || LA(2) == LITERAL_deferrable
3142:                                        || LA(2) == LITERAL_char
3143:                                        || LA(2) == LITERAL_date
3144:                                        || LA(2) == LITERAL_time
3145:                                        || LA(2) == LITERAL_timestamp
3146:                                        || LA(2) == LITERAL_interval
3147:                                        || LA(2) == LITERAL_exists
3148:                                        || LA(2) == PLUS || LA(2) == MINUS
3149:                                        || LA(2) == STRING_LITERAL
3150:                                        || LA(2) == QUESTION || LA(2) == INT
3151:                                        || LA(2) == REAL || LA(2) == BINSTR
3152:                                        || LA(2) == HEXSTR
3153:                                        || LA(2) == LITERAL_case
3154:                                        || LA(2) == LITERAL_hour
3155:                                        || LA(2) == LITERAL_left
3156:                                        || LA(2) == LITERAL_minute
3157:                                        || LA(2) == LITERAL_month
3158:                                        || LA(2) == LITERAL_right
3159:                                        || LA(2) == LITERAL_second
3160:                                        || LA(2) == LITERAL_year
3161:                                        || LA(2) == LITERAL_user
3162:                                        || LA(2) == LITERAL_current_user
3163:                                        || LA(2) == LITERAL_session_user
3164:                                        || LA(2) == LITERAL_system_user
3165:                                        || LA(2) == LITERAL_current_date
3166:                                        || LA(2) == LITERAL_current_time
3167:                                        || LA(2) == LITERAL_current_timestamp
3168:                                        || LA(2) == LITERAL_sql_tsi_frac_second
3169:                                        || LA(2) == LITERAL_sql_tsi_second
3170:                                        || LA(2) == LITERAL_sql_tsi_minute
3171:                                        || LA(2) == LITERAL_sql_tsi_hour
3172:                                        || LA(2) == LITERAL_sql_tsi_day
3173:                                        || LA(2) == LITERAL_sql_tsi_week
3174:                                        || LA(2) == LITERAL_sql_tsi_month
3175:                                        || LA(2) == LITERAL_sql_tsi_quarter
3176:                                        || LA(2) == LITERAL_sql_tsi_year
3177:                                        || LA(2) == LITERAL_cast
3178:                                        || LA(2) == LITERAL_true
3179:                                        || LA(2) == LITERAL_false
3180:                                        || LA(2) == LITERAL_avg
3181:                                        || LA(2) == LITERAL_min
3182:                                        || LA(2) == LITERAL_max
3183:                                        || LA(2) == LITERAL_sum
3184:                                        || LA(2) == LITERAL_count || LA(2) == ID)) {
3185:                        } else {
3186:                            throw new NoViableAltException(LT(1), getFilename());
3187:                        }
3188:                    }
3189:                }
3190:                return def;
3191:            }
3192:
3193:            public final Type typeInt() throws RecognitionException,
3194:                    TokenStreamException {
3195:                Type t;
3196:
3197:                t = null;
3198:
3199:                {
3200:                    switch (LA(1)) {
3201:                    case LITERAL_int: {
3202:                        match(LITERAL_int);
3203:                        break;
3204:                    }
3205:                    case LITERAL_integer: {
3206:                        match(LITERAL_integer);
3207:                        break;
3208:                    }
3209:                    default: {
3210:                        throw new NoViableAltException(LT(1), getFilename());
3211:                    }
3212:                    }
3213:                }
3214:                if (inputState.guessing == 0) {
3215:                    t = TypeInt.typeInt;
3216:                }
3217:                return t;
3218:            }
3219:
3220:            public final Type typeTinyInt() throws RecognitionException,
3221:                    TokenStreamException {
3222:                Type t;
3223:
3224:                t = null;
3225:
3226:                match(LITERAL_tinyint);
3227:                if (inputState.guessing == 0) {
3228:                    t = TypeTinyInt.typeTinyInt;
3229:                }
3230:                return t;
3231:            }
3232:
3233:            public final Type typeSmallInt() throws RecognitionException,
3234:                    TokenStreamException {
3235:                Type t;
3236:
3237:                t = null;
3238:
3239:                match(LITERAL_smallint);
3240:                if (inputState.guessing == 0) {
3241:                    t = TypeSmallInt.typeSmallInt;
3242:                }
3243:                return t;
3244:            }
3245:
3246:            public final Type typeBigInt() throws RecognitionException,
3247:                    TokenStreamException {
3248:                Type t;
3249:
3250:                t = null;
3251:
3252:                match(LITERAL_bigint);
3253:                if (inputState.guessing == 0) {
3254:                    t = TypeBigInt.typeBigInt;
3255:                }
3256:                return t;
3257:            }
3258:
3259:            public final Type typeDecimal() throws RecognitionException,
3260:                    TokenStreamException {
3261:                Type t;
3262:
3263:                t = null;
3264:                int max = 18;
3265:                int scale = 0;
3266:
3267:                {
3268:                    switch (LA(1)) {
3269:                    case LITERAL_dec: {
3270:                        match(LITERAL_dec);
3271:                        break;
3272:                    }
3273:                    case LITERAL_decimal: {
3274:                        match(LITERAL_decimal);
3275:                        break;
3276:                    }
3277:                    case LITERAL_numeric: {
3278:                        match(LITERAL_numeric);
3279:                        break;
3280:                    }
3281:                    default: {
3282:                        throw new NoViableAltException(LT(1), getFilename());
3283:                    }
3284:                    }
3285:                }
3286:                {
3287:                    switch (LA(1)) {
3288:                    case LPAREN: {
3289:                        match(LPAREN);
3290:                        max = integer();
3291:                        {
3292:                            switch (LA(1)) {
3293:                            case COMMA: {
3294:                                match(COMMA);
3295:                                scale = integer();
3296:                                break;
3297:                            }
3298:                            case RPAREN: {
3299:                                break;
3300:                            }
3301:                            default: {
3302:                                throw new NoViableAltException(LT(1),
3303:                                        getFilename());
3304:                            }
3305:                            }
3306:                        }
3307:                        match(RPAREN);
3308:                        break;
3309:                    }
3310:                    case EOF:
3311:                    case LITERAL_unique:
3312:                    case RPAREN:
3313:                    case LITERAL_constraint:
3314:                    case LITERAL_primary:
3315:                    case LITERAL_check:
3316:                    case LITERAL_first:
3317:                    case LITERAL_after:
3318:                    case LITERAL_default:
3319:                    case LITERAL_with:
3320:                    case COMMA:
3321:                    case LITERAL_references:
3322:                    case LITERAL_not: {
3323:                        break;
3324:                    }
3325:                    default: {
3326:                        throw new NoViableAltException(LT(1), getFilename());
3327:                    }
3328:                    }
3329:                }
3330:                if (inputState.guessing == 0) {
3331:                    t = new TypeDecimal(max, scale);
3332:                }
3333:                return t;
3334:            }
3335:
3336:            public final Type typeReal() throws RecognitionException,
3337:                    TokenStreamException {
3338:                Type t;
3339:
3340:                t = null;
3341:
3342:                match(LITERAL_real);
3343:                if (inputState.guessing == 0) {
3344:                    t = TypeReal.typeReal;
3345:                }
3346:                return t;
3347:            }
3348:
3349:            public final Type typeDouble() throws RecognitionException,
3350:                    TokenStreamException {
3351:                Type t;
3352:
3353:                t = null;
3354:
3355:                match(LITERAL_double);
3356:                match(LITERAL_precision);
3357:                if (inputState.guessing == 0) {
3358:                    t = TypeReal.typeDouble;
3359:                }
3360:                return t;
3361:            }
3362:
3363:            public final Type typeFloat() throws RecognitionException,
3364:                    TokenStreamException {
3365:                Type t;
3366:
3367:                t = null;
3368:                int precision = 23;
3369:
3370:                match(LITERAL_float);
3371:                {
3372:                    switch (LA(1)) {
3373:                    case LPAREN: {
3374:                        match(LPAREN);
3375:                        precision = integer();
3376:                        match(RPAREN);
3377:                        break;
3378:                    }
3379:                    case EOF:
3380:                    case LITERAL_unique:
3381:                    case RPAREN:
3382:                    case LITERAL_constraint:
3383:                    case LITERAL_primary:
3384:                    case LITERAL_check:
3385:                    case LITERAL_first:
3386:                    case LITERAL_after:
3387:                    case LITERAL_default:
3388:                    case LITERAL_with:
3389:                    case COMMA:
3390:                    case LITERAL_references:
3391:                    case LITERAL_not: {
3392:                        break;
3393:                    }
3394:                    default: {
3395:                        throw new NoViableAltException(LT(1), getFilename());
3396:                    }
3397:                    }
3398:                }
3399:                if (inputState.guessing == 0) {
3400:                    t = new TypeReal(Types.FLOAT, precision);
3401:                }
3402:                return t;
3403:            }
3404:
3405:            public final Type typeBoolean() throws RecognitionException,
3406:                    TokenStreamException {
3407:                Type t;
3408:
3409:                t = null;
3410:                int max = 1;
3411:
3412:                match(LITERAL_boolean);
3413:                if (inputState.guessing == 0) {
3414:                    t = TypeBoolean.typeBoolean;
3415:                }
3416:                return t;
3417:            }
3418:
3419:            public final Type typeVarBinary() throws RecognitionException,
3420:                    TokenStreamException {
3421:                Type t;
3422:
3423:                t = null;
3424:                int max = -1;
3425:
3426:                {
3427:                    switch (LA(1)) {
3428:                    case LITERAL_bit: {
3429:                        match(LITERAL_bit);
3430:                        match(LITERAL_varying);
3431:                        break;
3432:                    }
3433:                    case LITERAL_varbinary: {
3434:                        match(LITERAL_varbinary);
3435:                        break;
3436:                    }
3437:                    default: {
3438:                        throw new NoViableAltException(LT(1), getFilename());
3439:                    }
3440:                    }
3441:                }
3442:                {
3443:                    switch (LA(1)) {
3444:                    case LPAREN: {
3445:                        match(LPAREN);
3446:                        max = integer();
3447:                        match(RPAREN);
3448:                        break;
3449:                    }
3450:                    case EOF:
3451:                    case LITERAL_unique:
3452:                    case RPAREN:
3453:                    case LITERAL_constraint:
3454:                    case LITERAL_primary:
3455:                    case LITERAL_check:
3456:                    case LITERAL_first:
3457:                    case LITERAL_after:
3458:                    case LITERAL_default:
3459:                    case LITERAL_with:
3460:                    case COMMA:
3461:                    case LITERAL_references:
3462:                    case LITERAL_not: {
3463:                        break;
3464:                    }
3465:                    default: {
3466:                        throw new NoViableAltException(LT(1), getFilename());
3467:                    }
3468:                    }
3469:                }
3470:                if (inputState.guessing == 0) {
3471:                    t = new TypeVarBinary(max);
3472:                }
3473:                return t;
3474:            }
3475:
3476:            public final Type typeBit() throws RecognitionException,
3477:                    TokenStreamException {
3478:                Type t;
3479:
3480:                t = null;
3481:                int max = 1;
3482:
3483:                {
3484:                    switch (LA(1)) {
3485:                    case LITERAL_bit: {
3486:                        match(LITERAL_bit);
3487:                        break;
3488:                    }
3489:                    case LITERAL_binary: {
3490:                        match(LITERAL_binary);
3491:                        break;
3492:                    }
3493:                    default: {
3494:                        throw new NoViableAltException(LT(1), getFilename());
3495:                    }
3496:                    }
3497:                }
3498:                {
3499:                    switch (LA(1)) {
3500:                    case LPAREN: {
3501:                        match(LPAREN);
3502:                        max = integer();
3503:                        match(RPAREN);
3504:                        break;
3505:                    }
3506:                    case EOF:
3507:                    case LITERAL_unique:
3508:                    case RPAREN:
3509:                    case LITERAL_constraint:
3510:                    case LITERAL_primary:
3511:                    case LITERAL_check:
3512:                    case LITERAL_first:
3513:                    case LITERAL_after:
3514:                    case LITERAL_default:
3515:                    case LITERAL_with:
3516:                    case COMMA:
3517:                    case LITERAL_references:
3518:                    case LITERAL_not: {
3519:                        break;
3520:                    }
3521:                    default: {
3522:                        throw new NoViableAltException(LT(1), getFilename());
3523:                    }
3524:                    }
3525:                }
3526:                if (inputState.guessing == 0) {
3527:                    t = new TypeBinary(max);
3528:                }
3529:                return t;
3530:            }
3531:
3532:            public final Type typeBlob() throws RecognitionException,
3533:                    TokenStreamException {
3534:                Type t;
3535:
3536:                t = null;
3537:                int max = 1;
3538:
3539:                {
3540:                    switch (LA(1)) {
3541:                    case LITERAL_blob: {
3542:                        match(LITERAL_blob);
3543:                        break;
3544:                    }
3545:                    case LITERAL_binary: {
3546:                        match(LITERAL_binary);
3547:                        match(LITERAL_large);
3548:                        match(LITERAL_object);
3549:                        break;
3550:                    }
3551:                    default: {
3552:                        throw new NoViableAltException(LT(1), getFilename());
3553:                    }
3554:                    }
3555:                }
3556:                {
3557:                    switch (LA(1)) {
3558:                    case LPAREN: {
3559:                        match(LPAREN);
3560:                        max = integer();
3561:                        match(RPAREN);
3562:                        break;
3563:                    }
3564:                    case EOF:
3565:                    case LITERAL_unique:
3566:                    case RPAREN:
3567:                    case LITERAL_constraint:
3568:                    case LITERAL_primary:
3569:                    case LITERAL_check:
3570:                    case LITERAL_first:
3571:                    case LITERAL_after:
3572:                    case LITERAL_default:
3573:                    case LITERAL_with:
3574:                    case COMMA:
3575:                    case LITERAL_references:
3576:                    case LITERAL_not: {
3577:                        break;
3578:                    }
3579:                    default: {
3580:                        throw new NoViableAltException(LT(1), getFilename());
3581:                    }
3582:                    }
3583:                }
3584:                if (inputState.guessing == 0) {
3585:                    t = new TypeBlob(max);
3586:                }
3587:                return t;
3588:            }
3589:
3590:            public final Type typeClob() throws RecognitionException,
3591:                    TokenStreamException {
3592:                Type t;
3593:
3594:                t = null;
3595:                int max = 1;
3596:
3597:                {
3598:                    switch (LA(1)) {
3599:                    case LITERAL_clob: {
3600:                        match(LITERAL_clob);
3601:                        break;
3602:                    }
3603:                    case LITERAL_character: {
3604:                        match(LITERAL_character);
3605:                        match(LITERAL_large);
3606:                        match(LITERAL_object);
3607:                        break;
3608:                    }
3609:                    default: {
3610:                        throw new NoViableAltException(LT(1), getFilename());
3611:                    }
3612:                    }
3613:                }
3614:                {
3615:                    switch (LA(1)) {
3616:                    case LPAREN: {
3617:                        match(LPAREN);
3618:                        max = integer();
3619:                        match(RPAREN);
3620:                        break;
3621:                    }
3622:                    case EOF:
3623:                    case LITERAL_unique:
3624:                    case RPAREN:
3625:                    case LITERAL_constraint:
3626:                    case LITERAL_primary:
3627:                    case LITERAL_check:
3628:                    case LITERAL_first:
3629:                    case LITERAL_after:
3630:                    case LITERAL_default:
3631:                    case LITERAL_with:
3632:                    case COMMA:
3633:                    case LITERAL_references:
3634:                    case LITERAL_not: {
3635:                        break;
3636:                    }
3637:                    default: {
3638:                        throw new NoViableAltException(LT(1), getFilename());
3639:                    }
3640:                    }
3641:                }
3642:                if (inputState.guessing == 0) {
3643:                    t = new TypeClob(max);
3644:                }
3645:                return t;
3646:            }
3647:
3648:            public final Type typeVarChar() throws RecognitionException,
3649:                    TokenStreamException {
3650:                Type t;
3651:
3652:                t = null;
3653:                int max = 1;
3654:
3655:                {
3656:                    switch (LA(1)) {
3657:                    case LITERAL_char: {
3658:                        match(LITERAL_char);
3659:                        match(LITERAL_varying);
3660:                        break;
3661:                    }
3662:                    case LITERAL_character: {
3663:                        match(LITERAL_character);
3664:                        match(LITERAL_varying);
3665:                        break;
3666:                    }
3667:                    case LITERAL_varchar: {
3668:                        match(LITERAL_varchar);
3669:                        break;
3670:                    }
3671:                    default: {
3672:                        throw new NoViableAltException(LT(1), getFilename());
3673:                    }
3674:                    }
3675:                }
3676:                {
3677:                    switch (LA(1)) {
3678:                    case LPAREN: {
3679:                        match(LPAREN);
3680:                        max = integer();
3681:                        match(RPAREN);
3682:                        break;
3683:                    }
3684:                    case EOF:
3685:                    case LITERAL_unique:
3686:                    case RPAREN:
3687:                    case LITERAL_constraint:
3688:                    case LITERAL_primary:
3689:                    case LITERAL_check:
3690:                    case LITERAL_first:
3691:                    case LITERAL_after:
3692:                    case LITERAL_default:
3693:                    case LITERAL_with:
3694:                    case COMMA:
3695:                    case LITERAL_references:
3696:                    case LITERAL_not: {
3697:                        break;
3698:                    }
3699:                    default: {
3700:                        throw new NoViableAltException(LT(1), getFilename());
3701:                    }
3702:                    }
3703:                }
3704:                if (inputState.guessing == 0) {
3705:                    t = new TypeVarChar(max);
3706:                }
3707:                return t;
3708:            }
3709:
3710:            public final Type typeChar() throws RecognitionException,
3711:                    TokenStreamException {
3712:                Type t;
3713:
3714:                t = null;
3715:                int max = 1;
3716:
3717:                {
3718:                    switch (LA(1)) {
3719:                    case LITERAL_char: {
3720:                        match(LITERAL_char);
3721:                        break;
3722:                    }
3723:                    case LITERAL_character: {
3724:                        match(LITERAL_character);
3725:                        break;
3726:                    }
3727:                    default: {
3728:                        throw new NoViableAltException(LT(1), getFilename());
3729:                    }
3730:                    }
3731:                }
3732:                {
3733:                    switch (LA(1)) {
3734:                    case LPAREN: {
3735:                        match(LPAREN);
3736:                        max = integer();
3737:                        match(RPAREN);
3738:                        break;
3739:                    }
3740:                    case EOF:
3741:                    case LITERAL_unique:
3742:                    case RPAREN:
3743:                    case LITERAL_constraint:
3744:                    case LITERAL_primary:
3745:                    case LITERAL_check:
3746:                    case LITERAL_first:
3747:                    case LITERAL_after:
3748:                    case LITERAL_default:
3749:                    case LITERAL_with:
3750:                    case COMMA:
3751:                    case LITERAL_references:
3752:                    case LITERAL_not: {
3753:                        break;
3754:                    }
3755:                    default: {
3756:                        throw new NoViableAltException(LT(1), getFilename());
3757:                    }
3758:                    }
3759:                }
3760:                if (inputState.guessing == 0) {
3761:                    t = new TypeChar(max);
3762:                }
3763:                return t;
3764:            }
3765:
3766:            public final Type typeDate() throws RecognitionException,
3767:                    TokenStreamException {
3768:                Type t;
3769:
3770:                t = null;
3771:
3772:                match(LITERAL_date);
3773:                if (inputState.guessing == 0) {
3774:                    t = TypeDate.typeDate;
3775:                }
3776:                return t;
3777:            }
3778:
3779:            public final Type typeTime() throws RecognitionException,
3780:                    TokenStreamException {
3781:                Type t;
3782:
3783:                t = null;
3784:                int precision = 0;
3785:                boolean tz = false;
3786:
3787:                match(LITERAL_time);
3788:                {
3789:                    switch (LA(1)) {
3790:                    case LPAREN: {
3791:                        match(LPAREN);
3792:                        precision = integer();
3793:                        match(RPAREN);
3794:                        break;
3795:                    }
3796:                    case EOF:
3797:                    case LITERAL_unique:
3798:                    case RPAREN:
3799:                    case LITERAL_constraint:
3800:                    case LITERAL_primary:
3801:                    case LITERAL_check:
3802:                    case LITERAL_first:
3803:                    case LITERAL_after:
3804:                    case LITERAL_default:
3805:                    case LITERAL_with:
3806:                    case COMMA:
3807:                    case LITERAL_references:
3808:                    case LITERAL_not: {
3809:                        break;
3810:                    }
3811:                    default: {
3812:                        throw new NoViableAltException(LT(1), getFilename());
3813:                    }
3814:                    }
3815:                }
3816:                {
3817:                    if ((LA(1) == LITERAL_with) && (LA(2) == LITERAL_time)) {
3818:                        match(LITERAL_with);
3819:                        match(LITERAL_time);
3820:                        match(LITERAL_zone);
3821:                        if (inputState.guessing == 0) {
3822:                            tz = true;
3823:                        }
3824:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_unique
3825:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
3826:                            || LA(1) == LITERAL_primary
3827:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
3828:                            || LA(1) == LITERAL_after
3829:                            || LA(1) == LITERAL_default
3830:                            || LA(1) == LITERAL_with || LA(1) == COMMA
3831:                            || LA(1) == LITERAL_references || LA(1) == LITERAL_not)
3832:                            && (LA(2) == EOF || LA(2) == LITERAL_create
3833:                                    || LA(2) == LITERAL_unique
3834:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
3835:                                    || LA(2) == RPAREN
3836:                                    || LA(2) == LITERAL_constraint
3837:                                    || LA(2) == LITERAL_primary
3838:                                    || LA(2) == LITERAL_foreign
3839:                                    || LA(2) == LITERAL_check
3840:                                    || LA(2) == LITERAL_first
3841:                                    || LA(2) == LITERAL_after
3842:                                    || LA(2) == LITERAL_default
3843:                                    || LA(2) == LITERAL_as
3844:                                    || LA(2) == LITERAL_with || LA(2) == COMMA
3845:                                    || LA(2) == LITERAL_where || LA(2) == EQ
3846:                                    || LA(2) == LITERAL_from
3847:                                    || LA(2) == LITERAL_grant
3848:                                    || LA(2) == LITERAL_insert
3849:                                    || LA(2) == LITERAL_references
3850:                                    || LA(2) == LITERAL_not
3851:                                    || LA(2) == LITERAL_null
3852:                                    || LA(2) == LITERAL_key
3853:                                    || LA(2) == LITERAL_identity
3854:                                    || LA(2) == LITERAL_full
3855:                                    || LA(2) == LITERAL_initially
3856:                                    || LA(2) == LITERAL_deferrable
3857:                                    || LA(2) == LITERAL_char
3858:                                    || LA(2) == LITERAL_date
3859:                                    || LA(2) == LITERAL_time
3860:                                    || LA(2) == LITERAL_timestamp
3861:                                    || LA(2) == LITERAL_interval
3862:                                    || LA(2) == LITERAL_for
3863:                                    || LA(2) == LITERAL_order || LA(2) == STAR
3864:                                    || LA(2) == LITERAL_having
3865:                                    || LA(2) == LITERAL_using
3866:                                    || LA(2) == LITERAL_group
3867:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
3868:                                    || LA(2) == LITERAL_and
3869:                                    || LA(2) == LITERAL_is
3870:                                    || LA(2) == LITERAL_like
3871:                                    || LA(2) == LITERAL_between
3872:                                    || LA(2) == LITERAL_in
3873:                                    || LA(2) == LITERAL_exists
3874:                                    || LA(2) == LITERAL_escape || LA(2) == 120
3875:                                    || LA(2) == PLUS || LA(2) == MINUS
3876:                                    || LA(2) == STRING_LITERAL
3877:                                    || LA(2) == QUESTION || LA(2) == INT
3878:                                    || LA(2) == REAL || LA(2) == BINSTR
3879:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
3880:                                    || LA(2) == LITERAL_when
3881:                                    || LA(2) == LITERAL_then
3882:                                    || LA(2) == LITERAL_else
3883:                                    || LA(2) == LITERAL_end
3884:                                    || LA(2) == LITERAL_hour
3885:                                    || LA(2) == LITERAL_left
3886:                                    || LA(2) == LITERAL_minute
3887:                                    || LA(2) == LITERAL_month
3888:                                    || LA(2) == LITERAL_right
3889:                                    || LA(2) == LITERAL_second
3890:                                    || LA(2) == LITERAL_year
3891:                                    || LA(2) == LITERAL_user
3892:                                    || LA(2) == LITERAL_current_user
3893:                                    || LA(2) == LITERAL_session_user
3894:                                    || LA(2) == LITERAL_system_user
3895:                                    || LA(2) == LITERAL_current_date
3896:                                    || LA(2) == LITERAL_current_time
3897:                                    || LA(2) == LITERAL_current_timestamp
3898:                                    || LA(2) == LITERAL_sql_tsi_frac_second
3899:                                    || LA(2) == LITERAL_sql_tsi_second
3900:                                    || LA(2) == LITERAL_sql_tsi_minute
3901:                                    || LA(2) == LITERAL_sql_tsi_hour
3902:                                    || LA(2) == LITERAL_sql_tsi_day
3903:                                    || LA(2) == LITERAL_sql_tsi_week
3904:                                    || LA(2) == LITERAL_sql_tsi_month
3905:                                    || LA(2) == LITERAL_sql_tsi_quarter
3906:                                    || LA(2) == LITERAL_sql_tsi_year
3907:                                    || LA(2) == LITERAL_cast
3908:                                    || LA(2) == LITERAL_true
3909:                                    || LA(2) == LITERAL_false
3910:                                    || LA(2) == LITERAL_avg
3911:                                    || LA(2) == LITERAL_min
3912:                                    || LA(2) == LITERAL_max
3913:                                    || LA(2) == LITERAL_sum
3914:                                    || LA(2) == LITERAL_count || LA(2) == LT
3915:                                    || LA(2) == LE || LA(2) == GT
3916:                                    || LA(2) == GE || LA(2) == NE
3917:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
3918:                                    || LA(2) == LITERAL_join
3919:                                    || LA(2) == LITERAL_natural
3920:                                    || LA(2) == LITERAL_union
3921:                                    || LA(2) == LITERAL_inner
3922:                                    || LA(2) == LITERAL_intersect
3923:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
3924:                    } else {
3925:                        throw new NoViableAltException(LT(1), getFilename());
3926:                    }
3927:
3928:                }
3929:                if (inputState.guessing == 0) {
3930:                    t = new TypeTime(precision, tz);
3931:                }
3932:                return t;
3933:            }
3934:
3935:            public final Type typeTimestamp() throws RecognitionException,
3936:                    TokenStreamException {
3937:                Type t;
3938:
3939:                t = null;
3940:                int precision = 0;
3941:                boolean tz = false;
3942:
3943:                match(LITERAL_timestamp);
3944:                {
3945:                    switch (LA(1)) {
3946:                    case LPAREN: {
3947:                        match(LPAREN);
3948:                        precision = integer();
3949:                        match(RPAREN);
3950:                        break;
3951:                    }
3952:                    case EOF:
3953:                    case LITERAL_unique:
3954:                    case RPAREN:
3955:                    case LITERAL_constraint:
3956:                    case LITERAL_primary:
3957:                    case LITERAL_check:
3958:                    case LITERAL_first:
3959:                    case LITERAL_after:
3960:                    case LITERAL_default:
3961:                    case LITERAL_with:
3962:                    case COMMA:
3963:                    case LITERAL_references:
3964:                    case LITERAL_not: {
3965:                        break;
3966:                    }
3967:                    default: {
3968:                        throw new NoViableAltException(LT(1), getFilename());
3969:                    }
3970:                    }
3971:                }
3972:                {
3973:                    if ((LA(1) == LITERAL_with) && (LA(2) == LITERAL_time)) {
3974:                        match(LITERAL_with);
3975:                        match(LITERAL_time);
3976:                        match(LITERAL_zone);
3977:                        if (inputState.guessing == 0) {
3978:                            tz = true;
3979:                        }
3980:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_unique
3981:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
3982:                            || LA(1) == LITERAL_primary
3983:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
3984:                            || LA(1) == LITERAL_after
3985:                            || LA(1) == LITERAL_default
3986:                            || LA(1) == LITERAL_with || LA(1) == COMMA
3987:                            || LA(1) == LITERAL_references || LA(1) == LITERAL_not)
3988:                            && (LA(2) == EOF || LA(2) == LITERAL_create
3989:                                    || LA(2) == LITERAL_unique
3990:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
3991:                                    || LA(2) == RPAREN
3992:                                    || LA(2) == LITERAL_constraint
3993:                                    || LA(2) == LITERAL_primary
3994:                                    || LA(2) == LITERAL_foreign
3995:                                    || LA(2) == LITERAL_check
3996:                                    || LA(2) == LITERAL_first
3997:                                    || LA(2) == LITERAL_after
3998:                                    || LA(2) == LITERAL_default
3999:                                    || LA(2) == LITERAL_as
4000:                                    || LA(2) == LITERAL_with || LA(2) == COMMA
4001:                                    || LA(2) == LITERAL_where || LA(2) == EQ
4002:                                    || LA(2) == LITERAL_from
4003:                                    || LA(2) == LITERAL_grant
4004:                                    || LA(2) == LITERAL_insert
4005:                                    || LA(2) == LITERAL_references
4006:                                    || LA(2) == LITERAL_not
4007:                                    || LA(2) == LITERAL_null
4008:                                    || LA(2) == LITERAL_key
4009:                                    || LA(2) == LITERAL_identity
4010:                                    || LA(2) == LITERAL_full
4011:                                    || LA(2) == LITERAL_initially
4012:                                    || LA(2) == LITERAL_deferrable
4013:                                    || LA(2) == LITERAL_char
4014:                                    || LA(2) == LITERAL_date
4015:                                    || LA(2) == LITERAL_time
4016:                                    || LA(2) == LITERAL_timestamp
4017:                                    || LA(2) == LITERAL_interval
4018:                                    || LA(2) == LITERAL_for
4019:                                    || LA(2) == LITERAL_order || LA(2) == STAR
4020:                                    || LA(2) == LITERAL_having
4021:                                    || LA(2) == LITERAL_using
4022:                                    || LA(2) == LITERAL_group
4023:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
4024:                                    || LA(2) == LITERAL_and
4025:                                    || LA(2) == LITERAL_is
4026:                                    || LA(2) == LITERAL_like
4027:                                    || LA(2) == LITERAL_between
4028:                                    || LA(2) == LITERAL_in
4029:                                    || LA(2) == LITERAL_exists
4030:                                    || LA(2) == LITERAL_escape || LA(2) == 120
4031:                                    || LA(2) == PLUS || LA(2) == MINUS
4032:                                    || LA(2) == STRING_LITERAL
4033:                                    || LA(2) == QUESTION || LA(2) == INT
4034:                                    || LA(2) == REAL || LA(2) == BINSTR
4035:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
4036:                                    || LA(2) == LITERAL_when
4037:                                    || LA(2) == LITERAL_then
4038:                                    || LA(2) == LITERAL_else
4039:                                    || LA(2) == LITERAL_end
4040:                                    || LA(2) == LITERAL_hour
4041:                                    || LA(2) == LITERAL_left
4042:                                    || LA(2) == LITERAL_minute
4043:                                    || LA(2) == LITERAL_month
4044:                                    || LA(2) == LITERAL_right
4045:                                    || LA(2) == LITERAL_second
4046:                                    || LA(2) == LITERAL_year
4047:                                    || LA(2) == LITERAL_user
4048:                                    || LA(2) == LITERAL_current_user
4049:                                    || LA(2) == LITERAL_session_user
4050:                                    || LA(2) == LITERAL_system_user
4051:                                    || LA(2) == LITERAL_current_date
4052:                                    || LA(2) == LITERAL_current_time
4053:                                    || LA(2) == LITERAL_current_timestamp
4054:                                    || LA(2) == LITERAL_sql_tsi_frac_second
4055:                                    || LA(2) == LITERAL_sql_tsi_second
4056:                                    || LA(2) == LITERAL_sql_tsi_minute
4057:                                    || LA(2) == LITERAL_sql_tsi_hour
4058:                                    || LA(2) == LITERAL_sql_tsi_day
4059:                                    || LA(2) == LITERAL_sql_tsi_week
4060:                                    || LA(2) == LITERAL_sql_tsi_month
4061:                                    || LA(2) == LITERAL_sql_tsi_quarter
4062:                                    || LA(2) == LITERAL_sql_tsi_year
4063:                                    || LA(2) == LITERAL_cast
4064:                                    || LA(2) == LITERAL_true
4065:                                    || LA(2) == LITERAL_false
4066:                                    || LA(2) == LITERAL_avg
4067:                                    || LA(2) == LITERAL_min
4068:                                    || LA(2) == LITERAL_max
4069:                                    || LA(2) == LITERAL_sum
4070:                                    || LA(2) == LITERAL_count || LA(2) == LT
4071:                                    || LA(2) == LE || LA(2) == GT
4072:                                    || LA(2) == GE || LA(2) == NE
4073:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
4074:                                    || LA(2) == LITERAL_join
4075:                                    || LA(2) == LITERAL_natural
4076:                                    || LA(2) == LITERAL_union
4077:                                    || LA(2) == LITERAL_inner
4078:                                    || LA(2) == LITERAL_intersect
4079:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
4080:                    } else {
4081:                        throw new NoViableAltException(LT(1), getFilename());
4082:                    }
4083:
4084:                }
4085:                if (inputState.guessing == 0) {
4086:                    t = new TypeTimestamp(precision, tz);
4087:                }
4088:                return t;
4089:            }
4090:
4091:            public final Type typeInterval() throws RecognitionException,
4092:                    TokenStreamException {
4093:                Type t;
4094:
4095:                t = null;
4096:
4097:                match(LITERAL_interval);
4098:                t = intervalQualifier();
4099:                return t;
4100:            }
4101:
4102:            public final int integer() throws RecognitionException,
4103:                    TokenStreamException {
4104:                int val;
4105:
4106:                Token t = null;
4107:                val = 0;
4108:
4109:                t = LT(1);
4110:                match(INT);
4111:                if (inputState.guessing == 0) {
4112:                    val = Integer.parseInt(t.getText());
4113:                }
4114:                return val;
4115:            }
4116:
4117:            public final TypeInterval intervalQualifier()
4118:                    throws RecognitionException, TokenStreamException {
4119:                TypeInterval type;
4120:
4121:                type = null;
4122:
4123:                boolean synPredMatched296 = false;
4124:                if (((LA(1) == LITERAL_hour || LA(1) == LITERAL_minute
4125:                        || LA(1) == LITERAL_year || LA(1) == LITERAL_day) && (LA(2) == LPAREN || LA(2) == LITERAL_to))) {
4126:                    int _m296 = mark();
4127:                    synPredMatched296 = true;
4128:                    inputState.guessing++;
4129:                    try {
4130:                        {
4131:                            {
4132:                                switch (LA(1)) {
4133:                                case LITERAL_year: {
4134:                                    match(LITERAL_year);
4135:                                    break;
4136:                                }
4137:                                case LITERAL_day: {
4138:                                    match(LITERAL_day);
4139:                                    break;
4140:                                }
4141:                                case LITERAL_hour: {
4142:                                    match(LITERAL_hour);
4143:                                    break;
4144:                                }
4145:                                case LITERAL_minute: {
4146:                                    match(LITERAL_minute);
4147:                                    break;
4148:                                }
4149:                                default: {
4150:                                    throw new NoViableAltException(LT(1),
4151:                                            getFilename());
4152:                                }
4153:                                }
4154:                            }
4155:                            {
4156:                                switch (LA(1)) {
4157:                                case LPAREN: {
4158:                                    match(LPAREN);
4159:                                    integer();
4160:                                    match(RPAREN);
4161:                                    break;
4162:                                }
4163:                                case LITERAL_to: {
4164:                                    break;
4165:                                }
4166:                                default: {
4167:                                    throw new NoViableAltException(LT(1),
4168:                                            getFilename());
4169:                                }
4170:                                }
4171:                            }
4172:                            match(LITERAL_to);
4173:                        }
4174:                    } catch (RecognitionException pe) {
4175:                        synPredMatched296 = false;
4176:                    }
4177:                    rewind(_m296);
4178:                    inputState.guessing--;
4179:                }
4180:                if (synPredMatched296) {
4181:                    type = intervalRange();
4182:                } else if ((LA(1) == LITERAL_hour || LA(1) == LITERAL_minute
4183:                        || LA(1) == LITERAL_month || LA(1) == LITERAL_second
4184:                        || LA(1) == LITERAL_year || LA(1) == LITERAL_day)
4185:                        && (LA(2) == EOF || LA(2) == LITERAL_create
4186:                                || LA(2) == LITERAL_unique
4187:                                || LA(2) == LITERAL_on || LA(2) == LPAREN
4188:                                || LA(2) == RPAREN
4189:                                || LA(2) == LITERAL_constraint
4190:                                || LA(2) == LITERAL_primary
4191:                                || LA(2) == LITERAL_check
4192:                                || LA(2) == LITERAL_first
4193:                                || LA(2) == LITERAL_after
4194:                                || LA(2) == LITERAL_default
4195:                                || LA(2) == LITERAL_as || LA(2) == LITERAL_with
4196:                                || LA(2) == COMMA || LA(2) == LITERAL_where
4197:                                || LA(2) == EQ || LA(2) == LITERAL_from
4198:                                || LA(2) == LITERAL_grant
4199:                                || LA(2) == LITERAL_references
4200:                                || LA(2) == LITERAL_not
4201:                                || LA(2) == LITERAL_full
4202:                                || LA(2) == LITERAL_initially
4203:                                || LA(2) == LITERAL_deferrable
4204:                                || LA(2) == LITERAL_for
4205:                                || LA(2) == LITERAL_order || LA(2) == STAR
4206:                                || LA(2) == LITERAL_having
4207:                                || LA(2) == LITERAL_using
4208:                                || LA(2) == LITERAL_group || LA(2) == CONCAT
4209:                                || LA(2) == LITERAL_or || LA(2) == LITERAL_and
4210:                                || LA(2) == LITERAL_is || LA(2) == LITERAL_like
4211:                                || LA(2) == LITERAL_between
4212:                                || LA(2) == LITERAL_in
4213:                                || LA(2) == LITERAL_escape || LA(2) == 120
4214:                                || LA(2) == PLUS || LA(2) == MINUS
4215:                                || LA(2) == LITERAL_when
4216:                                || LA(2) == LITERAL_then
4217:                                || LA(2) == LITERAL_else
4218:                                || LA(2) == LITERAL_end
4219:                                || LA(2) == LITERAL_left
4220:                                || LA(2) == LITERAL_right || LA(2) == LT
4221:                                || LA(2) == LE || LA(2) == GT || LA(2) == GE
4222:                                || LA(2) == NE || LA(2) == SLASH
4223:                                || LA(2) == LITERAL_cross
4224:                                || LA(2) == LITERAL_join
4225:                                || LA(2) == LITERAL_natural
4226:                                || LA(2) == LITERAL_union
4227:                                || LA(2) == LITERAL_inner
4228:                                || LA(2) == LITERAL_intersect
4229:                                || LA(2) == LITERAL_except || LA(2) == ID)) {
4230:                    type = intervalSingleField();
4231:                } else {
4232:                    throw new NoViableAltException(LT(1), getFilename());
4233:                }
4234:
4235:                return type;
4236:            }
4237:
4238:            public final Vector orderBy() throws RecognitionException,
4239:                    TokenStreamException {
4240:                Vector v;
4241:
4242:                v = new Vector();
4243:                OrderElement e;
4244:
4245:                match(LITERAL_order);
4246:                match(LITERAL_by);
4247:                e = orderElement();
4248:                if (inputState.guessing == 0) {
4249:                    v.addElement(e);
4250:                }
4251:                {
4252:                    _loop183: do {
4253:                        if ((LA(1) == COMMA)) {
4254:                            match(COMMA);
4255:                            e = orderElement();
4256:                            if (inputState.guessing == 0) {
4257:                                v.addElement(e);
4258:                            }
4259:                        } else {
4260:                            break _loop183;
4261:                        }
4262:
4263:                    } while (true);
4264:                }
4265:                return v;
4266:            }
4267:
4268:            public final OrderElement orderElement()
4269:                    throws RecognitionException, TokenStreamException {
4270:                OrderElement e;
4271:
4272:                e = null;
4273:                int i;
4274:                String id = null;
4275:
4276:                {
4277:                    switch (LA(1)) {
4278:                    case ID: {
4279:                        id = sqlId();
4280:                        if (inputState.guessing == 0) {
4281:                            e = new OrderElement(id);
4282:                        }
4283:                        break;
4284:                    }
4285:                    case INT: {
4286:                        i = integer();
4287:                        if (inputState.guessing == 0) {
4288:                            e = new OrderElement(i);
4289:                        }
4290:                        break;
4291:                    }
4292:                    default: {
4293:                        throw new NoViableAltException(LT(1), getFilename());
4294:                    }
4295:                    }
4296:                }
4297:                {
4298:                    switch (LA(1)) {
4299:                    case LITERAL_asc: {
4300:                        match(LITERAL_asc);
4301:                        if (inputState.guessing == 0) {
4302:                            e.setAscending(true);
4303:                        }
4304:                        break;
4305:                    }
4306:                    case LITERAL_desc: {
4307:                        match(LITERAL_desc);
4308:                        if (inputState.guessing == 0) {
4309:                            e.setAscending(false);
4310:                        }
4311:                        break;
4312:                    }
4313:                    case EOF:
4314:                    case COMMA: {
4315:                        break;
4316:                    }
4317:                    default: {
4318:                        throw new NoViableAltException(LT(1), getFilename());
4319:                    }
4320:                    }
4321:                }
4322:                return e;
4323:            }
4324:
4325:            public final SelectExpression querySpecification()
4326:                    throws RecognitionException, TokenStreamException {
4327:                SelectExpression s;
4328:
4329:                s = null;
4330:                Vector items = null;
4331:                Vector from = null;
4332:                Expression where = null;
4333:                Vector group = null;
4334:                Expression having = null;
4335:
4336:                match(LITERAL_select);
4337:                if (inputState.guessing == 0) {
4338:                    s = new SelectExpression();
4339:                }
4340:                {
4341:                    switch (LA(1)) {
4342:                    case LITERAL_all: {
4343:                        match(LITERAL_all);
4344:                        if (inputState.guessing == 0) {
4345:                            s.setDistinct(false);
4346:                        }
4347:                        break;
4348:                    }
4349:                    case LITERAL_distinct: {
4350:                        match(LITERAL_distinct);
4351:                        if (inputState.guessing == 0) {
4352:                            s.setDistinct(true);
4353:                        }
4354:                        break;
4355:                    }
4356:                    case LITERAL_unique:
4357:                    case LPAREN:
4358:                    case LITERAL_default:
4359:                    case LITERAL_insert:
4360:                    case LITERAL_not:
4361:                    case LITERAL_null:
4362:                    case LITERAL_char:
4363:                    case LITERAL_date:
4364:                    case LITERAL_time:
4365:                    case LITERAL_timestamp:
4366:                    case LITERAL_interval:
4367:                    case STAR:
4368:                    case LITERAL_exists:
4369:                    case PLUS:
4370:                    case MINUS:
4371:                    case STRING_LITERAL:
4372:                    case QUESTION:
4373:                    case INT:
4374:                    case REAL:
4375:                    case BINSTR:
4376:                    case HEXSTR:
4377:                    case LITERAL_case:
4378:                    case LITERAL_hour:
4379:                    case LITERAL_left:
4380:                    case LITERAL_minute:
4381:                    case LITERAL_month:
4382:                    case LITERAL_right:
4383:                    case LITERAL_second:
4384:                    case LITERAL_year:
4385:                    case LITERAL_user:
4386:                    case LITERAL_current_user:
4387:                    case LITERAL_session_user:
4388:                    case LITERAL_system_user:
4389:                    case LITERAL_current_date:
4390:                    case LITERAL_current_time:
4391:                    case LITERAL_current_timestamp:
4392:                    case LITERAL_sql_tsi_frac_second:
4393:                    case LITERAL_sql_tsi_second:
4394:                    case LITERAL_sql_tsi_minute:
4395:                    case LITERAL_sql_tsi_hour:
4396:                    case LITERAL_sql_tsi_day:
4397:                    case LITERAL_sql_tsi_week:
4398:                    case LITERAL_sql_tsi_month:
4399:                    case LITERAL_sql_tsi_quarter:
4400:                    case LITERAL_sql_tsi_year:
4401:                    case LITERAL_cast:
4402:                    case LITERAL_true:
4403:                    case LITERAL_false:
4404:                    case LITERAL_avg:
4405:                    case LITERAL_min:
4406:                    case LITERAL_max:
4407:                    case LITERAL_sum:
4408:                    case LITERAL_count:
4409:                    case ID: {
4410:                        break;
4411:                    }
4412:                    default: {
4413:                        throw new NoViableAltException(LT(1), getFilename());
4414:                    }
4415:                    }
4416:                }
4417:                {
4418:                    switch (LA(1)) {
4419:                    case LITERAL_unique:
4420:                    case LPAREN:
4421:                    case LITERAL_default:
4422:                    case LITERAL_insert:
4423:                    case LITERAL_not:
4424:                    case LITERAL_null:
4425:                    case LITERAL_char:
4426:                    case LITERAL_date:
4427:                    case LITERAL_time:
4428:                    case LITERAL_timestamp:
4429:                    case LITERAL_interval:
4430:                    case LITERAL_exists:
4431:                    case PLUS:
4432:                    case MINUS:
4433:                    case STRING_LITERAL:
4434:                    case QUESTION:
4435:                    case INT:
4436:                    case REAL:
4437:                    case BINSTR:
4438:                    case HEXSTR:
4439:                    case LITERAL_case:
4440:                    case LITERAL_hour:
4441:                    case LITERAL_left:
4442:                    case LITERAL_minute:
4443:                    case LITERAL_month:
4444:                    case LITERAL_right:
4445:                    case LITERAL_second:
4446:                    case LITERAL_year:
4447:                    case LITERAL_user:
4448:                    case LITERAL_current_user:
4449:                    case LITERAL_session_user:
4450:                    case LITERAL_system_user:
4451:                    case LITERAL_current_date:
4452:                    case LITERAL_current_time:
4453:                    case LITERAL_current_timestamp:
4454:                    case LITERAL_sql_tsi_frac_second:
4455:                    case LITERAL_sql_tsi_second:
4456:                    case LITERAL_sql_tsi_minute:
4457:                    case LITERAL_sql_tsi_hour:
4458:                    case LITERAL_sql_tsi_day:
4459:                    case LITERAL_sql_tsi_week:
4460:                    case LITERAL_sql_tsi_month:
4461:                    case LITERAL_sql_tsi_quarter:
4462:                    case LITERAL_sql_tsi_year:
4463:                    case LITERAL_cast:
4464:                    case LITERAL_true:
4465:                    case LITERAL_false:
4466:                    case LITERAL_avg:
4467:                    case LITERAL_min:
4468:                    case LITERAL_max:
4469:                    case LITERAL_sum:
4470:                    case LITERAL_count:
4471:                    case ID: {
4472:                        items = selectItems();
4473:                        if (inputState.guessing == 0) {
4474:                            s.setItems(items);
4475:                        }
4476:                        break;
4477:                    }
4478:                    case STAR: {
4479:                        match(STAR);
4480:                        break;
4481:                    }
4482:                    default: {
4483:                        throw new NoViableAltException(LT(1), getFilename());
4484:                    }
4485:                    }
4486:                }
4487:                from = selectFrom();
4488:                if (inputState.guessing == 0) {
4489:                    s.setFrom(from);
4490:                }
4491:                where = whereExpression();
4492:                if (inputState.guessing == 0) {
4493:                    s.setWhere(where);
4494:                }
4495:                group = selectGroupBy();
4496:                if (inputState.guessing == 0) {
4497:                    s.setGroupBy(group);
4498:                }
4499:                having = selectHaving();
4500:                if (inputState.guessing == 0) {
4501:                    s.setHaving(having);
4502:                }
4503:                return s;
4504:            }
4505:
4506:            public final Vector selectItems() throws RecognitionException,
4507:                    TokenStreamException {
4508:                Vector items;
4509:
4510:                items = new Vector();
4511:                SelectItem item = null;
4512:
4513:                item = selectItem();
4514:                if (inputState.guessing == 0) {
4515:
4516:                    items.addElement(item);
4517:
4518:                }
4519:                {
4520:                    _loop320: do {
4521:                        if ((LA(1) == COMMA)
4522:                                && (LA(2) == LITERAL_unique || LA(2) == LPAREN
4523:                                        || LA(2) == LITERAL_default
4524:                                        || LA(2) == LITERAL_insert
4525:                                        || LA(2) == LITERAL_not
4526:                                        || LA(2) == LITERAL_null
4527:                                        || LA(2) == LITERAL_char
4528:                                        || LA(2) == LITERAL_date
4529:                                        || LA(2) == LITERAL_time
4530:                                        || LA(2) == LITERAL_timestamp
4531:                                        || LA(2) == LITERAL_interval
4532:                                        || LA(2) == LITERAL_exists
4533:                                        || LA(2) == PLUS || LA(2) == MINUS
4534:                                        || LA(2) == STRING_LITERAL
4535:                                        || LA(2) == QUESTION || LA(2) == INT
4536:                                        || LA(2) == REAL || LA(2) == BINSTR
4537:                                        || LA(2) == HEXSTR
4538:                                        || LA(2) == LITERAL_case
4539:                                        || LA(2) == LITERAL_hour
4540:                                        || LA(2) == LITERAL_left
4541:                                        || LA(2) == LITERAL_minute
4542:                                        || LA(2) == LITERAL_month
4543:                                        || LA(2) == LITERAL_right
4544:                                        || LA(2) == LITERAL_second
4545:                                        || LA(2) == LITERAL_year
4546:                                        || LA(2) == LITERAL_user
4547:                                        || LA(2) == LITERAL_current_user
4548:                                        || LA(2) == LITERAL_session_user
4549:                                        || LA(2) == LITERAL_system_user
4550:                                        || LA(2) == LITERAL_current_date
4551:                                        || LA(2) == LITERAL_current_time
4552:                                        || LA(2) == LITERAL_current_timestamp
4553:                                        || LA(2) == LITERAL_sql_tsi_frac_second
4554:                                        || LA(2) == LITERAL_sql_tsi_second
4555:                                        || LA(2) == LITERAL_sql_tsi_minute
4556:                                        || LA(2) == LITERAL_sql_tsi_hour
4557:                                        || LA(2) == LITERAL_sql_tsi_day
4558:                                        || LA(2) == LITERAL_sql_tsi_week
4559:                                        || LA(2) == LITERAL_sql_tsi_month
4560:                                        || LA(2) == LITERAL_sql_tsi_quarter
4561:                                        || LA(2) == LITERAL_sql_tsi_year
4562:                                        || LA(2) == LITERAL_cast
4563:                                        || LA(2) == LITERAL_true
4564:                                        || LA(2) == LITERAL_false
4565:                                        || LA(2) == LITERAL_avg
4566:                                        || LA(2) == LITERAL_min
4567:                                        || LA(2) == LITERAL_max
4568:                                        || LA(2) == LITERAL_sum
4569:                                        || LA(2) == LITERAL_count || LA(2) == ID)) {
4570:                            match(COMMA);
4571:                            item = selectItem();
4572:                            if (inputState.guessing == 0) {
4573:                                items.addElement(item);
4574:                            }
4575:                        } else {
4576:                            break _loop320;
4577:                        }
4578:
4579:                    } while (true);
4580:                }
4581:                return items;
4582:            }
4583:
4584:            public final Vector selectFrom() throws RecognitionException,
4585:                    TokenStreamException {
4586:                Vector from;
4587:
4588:                from = null;
4589:                Expression item = null;
4590:
4591:                {
4592:                    if ((LA(1) == LITERAL_from)
4593:                            && (LA(2) == LPAREN || LA(2) == ID)) {
4594:                        match(LITERAL_from);
4595:                        if (inputState.guessing == 0) {
4596:                            from = new Vector();
4597:                        }
4598:                        item = tableReference();
4599:                        if (inputState.guessing == 0) {
4600:                            from.addElement(item);
4601:                        }
4602:                        {
4603:                            _loop195: do {
4604:                                if ((LA(1) == COMMA)
4605:                                        && (LA(2) == LPAREN || LA(2) == ID)) {
4606:                                    match(COMMA);
4607:                                    item = tableReference();
4608:                                    if (inputState.guessing == 0) {
4609:                                        from.addElement(item);
4610:                                    }
4611:                                } else {
4612:                                    break _loop195;
4613:                                }
4614:
4615:                            } while (true);
4616:                        }
4617:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_create
4618:                            || LA(1) == LITERAL_unique || LA(1) == LITERAL_on
4619:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
4620:                            || LA(1) == LITERAL_primary
4621:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
4622:                            || LA(1) == LITERAL_after
4623:                            || LA(1) == LITERAL_default || LA(1) == LITERAL_as
4624:                            || LA(1) == LITERAL_with || LA(1) == COMMA
4625:                            || LA(1) == LITERAL_where || LA(1) == LITERAL_from
4626:                            || LA(1) == LITERAL_grant
4627:                            || LA(1) == LITERAL_references
4628:                            || LA(1) == LITERAL_not || LA(1) == LITERAL_full
4629:                            || LA(1) == LITERAL_initially
4630:                            || LA(1) == LITERAL_deferrable
4631:                            || LA(1) == LITERAL_for || LA(1) == LITERAL_order
4632:                            || LA(1) == LITERAL_having
4633:                            || LA(1) == LITERAL_using || LA(1) == LITERAL_group
4634:                            || LA(1) == CONCAT || LA(1) == LITERAL_or
4635:                            || LA(1) == LITERAL_and || LA(1) == LITERAL_when
4636:                            || LA(1) == LITERAL_then || LA(1) == LITERAL_else
4637:                            || LA(1) == LITERAL_end || LA(1) == LITERAL_left
4638:                            || LA(1) == LITERAL_right || LA(1) == LITERAL_cross
4639:                            || LA(1) == LITERAL_join
4640:                            || LA(1) == LITERAL_natural
4641:                            || LA(1) == LITERAL_union || LA(1) == LITERAL_inner
4642:                            || LA(1) == LITERAL_intersect
4643:                            || LA(1) == LITERAL_except || LA(1) == ID)
4644:                            && (LA(2) == EOF || LA(2) == LITERAL_create
4645:                                    || LA(2) == LITERAL_unique
4646:                                    || LA(2) == LITERAL_index
4647:                                    || LA(2) == LITERAL_temporary
4648:                                    || LA(2) == LITERAL_table
4649:                                    || LA(2) == LITERAL_view
4650:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
4651:                                    || LA(2) == RPAREN
4652:                                    || LA(2) == LITERAL_constraint
4653:                                    || LA(2) == LITERAL_primary
4654:                                    || LA(2) == LITERAL_foreign
4655:                                    || LA(2) == LITERAL_check
4656:                                    || LA(2) == LITERAL_first
4657:                                    || LA(2) == LITERAL_after
4658:                                    || LA(2) == LITERAL_default
4659:                                    || LA(2) == LITERAL_as
4660:                                    || LA(2) == LITERAL_with
4661:                                    || LA(2) == LITERAL_cascaded
4662:                                    || LA(2) == LITERAL_update
4663:                                    || LA(2) == COMMA || LA(2) == LITERAL_where
4664:                                    || LA(2) == EQ || LA(2) == LITERAL_delete
4665:                                    || LA(2) == LITERAL_from
4666:                                    || LA(2) == LITERAL_global
4667:                                    || LA(2) == LITERAL_local
4668:                                    || LA(2) == LITERAL_grant
4669:                                    || LA(2) == LITERAL_all
4670:                                    || LA(2) == LITERAL_select
4671:                                    || LA(2) == LITERAL_insert
4672:                                    || LA(2) == LITERAL_references
4673:                                    || LA(2) == LITERAL_usage
4674:                                    || LA(2) == LITERAL_not
4675:                                    || LA(2) == LITERAL_null
4676:                                    || LA(2) == LITERAL_key
4677:                                    || LA(2) == LITERAL_identity
4678:                                    || LA(2) == LITERAL_full
4679:                                    || LA(2) == LITERAL_initially
4680:                                    || LA(2) == LITERAL_deferred
4681:                                    || LA(2) == LITERAL_immediate
4682:                                    || LA(2) == LITERAL_deferrable
4683:                                    || LA(2) == LITERAL_bit
4684:                                    || LA(2) == LITERAL_varbinary
4685:                                    || LA(2) == LITERAL_binary
4686:                                    || LA(2) == LITERAL_blob
4687:                                    || LA(2) == LITERAL_clob
4688:                                    || LA(2) == LITERAL_character
4689:                                    || LA(2) == LITERAL_char
4690:                                    || LA(2) == LITERAL_varchar
4691:                                    || LA(2) == LITERAL_int
4692:                                    || LA(2) == LITERAL_integer
4693:                                    || LA(2) == LITERAL_smallint
4694:                                    || LA(2) == LITERAL_tinyint
4695:                                    || LA(2) == LITERAL_bigint
4696:                                    || LA(2) == LITERAL_dec
4697:                                    || LA(2) == LITERAL_decimal
4698:                                    || LA(2) == LITERAL_numeric
4699:                                    || LA(2) == LITERAL_real
4700:                                    || LA(2) == LITERAL_double
4701:                                    || LA(2) == LITERAL_float
4702:                                    || LA(2) == LITERAL_boolean
4703:                                    || LA(2) == LITERAL_date
4704:                                    || LA(2) == LITERAL_time
4705:                                    || LA(2) == LITERAL_timestamp
4706:                                    || LA(2) == LITERAL_interval
4707:                                    || LA(2) == LITERAL_for
4708:                                    || LA(2) == LITERAL_read
4709:                                    || LA(2) == LITERAL_order
4710:                                    || LA(2) == LITERAL_by || LA(2) == STAR
4711:                                    || LA(2) == LITERAL_having
4712:                                    || LA(2) == LITERAL_corresponding
4713:                                    || LA(2) == LITERAL_values
4714:                                    || LA(2) == LITERAL_using
4715:                                    || LA(2) == LITERAL_group
4716:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
4717:                                    || LA(2) == LITERAL_and
4718:                                    || LA(2) == LITERAL_is
4719:                                    || LA(2) == LITERAL_like
4720:                                    || LA(2) == LITERAL_between
4721:                                    || LA(2) == LITERAL_in
4722:                                    || LA(2) == LITERAL_exists
4723:                                    || LA(2) == LITERAL_escape || LA(2) == 120
4724:                                    || LA(2) == PLUS || LA(2) == MINUS
4725:                                    || LA(2) == STRING_LITERAL
4726:                                    || LA(2) == QUESTION || LA(2) == INT
4727:                                    || LA(2) == REAL || LA(2) == BINSTR
4728:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
4729:                                    || LA(2) == LITERAL_when
4730:                                    || LA(2) == LITERAL_then
4731:                                    || LA(2) == LITERAL_else
4732:                                    || LA(2) == LITERAL_end
4733:                                    || LA(2) == LITERAL_hour
4734:                                    || LA(2) == LITERAL_left
4735:                                    || LA(2) == LITERAL_minute
4736:                                    || LA(2) == LITERAL_month
4737:                                    || LA(2) == LITERAL_right
4738:                                    || LA(2) == LITERAL_second
4739:                                    || LA(2) == LITERAL_year
4740:                                    || LA(2) == LITERAL_user
4741:                                    || LA(2) == LITERAL_current_user
4742:                                    || LA(2) == LITERAL_session_user
4743:                                    || LA(2) == LITERAL_system_user
4744:                                    || LA(2) == LITERAL_current_date
4745:                                    || LA(2) == LITERAL_current_time
4746:                                    || LA(2) == LITERAL_current_timestamp
4747:                                    || LA(2) == LITERAL_sql_tsi_frac_second
4748:                                    || LA(2) == LITERAL_sql_tsi_second
4749:                                    || LA(2) == LITERAL_sql_tsi_minute
4750:                                    || LA(2) == LITERAL_sql_tsi_hour
4751:                                    || LA(2) == LITERAL_sql_tsi_day
4752:                                    || LA(2) == LITERAL_sql_tsi_week
4753:                                    || LA(2) == LITERAL_sql_tsi_month
4754:                                    || LA(2) == LITERAL_sql_tsi_quarter
4755:                                    || LA(2) == LITERAL_sql_tsi_year
4756:                                    || LA(2) == LITERAL_cast
4757:                                    || LA(2) == LITERAL_true
4758:                                    || LA(2) == LITERAL_false
4759:                                    || LA(2) == LITERAL_avg
4760:                                    || LA(2) == LITERAL_min
4761:                                    || LA(2) == LITERAL_max
4762:                                    || LA(2) == LITERAL_sum
4763:                                    || LA(2) == LITERAL_count || LA(2) == LT
4764:                                    || LA(2) == LE || LA(2) == GT
4765:                                    || LA(2) == GE || LA(2) == NE
4766:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
4767:                                    || LA(2) == LITERAL_join
4768:                                    || LA(2) == LITERAL_natural
4769:                                    || LA(2) == LITERAL_union
4770:                                    || LA(2) == LITERAL_inner
4771:                                    || LA(2) == LITERAL_outer
4772:                                    || LA(2) == LITERAL_intersect
4773:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
4774:                    } else {
4775:                        throw new NoViableAltException(LT(1), getFilename());
4776:                    }
4777:
4778:                }
4779:                return from;
4780:            }
4781:
4782:            public final Vector selectGroupBy() throws RecognitionException,
4783:                    TokenStreamException {
4784:                Vector v;
4785:
4786:                v = null;
4787:
4788:                {
4789:                    if ((LA(1) == LITERAL_group) && (LA(2) == LITERAL_by)) {
4790:                        match(LITERAL_group);
4791:                        match(LITERAL_by);
4792:                        v = idList();
4793:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_create
4794:                            || LA(1) == LITERAL_unique || LA(1) == LITERAL_on
4795:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
4796:                            || LA(1) == LITERAL_primary
4797:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
4798:                            || LA(1) == LITERAL_after
4799:                            || LA(1) == LITERAL_default || LA(1) == LITERAL_as
4800:                            || LA(1) == LITERAL_with || LA(1) == COMMA
4801:                            || LA(1) == LITERAL_where || LA(1) == LITERAL_from
4802:                            || LA(1) == LITERAL_grant
4803:                            || LA(1) == LITERAL_references
4804:                            || LA(1) == LITERAL_not || LA(1) == LITERAL_full
4805:                            || LA(1) == LITERAL_initially
4806:                            || LA(1) == LITERAL_deferrable
4807:                            || LA(1) == LITERAL_for || LA(1) == LITERAL_order
4808:                            || LA(1) == LITERAL_having
4809:                            || LA(1) == LITERAL_using || LA(1) == LITERAL_group
4810:                            || LA(1) == CONCAT || LA(1) == LITERAL_or
4811:                            || LA(1) == LITERAL_and || LA(1) == LITERAL_when
4812:                            || LA(1) == LITERAL_then || LA(1) == LITERAL_else
4813:                            || LA(1) == LITERAL_end || LA(1) == LITERAL_left
4814:                            || LA(1) == LITERAL_right || LA(1) == LITERAL_cross
4815:                            || LA(1) == LITERAL_join
4816:                            || LA(1) == LITERAL_natural
4817:                            || LA(1) == LITERAL_union || LA(1) == LITERAL_inner
4818:                            || LA(1) == LITERAL_intersect
4819:                            || LA(1) == LITERAL_except || LA(1) == ID)
4820:                            && (LA(2) == EOF || LA(2) == LITERAL_create
4821:                                    || LA(2) == LITERAL_unique
4822:                                    || LA(2) == LITERAL_index
4823:                                    || LA(2) == LITERAL_temporary
4824:                                    || LA(2) == LITERAL_table
4825:                                    || LA(2) == LITERAL_view
4826:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
4827:                                    || LA(2) == RPAREN
4828:                                    || LA(2) == LITERAL_constraint
4829:                                    || LA(2) == LITERAL_primary
4830:                                    || LA(2) == LITERAL_foreign
4831:                                    || LA(2) == LITERAL_check
4832:                                    || LA(2) == LITERAL_first
4833:                                    || LA(2) == LITERAL_after
4834:                                    || LA(2) == LITERAL_default
4835:                                    || LA(2) == LITERAL_as
4836:                                    || LA(2) == LITERAL_with
4837:                                    || LA(2) == LITERAL_cascaded
4838:                                    || LA(2) == LITERAL_update
4839:                                    || LA(2) == COMMA || LA(2) == LITERAL_where
4840:                                    || LA(2) == EQ || LA(2) == LITERAL_delete
4841:                                    || LA(2) == LITERAL_from
4842:                                    || LA(2) == LITERAL_global
4843:                                    || LA(2) == LITERAL_local
4844:                                    || LA(2) == LITERAL_grant
4845:                                    || LA(2) == LITERAL_all
4846:                                    || LA(2) == LITERAL_select
4847:                                    || LA(2) == LITERAL_insert
4848:                                    || LA(2) == LITERAL_references
4849:                                    || LA(2) == LITERAL_usage
4850:                                    || LA(2) == LITERAL_not
4851:                                    || LA(2) == LITERAL_null
4852:                                    || LA(2) == LITERAL_key
4853:                                    || LA(2) == LITERAL_identity
4854:                                    || LA(2) == LITERAL_full
4855:                                    || LA(2) == LITERAL_initially
4856:                                    || LA(2) == LITERAL_deferred
4857:                                    || LA(2) == LITERAL_immediate
4858:                                    || LA(2) == LITERAL_deferrable
4859:                                    || LA(2) == LITERAL_bit
4860:                                    || LA(2) == LITERAL_varbinary
4861:                                    || LA(2) == LITERAL_binary
4862:                                    || LA(2) == LITERAL_blob
4863:                                    || LA(2) == LITERAL_clob
4864:                                    || LA(2) == LITERAL_character
4865:                                    || LA(2) == LITERAL_char
4866:                                    || LA(2) == LITERAL_varchar
4867:                                    || LA(2) == LITERAL_int
4868:                                    || LA(2) == LITERAL_integer
4869:                                    || LA(2) == LITERAL_smallint
4870:                                    || LA(2) == LITERAL_tinyint
4871:                                    || LA(2) == LITERAL_bigint
4872:                                    || LA(2) == LITERAL_dec
4873:                                    || LA(2) == LITERAL_decimal
4874:                                    || LA(2) == LITERAL_numeric
4875:                                    || LA(2) == LITERAL_real
4876:                                    || LA(2) == LITERAL_double
4877:                                    || LA(2) == LITERAL_float
4878:                                    || LA(2) == LITERAL_boolean
4879:                                    || LA(2) == LITERAL_date
4880:                                    || LA(2) == LITERAL_time
4881:                                    || LA(2) == LITERAL_timestamp
4882:                                    || LA(2) == LITERAL_interval
4883:                                    || LA(2) == LITERAL_for
4884:                                    || LA(2) == LITERAL_read
4885:                                    || LA(2) == LITERAL_order
4886:                                    || LA(2) == LITERAL_by || LA(2) == STAR
4887:                                    || LA(2) == LITERAL_having
4888:                                    || LA(2) == LITERAL_corresponding
4889:                                    || LA(2) == LITERAL_values
4890:                                    || LA(2) == LITERAL_using
4891:                                    || LA(2) == LITERAL_group
4892:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
4893:                                    || LA(2) == LITERAL_and
4894:                                    || LA(2) == LITERAL_is
4895:                                    || LA(2) == LITERAL_like
4896:                                    || LA(2) == LITERAL_between
4897:                                    || LA(2) == LITERAL_in
4898:                                    || LA(2) == LITERAL_exists
4899:                                    || LA(2) == LITERAL_escape || LA(2) == 120
4900:                                    || LA(2) == PLUS || LA(2) == MINUS
4901:                                    || LA(2) == STRING_LITERAL
4902:                                    || LA(2) == QUESTION || LA(2) == INT
4903:                                    || LA(2) == REAL || LA(2) == BINSTR
4904:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
4905:                                    || LA(2) == LITERAL_when
4906:                                    || LA(2) == LITERAL_then
4907:                                    || LA(2) == LITERAL_else
4908:                                    || LA(2) == LITERAL_end
4909:                                    || LA(2) == LITERAL_hour
4910:                                    || LA(2) == LITERAL_left
4911:                                    || LA(2) == LITERAL_minute
4912:                                    || LA(2) == LITERAL_month
4913:                                    || LA(2) == LITERAL_right
4914:                                    || LA(2) == LITERAL_second
4915:                                    || LA(2) == LITERAL_year
4916:                                    || LA(2) == LITERAL_user
4917:                                    || LA(2) == LITERAL_current_user
4918:                                    || LA(2) == LITERAL_session_user
4919:                                    || LA(2) == LITERAL_system_user
4920:                                    || LA(2) == LITERAL_current_date
4921:                                    || LA(2) == LITERAL_current_time
4922:                                    || LA(2) == LITERAL_current_timestamp
4923:                                    || LA(2) == LITERAL_sql_tsi_frac_second
4924:                                    || LA(2) == LITERAL_sql_tsi_second
4925:                                    || LA(2) == LITERAL_sql_tsi_minute
4926:                                    || LA(2) == LITERAL_sql_tsi_hour
4927:                                    || LA(2) == LITERAL_sql_tsi_day
4928:                                    || LA(2) == LITERAL_sql_tsi_week
4929:                                    || LA(2) == LITERAL_sql_tsi_month
4930:                                    || LA(2) == LITERAL_sql_tsi_quarter
4931:                                    || LA(2) == LITERAL_sql_tsi_year
4932:                                    || LA(2) == LITERAL_cast
4933:                                    || LA(2) == LITERAL_true
4934:                                    || LA(2) == LITERAL_false
4935:                                    || LA(2) == LITERAL_avg
4936:                                    || LA(2) == LITERAL_min
4937:                                    || LA(2) == LITERAL_max
4938:                                    || LA(2) == LITERAL_sum
4939:                                    || LA(2) == LITERAL_count || LA(2) == LT
4940:                                    || LA(2) == LE || LA(2) == GT
4941:                                    || LA(2) == GE || LA(2) == NE
4942:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
4943:                                    || LA(2) == LITERAL_join
4944:                                    || LA(2) == LITERAL_natural
4945:                                    || LA(2) == LITERAL_union
4946:                                    || LA(2) == LITERAL_inner
4947:                                    || LA(2) == LITERAL_outer
4948:                                    || LA(2) == LITERAL_intersect
4949:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
4950:                    } else {
4951:                        throw new NoViableAltException(LT(1), getFilename());
4952:                    }
4953:
4954:                }
4955:                return v;
4956:            }
4957:
4958:            public final Expression selectHaving() throws RecognitionException,
4959:                    TokenStreamException {
4960:                Expression e;
4961:
4962:                e = null;
4963:
4964:                {
4965:                    if ((LA(1) == LITERAL_having)
4966:                            && (LA(2) == LITERAL_unique || LA(2) == LPAREN
4967:                                    || LA(2) == LITERAL_default
4968:                                    || LA(2) == LITERAL_insert
4969:                                    || LA(2) == LITERAL_not
4970:                                    || LA(2) == LITERAL_null
4971:                                    || LA(2) == LITERAL_char
4972:                                    || LA(2) == LITERAL_date
4973:                                    || LA(2) == LITERAL_time
4974:                                    || LA(2) == LITERAL_timestamp
4975:                                    || LA(2) == LITERAL_interval
4976:                                    || LA(2) == LITERAL_exists || LA(2) == PLUS
4977:                                    || LA(2) == MINUS
4978:                                    || LA(2) == STRING_LITERAL
4979:                                    || LA(2) == QUESTION || LA(2) == INT
4980:                                    || LA(2) == REAL || LA(2) == BINSTR
4981:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
4982:                                    || LA(2) == LITERAL_hour
4983:                                    || LA(2) == LITERAL_left
4984:                                    || LA(2) == LITERAL_minute
4985:                                    || LA(2) == LITERAL_month
4986:                                    || LA(2) == LITERAL_right
4987:                                    || LA(2) == LITERAL_second
4988:                                    || LA(2) == LITERAL_year
4989:                                    || LA(2) == LITERAL_user
4990:                                    || LA(2) == LITERAL_current_user
4991:                                    || LA(2) == LITERAL_session_user
4992:                                    || LA(2) == LITERAL_system_user
4993:                                    || LA(2) == LITERAL_current_date
4994:                                    || LA(2) == LITERAL_current_time
4995:                                    || LA(2) == LITERAL_current_timestamp
4996:                                    || LA(2) == LITERAL_sql_tsi_frac_second
4997:                                    || LA(2) == LITERAL_sql_tsi_second
4998:                                    || LA(2) == LITERAL_sql_tsi_minute
4999:                                    || LA(2) == LITERAL_sql_tsi_hour
5000:                                    || LA(2) == LITERAL_sql_tsi_day
5001:                                    || LA(2) == LITERAL_sql_tsi_week
5002:                                    || LA(2) == LITERAL_sql_tsi_month
5003:                                    || LA(2) == LITERAL_sql_tsi_quarter
5004:                                    || LA(2) == LITERAL_sql_tsi_year
5005:                                    || LA(2) == LITERAL_cast
5006:                                    || LA(2) == LITERAL_true
5007:                                    || LA(2) == LITERAL_false
5008:                                    || LA(2) == LITERAL_avg
5009:                                    || LA(2) == LITERAL_min
5010:                                    || LA(2) == LITERAL_max
5011:                                    || LA(2) == LITERAL_sum
5012:                                    || LA(2) == LITERAL_count || LA(2) == ID)) {
5013:                        match(LITERAL_having);
5014:                        e = expression();
5015:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_create
5016:                            || LA(1) == LITERAL_unique || LA(1) == LITERAL_on
5017:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
5018:                            || LA(1) == LITERAL_primary
5019:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
5020:                            || LA(1) == LITERAL_after
5021:                            || LA(1) == LITERAL_default || LA(1) == LITERAL_as
5022:                            || LA(1) == LITERAL_with || LA(1) == COMMA
5023:                            || LA(1) == LITERAL_where || LA(1) == LITERAL_from
5024:                            || LA(1) == LITERAL_grant
5025:                            || LA(1) == LITERAL_references
5026:                            || LA(1) == LITERAL_not || LA(1) == LITERAL_full
5027:                            || LA(1) == LITERAL_initially
5028:                            || LA(1) == LITERAL_deferrable
5029:                            || LA(1) == LITERAL_for || LA(1) == LITERAL_order
5030:                            || LA(1) == LITERAL_having
5031:                            || LA(1) == LITERAL_using || LA(1) == LITERAL_group
5032:                            || LA(1) == CONCAT || LA(1) == LITERAL_or
5033:                            || LA(1) == LITERAL_and || LA(1) == LITERAL_when
5034:                            || LA(1) == LITERAL_then || LA(1) == LITERAL_else
5035:                            || LA(1) == LITERAL_end || LA(1) == LITERAL_left
5036:                            || LA(1) == LITERAL_right || LA(1) == LITERAL_cross
5037:                            || LA(1) == LITERAL_join
5038:                            || LA(1) == LITERAL_natural
5039:                            || LA(1) == LITERAL_union || LA(1) == LITERAL_inner
5040:                            || LA(1) == LITERAL_intersect
5041:                            || LA(1) == LITERAL_except || LA(1) == ID)
5042:                            && (LA(2) == EOF || LA(2) == LITERAL_create
5043:                                    || LA(2) == LITERAL_unique
5044:                                    || LA(2) == LITERAL_index
5045:                                    || LA(2) == LITERAL_temporary
5046:                                    || LA(2) == LITERAL_table
5047:                                    || LA(2) == LITERAL_view
5048:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
5049:                                    || LA(2) == RPAREN
5050:                                    || LA(2) == LITERAL_constraint
5051:                                    || LA(2) == LITERAL_primary
5052:                                    || LA(2) == LITERAL_foreign
5053:                                    || LA(2) == LITERAL_check
5054:                                    || LA(2) == LITERAL_first
5055:                                    || LA(2) == LITERAL_after
5056:                                    || LA(2) == LITERAL_default
5057:                                    || LA(2) == LITERAL_as
5058:                                    || LA(2) == LITERAL_with
5059:                                    || LA(2) == LITERAL_cascaded
5060:                                    || LA(2) == LITERAL_update
5061:                                    || LA(2) == COMMA || LA(2) == LITERAL_where
5062:                                    || LA(2) == EQ || LA(2) == LITERAL_delete
5063:                                    || LA(2) == LITERAL_from
5064:                                    || LA(2) == LITERAL_global
5065:                                    || LA(2) == LITERAL_local
5066:                                    || LA(2) == LITERAL_grant
5067:                                    || LA(2) == LITERAL_all
5068:                                    || LA(2) == LITERAL_select
5069:                                    || LA(2) == LITERAL_insert
5070:                                    || LA(2) == LITERAL_references
5071:                                    || LA(2) == LITERAL_usage
5072:                                    || LA(2) == LITERAL_not
5073:                                    || LA(2) == LITERAL_null
5074:                                    || LA(2) == LITERAL_key
5075:                                    || LA(2) == LITERAL_identity
5076:                                    || LA(2) == LITERAL_full
5077:                                    || LA(2) == LITERAL_initially
5078:                                    || LA(2) == LITERAL_deferred
5079:                                    || LA(2) == LITERAL_immediate
5080:                                    || LA(2) == LITERAL_deferrable
5081:                                    || LA(2) == LITERAL_bit
5082:                                    || LA(2) == LITERAL_varbinary
5083:                                    || LA(2) == LITERAL_binary
5084:                                    || LA(2) == LITERAL_blob
5085:                                    || LA(2) == LITERAL_clob
5086:                                    || LA(2) == LITERAL_character
5087:                                    || LA(2) == LITERAL_char
5088:                                    || LA(2) == LITERAL_varchar
5089:                                    || LA(2) == LITERAL_int
5090:                                    || LA(2) == LITERAL_integer
5091:                                    || LA(2) == LITERAL_smallint
5092:                                    || LA(2) == LITERAL_tinyint
5093:                                    || LA(2) == LITERAL_bigint
5094:                                    || LA(2) == LITERAL_dec
5095:                                    || LA(2) == LITERAL_decimal
5096:                                    || LA(2) == LITERAL_numeric
5097:                                    || LA(2) == LITERAL_real
5098:                                    || LA(2) == LITERAL_double
5099:                                    || LA(2) == LITERAL_float
5100:                                    || LA(2) == LITERAL_boolean
5101:                                    || LA(2) == LITERAL_date
5102:                                    || LA(2) == LITERAL_time
5103:                                    || LA(2) == LITERAL_timestamp
5104:                                    || LA(2) == LITERAL_interval
5105:                                    || LA(2) == LITERAL_for
5106:                                    || LA(2) == LITERAL_read
5107:                                    || LA(2) == LITERAL_order
5108:                                    || LA(2) == LITERAL_by || LA(2) == STAR
5109:                                    || LA(2) == LITERAL_having
5110:                                    || LA(2) == LITERAL_corresponding
5111:                                    || LA(2) == LITERAL_values
5112:                                    || LA(2) == LITERAL_using
5113:                                    || LA(2) == LITERAL_group
5114:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
5115:                                    || LA(2) == LITERAL_and
5116:                                    || LA(2) == LITERAL_is
5117:                                    || LA(2) == LITERAL_like
5118:                                    || LA(2) == LITERAL_between
5119:                                    || LA(2) == LITERAL_in
5120:                                    || LA(2) == LITERAL_exists
5121:                                    || LA(2) == LITERAL_escape || LA(2) == 120
5122:                                    || LA(2) == PLUS || LA(2) == MINUS
5123:                                    || LA(2) == STRING_LITERAL
5124:                                    || LA(2) == QUESTION || LA(2) == INT
5125:                                    || LA(2) == REAL || LA(2) == BINSTR
5126:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
5127:                                    || LA(2) == LITERAL_when
5128:                                    || LA(2) == LITERAL_then
5129:                                    || LA(2) == LITERAL_else
5130:                                    || LA(2) == LITERAL_end
5131:                                    || LA(2) == LITERAL_hour
5132:                                    || LA(2) == LITERAL_left
5133:                                    || LA(2) == LITERAL_minute
5134:                                    || LA(2) == LITERAL_month
5135:                                    || LA(2) == LITERAL_right
5136:                                    || LA(2) == LITERAL_second
5137:                                    || LA(2) == LITERAL_year
5138:                                    || LA(2) == LITERAL_user
5139:                                    || LA(2) == LITERAL_current_user
5140:                                    || LA(2) == LITERAL_session_user
5141:                                    || LA(2) == LITERAL_system_user
5142:                                    || LA(2) == LITERAL_current_date
5143:                                    || LA(2) == LITERAL_current_time
5144:                                    || LA(2) == LITERAL_current_timestamp
5145:                                    || LA(2) == LITERAL_sql_tsi_frac_second
5146:                                    || LA(2) == LITERAL_sql_tsi_second
5147:                                    || LA(2) == LITERAL_sql_tsi_minute
5148:                                    || LA(2) == LITERAL_sql_tsi_hour
5149:                                    || LA(2) == LITERAL_sql_tsi_day
5150:                                    || LA(2) == LITERAL_sql_tsi_week
5151:                                    || LA(2) == LITERAL_sql_tsi_month
5152:                                    || LA(2) == LITERAL_sql_tsi_quarter
5153:                                    || LA(2) == LITERAL_sql_tsi_year
5154:                                    || LA(2) == LITERAL_cast
5155:                                    || LA(2) == LITERAL_true
5156:                                    || LA(2) == LITERAL_false
5157:                                    || LA(2) == LITERAL_avg
5158:                                    || LA(2) == LITERAL_min
5159:                                    || LA(2) == LITERAL_max
5160:                                    || LA(2) == LITERAL_sum
5161:                                    || LA(2) == LITERAL_count || LA(2) == LT
5162:                                    || LA(2) == LE || LA(2) == GT
5163:                                    || LA(2) == GE || LA(2) == NE
5164:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
5165:                                    || LA(2) == LITERAL_join
5166:                                    || LA(2) == LITERAL_natural
5167:                                    || LA(2) == LITERAL_union
5168:                                    || LA(2) == LITERAL_inner
5169:                                    || LA(2) == LITERAL_outer
5170:                                    || LA(2) == LITERAL_intersect
5171:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
5172:                    } else {
5173:                        throw new NoViableAltException(LT(1), getFilename());
5174:                    }
5175:
5176:                }
5177:                return e;
5178:            }
5179:
5180:            public final TableExpression tableReference()
5181:                    throws RecognitionException, TokenStreamException {
5182:                TableExpression item;
5183:
5184:                item = null;
5185:
5186:                item = joinedTable();
5187:                return item;
5188:            }
5189:
5190:            public final TableExpression nonJoinQueryExpression()
5191:                    throws RecognitionException, TokenStreamException {
5192:                TableExpression item;
5193:
5194:                item = null;
5195:
5196:                switch (LA(1)) {
5197:                case LPAREN: {
5198:                    match(LPAREN);
5199:                    item = queryExpression();
5200:                    match(RPAREN);
5201:                    break;
5202:                }
5203:                case LITERAL_table:
5204:                case LITERAL_select:
5205:                case LITERAL_values: {
5206:                    item = simpleTable();
5207:                    break;
5208:                }
5209:                default: {
5210:                    throw new NoViableAltException(LT(1), getFilename());
5211:                }
5212:                }
5213:                return item;
5214:            }
5215:
5216:            public final TableExpression simpleTable()
5217:                    throws RecognitionException, TokenStreamException {
5218:                TableExpression item;
5219:
5220:                item = null;
5221:                String id = null;
5222:
5223:                switch (LA(1)) {
5224:                case LITERAL_select: {
5225:                    item = querySpecification();
5226:                    break;
5227:                }
5228:                case LITERAL_table: {
5229:                    match(LITERAL_table);
5230:                    id = sqlId();
5231:                    if (inputState.guessing == 0) {
5232:
5233:                        item = new SelectFromTable(qConn.resolveName(id));
5234:
5235:                    }
5236:                    break;
5237:                }
5238:                case LITERAL_values: {
5239:                    item = tableValueConstructor();
5240:                    break;
5241:                }
5242:                default: {
5243:                    throw new NoViableAltException(LT(1), getFilename());
5244:                }
5245:                }
5246:                return item;
5247:            }
5248:
5249:            public final TableExpression queryExpressionHead()
5250:                    throws RecognitionException, TokenStreamException {
5251:                TableExpression item;
5252:
5253:                item = null;
5254:
5255:                if ((LA(1) == LITERAL_table || LA(1) == LPAREN
5256:                        || LA(1) == LITERAL_select || LA(1) == LITERAL_values)
5257:                        && (LA(2) == LITERAL_unique || LA(2) == LITERAL_table
5258:                                || LA(2) == LPAREN || LA(2) == LITERAL_default
5259:                                || LA(2) == LITERAL_all
5260:                                || LA(2) == LITERAL_select
5261:                                || LA(2) == LITERAL_insert
5262:                                || LA(2) == LITERAL_not
5263:                                || LA(2) == LITERAL_null
5264:                                || LA(2) == LITERAL_char
5265:                                || LA(2) == LITERAL_date
5266:                                || LA(2) == LITERAL_time
5267:                                || LA(2) == LITERAL_timestamp
5268:                                || LA(2) == LITERAL_interval
5269:                                || LA(2) == LITERAL_distinct || LA(2) == STAR
5270:                                || LA(2) == LITERAL_values
5271:                                || LA(2) == LITERAL_exists || LA(2) == PLUS
5272:                                || LA(2) == MINUS || LA(2) == STRING_LITERAL
5273:                                || LA(2) == QUESTION || LA(2) == INT
5274:                                || LA(2) == REAL || LA(2) == BINSTR
5275:                                || LA(2) == HEXSTR || LA(2) == LITERAL_case
5276:                                || LA(2) == LITERAL_hour
5277:                                || LA(2) == LITERAL_left
5278:                                || LA(2) == LITERAL_minute
5279:                                || LA(2) == LITERAL_month
5280:                                || LA(2) == LITERAL_right
5281:                                || LA(2) == LITERAL_second
5282:                                || LA(2) == LITERAL_year
5283:                                || LA(2) == LITERAL_user
5284:                                || LA(2) == LITERAL_current_user
5285:                                || LA(2) == LITERAL_session_user
5286:                                || LA(2) == LITERAL_system_user
5287:                                || LA(2) == LITERAL_current_date
5288:                                || LA(2) == LITERAL_current_time
5289:                                || LA(2) == LITERAL_current_timestamp
5290:                                || LA(2) == LITERAL_sql_tsi_frac_second
5291:                                || LA(2) == LITERAL_sql_tsi_second
5292:                                || LA(2) == LITERAL_sql_tsi_minute
5293:                                || LA(2) == LITERAL_sql_tsi_hour
5294:                                || LA(2) == LITERAL_sql_tsi_day
5295:                                || LA(2) == LITERAL_sql_tsi_week
5296:                                || LA(2) == LITERAL_sql_tsi_month
5297:                                || LA(2) == LITERAL_sql_tsi_quarter
5298:                                || LA(2) == LITERAL_sql_tsi_year
5299:                                || LA(2) == LITERAL_cast
5300:                                || LA(2) == LITERAL_true
5301:                                || LA(2) == LITERAL_false
5302:                                || LA(2) == LITERAL_avg || LA(2) == LITERAL_min
5303:                                || LA(2) == LITERAL_max || LA(2) == LITERAL_sum
5304:                                || LA(2) == LITERAL_count || LA(2) == ID)) {
5305:                    item = nonJoinQueryExpression();
5306:                } else if ((LA(1) == LPAREN || LA(1) == ID)
5307:                        && (LA(2) == EOF || LA(2) == LITERAL_create
5308:                                || LA(2) == LITERAL_unique
5309:                                || LA(2) == LITERAL_table
5310:                                || LA(2) == LITERAL_on || LA(2) == LPAREN
5311:                                || LA(2) == RPAREN
5312:                                || LA(2) == LITERAL_constraint
5313:                                || LA(2) == LITERAL_primary
5314:                                || LA(2) == LITERAL_check
5315:                                || LA(2) == LITERAL_first
5316:                                || LA(2) == LITERAL_after
5317:                                || LA(2) == LITERAL_default
5318:                                || LA(2) == LITERAL_as || LA(2) == LITERAL_with
5319:                                || LA(2) == COMMA || LA(2) == LITERAL_where
5320:                                || LA(2) == LITERAL_from
5321:                                || LA(2) == LITERAL_grant
5322:                                || LA(2) == LITERAL_select
5323:                                || LA(2) == LITERAL_references
5324:                                || LA(2) == LITERAL_not
5325:                                || LA(2) == LITERAL_full
5326:                                || LA(2) == LITERAL_initially
5327:                                || LA(2) == LITERAL_deferrable
5328:                                || LA(2) == LITERAL_for
5329:                                || LA(2) == LITERAL_order
5330:                                || LA(2) == LITERAL_having
5331:                                || LA(2) == LITERAL_values
5332:                                || LA(2) == LITERAL_using
5333:                                || LA(2) == LITERAL_group || LA(2) == CONCAT
5334:                                || LA(2) == LITERAL_or || LA(2) == LITERAL_and
5335:                                || LA(2) == LITERAL_when
5336:                                || LA(2) == LITERAL_then
5337:                                || LA(2) == LITERAL_else
5338:                                || LA(2) == LITERAL_end
5339:                                || LA(2) == LITERAL_left
5340:                                || LA(2) == LITERAL_right
5341:                                || LA(2) == LITERAL_cross
5342:                                || LA(2) == LITERAL_join
5343:                                || LA(2) == LITERAL_natural
5344:                                || LA(2) == LITERAL_union
5345:                                || LA(2) == LITERAL_inner
5346:                                || LA(2) == LITERAL_intersect
5347:                                || LA(2) == LITERAL_except || LA(2) == ID)) {
5348:                    item = joinedTable();
5349:                } else {
5350:                    throw new NoViableAltException(LT(1), getFilename());
5351:                }
5352:
5353:                return item;
5354:            }
5355:
5356:            public final TableExpression joinedTable()
5357:                    throws RecognitionException, TokenStreamException {
5358:                TableExpression item;
5359:
5360:                item = null;
5361:                JoinedTable jt = null;
5362:                int type = -1;
5363:                TableExpression s1 = null;
5364:                TableExpression s2 = null;
5365:
5366:                if ((LA(1) == LPAREN || LA(1) == ID)
5367:                        && (LA(2) == EOF || LA(2) == LITERAL_create
5368:                                || LA(2) == LITERAL_unique
5369:                                || LA(2) == LITERAL_table
5370:                                || LA(2) == LITERAL_on || LA(2) == LPAREN
5371:                                || LA(2) == RPAREN
5372:                                || LA(2) == LITERAL_constraint
5373:                                || LA(2) == LITERAL_primary
5374:                                || LA(2) == LITERAL_check
5375:                                || LA(2) == LITERAL_first
5376:                                || LA(2) == LITERAL_after
5377:                                || LA(2) == LITERAL_default
5378:                                || LA(2) == LITERAL_as || LA(2) == LITERAL_with
5379:                                || LA(2) == COMMA || LA(2) == LITERAL_where
5380:                                || LA(2) == LITERAL_from
5381:                                || LA(2) == LITERAL_grant
5382:                                || LA(2) == LITERAL_select
5383:                                || LA(2) == LITERAL_references
5384:                                || LA(2) == LITERAL_not
5385:                                || LA(2) == LITERAL_full
5386:                                || LA(2) == LITERAL_initially
5387:                                || LA(2) == LITERAL_deferrable
5388:                                || LA(2) == LITERAL_for
5389:                                || LA(2) == LITERAL_order
5390:                                || LA(2) == LITERAL_having
5391:                                || LA(2) == LITERAL_values
5392:                                || LA(2) == LITERAL_using
5393:                                || LA(2) == LITERAL_group || LA(2) == CONCAT
5394:                                || LA(2) == LITERAL_or || LA(2) == LITERAL_and
5395:                                || LA(2) == LITERAL_when
5396:                                || LA(2) == LITERAL_then
5397:                                || LA(2) == LITERAL_else
5398:                                || LA(2) == LITERAL_end
5399:                                || LA(2) == LITERAL_left
5400:                                || LA(2) == LITERAL_right
5401:                                || LA(2) == LITERAL_cross
5402:                                || LA(2) == LITERAL_join
5403:                                || LA(2) == LITERAL_natural
5404:                                || LA(2) == LITERAL_union
5405:                                || LA(2) == LITERAL_inner
5406:                                || LA(2) == LITERAL_intersect
5407:                                || LA(2) == LITERAL_except || LA(2) == ID)) {
5408:                    item = tableReferencePrimary();
5409:                    {
5410:                        _loop219: do {
5411:                            if ((LA(1) == LITERAL_full || LA(1) == LITERAL_left
5412:                                    || LA(1) == LITERAL_right
5413:                                    || LA(1) == LITERAL_cross
5414:                                    || LA(1) == LITERAL_join
5415:                                    || LA(1) == LITERAL_natural
5416:                                    || LA(1) == LITERAL_union || LA(1) == LITERAL_inner)
5417:                                    && (LA(2) == LPAREN
5418:                                            || LA(2) == LITERAL_full
5419:                                            || LA(2) == LITERAL_left
5420:                                            || LA(2) == LITERAL_right
5421:                                            || LA(2) == LITERAL_join
5422:                                            || LA(2) == LITERAL_inner
5423:                                            || LA(2) == LITERAL_outer || LA(2) == ID)) {
5424:                                type = joinSpec();
5425:                                s2 = tableReference();
5426:                                if (inputState.guessing == 0) {
5427:
5428:                                    item = jt = new JoinedTable(type, item, s2);
5429:
5430:                                }
5431:                                joinModifiers(jt);
5432:                                if (inputState.guessing == 0) {
5433:
5434:                                    jt.checkSyntax();
5435:
5436:                                }
5437:                            } else {
5438:                                break _loop219;
5439:                            }
5440:
5441:                        } while (true);
5442:                    }
5443:                } else if ((LA(1) == LPAREN)
5444:                        && (LA(2) == LPAREN || LA(2) == ID)) {
5445:                    match(LPAREN);
5446:                    item = joinedTable();
5447:                    match(RPAREN);
5448:                } else {
5449:                    throw new NoViableAltException(LT(1), getFilename());
5450:                }
5451:
5452:                return item;
5453:            }
5454:
5455:            public final int combine() throws RecognitionException,
5456:                    TokenStreamException {
5457:                int type;
5458:
5459:                type = 0;
5460:
5461:                {
5462:                    switch (LA(1)) {
5463:                    case LITERAL_union: {
5464:                        match(LITERAL_union);
5465:                        if (inputState.guessing == 0) {
5466:                            type = Op.UNION;
5467:                        }
5468:                        break;
5469:                    }
5470:                    case LITERAL_intersect: {
5471:                        match(LITERAL_intersect);
5472:                        if (inputState.guessing == 0) {
5473:                            type = Op.INTERSECT;
5474:                        }
5475:                        break;
5476:                    }
5477:                    case LITERAL_except: {
5478:                        match(LITERAL_except);
5479:                        if (inputState.guessing == 0) {
5480:                            type = Op.EXCEPT;
5481:                        }
5482:                        break;
5483:                    }
5484:                    default: {
5485:                        throw new NoViableAltException(LT(1), getFilename());
5486:                    }
5487:                    }
5488:                }
5489:                return type;
5490:            }
5491:
5492:            public final VectorExpression tableValueConstructor()
5493:                    throws RecognitionException, TokenStreamException {
5494:                VectorExpression e;
5495:
5496:                e = null;
5497:                VectorExpression f = null;
5498:
5499:                match(LITERAL_values);
5500:                f = vectorExpression();
5501:                if (inputState.guessing == 0) {
5502:
5503:                    e = new VectorExpression();
5504:                    e.addElement(f);
5505:
5506:                }
5507:                {
5508:                    _loop329: do {
5509:                        if ((LA(1) == COMMA) && (LA(2) == LPAREN)) {
5510:                            match(COMMA);
5511:                            f = vectorExpression();
5512:                            if (inputState.guessing == 0) {
5513:
5514:                                e.addElement(f);
5515:
5516:                            }
5517:                        } else {
5518:                            break _loop329;
5519:                        }
5520:
5521:                    } while (true);
5522:                }
5523:                return e;
5524:            }
5525:
5526:            public final TableExpression tableReferencePrimary()
5527:                    throws RecognitionException, TokenStreamException {
5528:                TableExpression item;
5529:
5530:                item = null;
5531:                Vector columns = null;
5532:                String id = null;
5533:                String id2 = null;
5534:
5535:                {
5536:                    switch (LA(1)) {
5537:                    case ID: {
5538:                        id = sqlId();
5539:                        if (inputState.guessing == 0) {
5540:
5541:                            id = qConn.resolveName(id);
5542:                            item = new SelectFromTable(id);
5543:
5544:                        }
5545:                        break;
5546:                    }
5547:                    case LPAREN: {
5548:                        match(LPAREN);
5549:                        item = queryExpression();
5550:                        match(RPAREN);
5551:                        break;
5552:                    }
5553:                    default: {
5554:                        throw new NoViableAltException(LT(1), getFilename());
5555:                    }
5556:                    }
5557:                }
5558:                {
5559:                    if ((LA(1) == LITERAL_as || LA(1) == ID)
5560:                            && (LA(2) == EOF || LA(2) == LITERAL_create
5561:                                    || LA(2) == LITERAL_unique
5562:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
5563:                                    || LA(2) == RPAREN
5564:                                    || LA(2) == LITERAL_constraint
5565:                                    || LA(2) == LITERAL_primary
5566:                                    || LA(2) == LITERAL_check
5567:                                    || LA(2) == LITERAL_first
5568:                                    || LA(2) == LITERAL_after
5569:                                    || LA(2) == LITERAL_default
5570:                                    || LA(2) == LITERAL_as
5571:                                    || LA(2) == LITERAL_with || LA(2) == COMMA
5572:                                    || LA(2) == LITERAL_where
5573:                                    || LA(2) == LITERAL_from
5574:                                    || LA(2) == LITERAL_grant
5575:                                    || LA(2) == LITERAL_references
5576:                                    || LA(2) == LITERAL_not
5577:                                    || LA(2) == LITERAL_full
5578:                                    || LA(2) == LITERAL_initially
5579:                                    || LA(2) == LITERAL_deferrable
5580:                                    || LA(2) == LITERAL_for
5581:                                    || LA(2) == LITERAL_order
5582:                                    || LA(2) == LITERAL_having
5583:                                    || LA(2) == LITERAL_using
5584:                                    || LA(2) == LITERAL_group
5585:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
5586:                                    || LA(2) == LITERAL_and
5587:                                    || LA(2) == LITERAL_when
5588:                                    || LA(2) == LITERAL_then
5589:                                    || LA(2) == LITERAL_else
5590:                                    || LA(2) == LITERAL_end
5591:                                    || LA(2) == LITERAL_left
5592:                                    || LA(2) == LITERAL_right
5593:                                    || LA(2) == LITERAL_cross
5594:                                    || LA(2) == LITERAL_join
5595:                                    || LA(2) == LITERAL_natural
5596:                                    || LA(2) == LITERAL_union
5597:                                    || LA(2) == LITERAL_inner
5598:                                    || LA(2) == LITERAL_intersect
5599:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
5600:                        {
5601:                            switch (LA(1)) {
5602:                            case LITERAL_as: {
5603:                                match(LITERAL_as);
5604:                                break;
5605:                            }
5606:                            case ID: {
5607:                                break;
5608:                            }
5609:                            default: {
5610:                                throw new NoViableAltException(LT(1),
5611:                                        getFilename());
5612:                            }
5613:                            }
5614:                        }
5615:                        id2 = sqlId();
5616:                        {
5617:                            switch (LA(1)) {
5618:                            case LPAREN: {
5619:                                match(LPAREN);
5620:                                columns = idList();
5621:                                match(RPAREN);
5622:                                break;
5623:                            }
5624:                            case EOF:
5625:                            case LITERAL_create:
5626:                            case LITERAL_unique:
5627:                            case LITERAL_on:
5628:                            case RPAREN:
5629:                            case LITERAL_constraint:
5630:                            case LITERAL_primary:
5631:                            case LITERAL_check:
5632:                            case LITERAL_first:
5633:                            case LITERAL_after:
5634:                            case LITERAL_default:
5635:                            case LITERAL_as:
5636:                            case LITERAL_with:
5637:                            case COMMA:
5638:                            case LITERAL_where:
5639:                            case LITERAL_from:
5640:                            case LITERAL_grant:
5641:                            case LITERAL_references:
5642:                            case LITERAL_not:
5643:                            case LITERAL_full:
5644:                            case LITERAL_initially:
5645:                            case LITERAL_deferrable:
5646:                            case LITERAL_for:
5647:                            case LITERAL_order:
5648:                            case LITERAL_having:
5649:                            case LITERAL_using:
5650:                            case LITERAL_group:
5651:                            case CONCAT:
5652:                            case LITERAL_or:
5653:                            case LITERAL_and:
5654:                            case LITERAL_when:
5655:                            case LITERAL_then:
5656:                            case LITERAL_else:
5657:                            case LITERAL_end:
5658:                            case LITERAL_left:
5659:                            case LITERAL_right:
5660:                            case LITERAL_cross:
5661:                            case LITERAL_join:
5662:                            case LITERAL_natural:
5663:                            case LITERAL_union:
5664:                            case LITERAL_inner:
5665:                            case LITERAL_intersect:
5666:                            case LITERAL_except:
5667:                            case ID: {
5668:                                break;
5669:                            }
5670:                            default: {
5671:                                throw new NoViableAltException(LT(1),
5672:                                        getFilename());
5673:                            }
5674:                            }
5675:                        }
5676:                        if (inputState.guessing == 0) {
5677:
5678:                            item = new SelectFromItem(item, id2, columns);
5679:
5680:                        }
5681:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_create
5682:                            || LA(1) == LITERAL_unique || LA(1) == LITERAL_on
5683:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
5684:                            || LA(1) == LITERAL_primary
5685:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
5686:                            || LA(1) == LITERAL_after
5687:                            || LA(1) == LITERAL_default || LA(1) == LITERAL_as
5688:                            || LA(1) == LITERAL_with || LA(1) == COMMA
5689:                            || LA(1) == LITERAL_where || LA(1) == LITERAL_from
5690:                            || LA(1) == LITERAL_grant
5691:                            || LA(1) == LITERAL_references
5692:                            || LA(1) == LITERAL_not || LA(1) == LITERAL_full
5693:                            || LA(1) == LITERAL_initially
5694:                            || LA(1) == LITERAL_deferrable
5695:                            || LA(1) == LITERAL_for || LA(1) == LITERAL_order
5696:                            || LA(1) == LITERAL_having
5697:                            || LA(1) == LITERAL_using || LA(1) == LITERAL_group
5698:                            || LA(1) == CONCAT || LA(1) == LITERAL_or
5699:                            || LA(1) == LITERAL_and || LA(1) == LITERAL_when
5700:                            || LA(1) == LITERAL_then || LA(1) == LITERAL_else
5701:                            || LA(1) == LITERAL_end || LA(1) == LITERAL_left
5702:                            || LA(1) == LITERAL_right || LA(1) == LITERAL_cross
5703:                            || LA(1) == LITERAL_join
5704:                            || LA(1) == LITERAL_natural
5705:                            || LA(1) == LITERAL_union || LA(1) == LITERAL_inner
5706:                            || LA(1) == LITERAL_intersect
5707:                            || LA(1) == LITERAL_except || LA(1) == ID)
5708:                            && (LA(2) == EOF || LA(2) == LITERAL_create
5709:                                    || LA(2) == LITERAL_unique
5710:                                    || LA(2) == LITERAL_index
5711:                                    || LA(2) == LITERAL_temporary
5712:                                    || LA(2) == LITERAL_table
5713:                                    || LA(2) == LITERAL_view
5714:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
5715:                                    || LA(2) == RPAREN
5716:                                    || LA(2) == LITERAL_constraint
5717:                                    || LA(2) == LITERAL_primary
5718:                                    || LA(2) == LITERAL_foreign
5719:                                    || LA(2) == LITERAL_check
5720:                                    || LA(2) == LITERAL_first
5721:                                    || LA(2) == LITERAL_after
5722:                                    || LA(2) == LITERAL_default
5723:                                    || LA(2) == LITERAL_as
5724:                                    || LA(2) == LITERAL_with
5725:                                    || LA(2) == LITERAL_cascaded
5726:                                    || LA(2) == LITERAL_update
5727:                                    || LA(2) == COMMA || LA(2) == LITERAL_where
5728:                                    || LA(2) == EQ || LA(2) == LITERAL_delete
5729:                                    || LA(2) == LITERAL_from
5730:                                    || LA(2) == LITERAL_global
5731:                                    || LA(2) == LITERAL_local
5732:                                    || LA(2) == LITERAL_grant
5733:                                    || LA(2) == LITERAL_all
5734:                                    || LA(2) == LITERAL_select
5735:                                    || LA(2) == LITERAL_insert
5736:                                    || LA(2) == LITERAL_references
5737:                                    || LA(2) == LITERAL_usage
5738:                                    || LA(2) == LITERAL_not
5739:                                    || LA(2) == LITERAL_null
5740:                                    || LA(2) == LITERAL_key
5741:                                    || LA(2) == LITERAL_identity
5742:                                    || LA(2) == LITERAL_full
5743:                                    || LA(2) == LITERAL_initially
5744:                                    || LA(2) == LITERAL_deferred
5745:                                    || LA(2) == LITERAL_immediate
5746:                                    || LA(2) == LITERAL_deferrable
5747:                                    || LA(2) == LITERAL_bit
5748:                                    || LA(2) == LITERAL_varbinary
5749:                                    || LA(2) == LITERAL_binary
5750:                                    || LA(2) == LITERAL_blob
5751:                                    || LA(2) == LITERAL_clob
5752:                                    || LA(2) == LITERAL_character
5753:                                    || LA(2) == LITERAL_char
5754:                                    || LA(2) == LITERAL_varchar
5755:                                    || LA(2) == LITERAL_int
5756:                                    || LA(2) == LITERAL_integer
5757:                                    || LA(2) == LITERAL_smallint
5758:                                    || LA(2) == LITERAL_tinyint
5759:                                    || LA(2) == LITERAL_bigint
5760:                                    || LA(2) == LITERAL_dec
5761:                                    || LA(2) == LITERAL_decimal
5762:                                    || LA(2) == LITERAL_numeric
5763:                                    || LA(2) == LITERAL_real
5764:                                    || LA(2) == LITERAL_double
5765:                                    || LA(2) == LITERAL_float
5766:                                    || LA(2) == LITERAL_boolean
5767:                                    || LA(2) == LITERAL_date
5768:                                    || LA(2) == LITERAL_time
5769:                                    || LA(2) == LITERAL_timestamp
5770:                                    || LA(2) == LITERAL_interval
5771:                                    || LA(2) == LITERAL_for
5772:                                    || LA(2) == LITERAL_read
5773:                                    || LA(2) == LITERAL_order
5774:                                    || LA(2) == LITERAL_by || LA(2) == STAR
5775:                                    || LA(2) == LITERAL_having
5776:                                    || LA(2) == LITERAL_corresponding
5777:                                    || LA(2) == LITERAL_values
5778:                                    || LA(2) == LITERAL_using
5779:                                    || LA(2) == LITERAL_group
5780:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
5781:                                    || LA(2) == LITERAL_and
5782:                                    || LA(2) == LITERAL_is
5783:                                    || LA(2) == LITERAL_like
5784:                                    || LA(2) == LITERAL_between
5785:                                    || LA(2) == LITERAL_in
5786:                                    || LA(2) == LITERAL_exists
5787:                                    || LA(2) == LITERAL_escape || LA(2) == 120
5788:                                    || LA(2) == PLUS || LA(2) == MINUS
5789:                                    || LA(2) == STRING_LITERAL
5790:                                    || LA(2) == QUESTION || LA(2) == INT
5791:                                    || LA(2) == REAL || LA(2) == BINSTR
5792:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
5793:                                    || LA(2) == LITERAL_when
5794:                                    || LA(2) == LITERAL_then
5795:                                    || LA(2) == LITERAL_else
5796:                                    || LA(2) == LITERAL_end
5797:                                    || LA(2) == LITERAL_hour
5798:                                    || LA(2) == LITERAL_left
5799:                                    || LA(2) == LITERAL_minute
5800:                                    || LA(2) == LITERAL_month
5801:                                    || LA(2) == LITERAL_right
5802:                                    || LA(2) == LITERAL_second
5803:                                    || LA(2) == LITERAL_year
5804:                                    || LA(2) == LITERAL_user
5805:                                    || LA(2) == LITERAL_current_user
5806:                                    || LA(2) == LITERAL_session_user
5807:                                    || LA(2) == LITERAL_system_user
5808:                                    || LA(2) == LITERAL_current_date
5809:                                    || LA(2) == LITERAL_current_time
5810:                                    || LA(2) == LITERAL_current_timestamp
5811:                                    || LA(2) == LITERAL_sql_tsi_frac_second
5812:                                    || LA(2) == LITERAL_sql_tsi_second
5813:                                    || LA(2) == LITERAL_sql_tsi_minute
5814:                                    || LA(2) == LITERAL_sql_tsi_hour
5815:                                    || LA(2) == LITERAL_sql_tsi_day
5816:                                    || LA(2) == LITERAL_sql_tsi_week
5817:                                    || LA(2) == LITERAL_sql_tsi_month
5818:                                    || LA(2) == LITERAL_sql_tsi_quarter
5819:                                    || LA(2) == LITERAL_sql_tsi_year
5820:                                    || LA(2) == LITERAL_cast
5821:                                    || LA(2) == LITERAL_true
5822:                                    || LA(2) == LITERAL_false
5823:                                    || LA(2) == LITERAL_avg
5824:                                    || LA(2) == LITERAL_min
5825:                                    || LA(2) == LITERAL_max
5826:                                    || LA(2) == LITERAL_sum
5827:                                    || LA(2) == LITERAL_count || LA(2) == LT
5828:                                    || LA(2) == LE || LA(2) == GT
5829:                                    || LA(2) == GE || LA(2) == NE
5830:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
5831:                                    || LA(2) == LITERAL_join
5832:                                    || LA(2) == LITERAL_natural
5833:                                    || LA(2) == LITERAL_union
5834:                                    || LA(2) == LITERAL_inner
5835:                                    || LA(2) == LITERAL_outer
5836:                                    || LA(2) == LITERAL_intersect
5837:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
5838:                    } else {
5839:                        throw new NoViableAltException(LT(1), getFilename());
5840:                    }
5841:
5842:                }
5843:                return item;
5844:            }
5845:
5846:            public final int joinSpec() throws RecognitionException,
5847:                    TokenStreamException {
5848:                int type;
5849:
5850:                type = 0;
5851:                int t = 0;
5852:
5853:                switch (LA(1)) {
5854:                case LITERAL_cross: {
5855:                    match(LITERAL_cross);
5856:                    match(LITERAL_join);
5857:                    if (inputState.guessing == 0) {
5858:                        type = Op.CROSS;
5859:                    }
5860:                    break;
5861:                }
5862:                case LITERAL_full:
5863:                case LITERAL_left:
5864:                case LITERAL_right:
5865:                case LITERAL_join:
5866:                case LITERAL_natural:
5867:                case LITERAL_inner: {
5868:                    {
5869:                        switch (LA(1)) {
5870:                        case LITERAL_natural: {
5871:                            match(LITERAL_natural);
5872:                            if (inputState.guessing == 0) {
5873:                                t = Op.NATURAL;
5874:                            }
5875:                            break;
5876:                        }
5877:                        case LITERAL_full:
5878:                        case LITERAL_left:
5879:                        case LITERAL_right:
5880:                        case LITERAL_join:
5881:                        case LITERAL_inner: {
5882:                            break;
5883:                        }
5884:                        default: {
5885:                            throw new NoViableAltException(LT(1), getFilename());
5886:                        }
5887:                        }
5888:                    }
5889:                    type = joinType();
5890:                    match(LITERAL_join);
5891:                    if (inputState.guessing == 0) {
5892:                        type |= t;
5893:                    }
5894:                    break;
5895:                }
5896:                case LITERAL_union: {
5897:                    match(LITERAL_union);
5898:                    match(LITERAL_join);
5899:                    if (inputState.guessing == 0) {
5900:                        type = Op.UNION;
5901:                    }
5902:                    break;
5903:                }
5904:                default: {
5905:                    throw new NoViableAltException(LT(1), getFilename());
5906:                }
5907:                }
5908:                return type;
5909:            }
5910:
5911:            public final void joinModifiers(JoinedTable jt)
5912:                    throws RecognitionException, TokenStreamException {
5913:
5914:                Vector names = null;
5915:                Expression predicate = null;
5916:
5917:                boolean synPredMatched222 = false;
5918:                if (((LA(1) == LITERAL_using) && (LA(2) == LPAREN))) {
5919:                    int _m222 = mark();
5920:                    synPredMatched222 = true;
5921:                    inputState.guessing++;
5922:                    try {
5923:                        {
5924:                            match(LITERAL_using);
5925:                        }
5926:                    } catch (RecognitionException pe) {
5927:                        synPredMatched222 = false;
5928:                    }
5929:                    rewind(_m222);
5930:                    inputState.guessing--;
5931:                }
5932:                if (synPredMatched222) {
5933:                    {
5934:                        match(LITERAL_using);
5935:                        match(LPAREN);
5936:                        names = idList();
5937:                        match(RPAREN);
5938:                        if (inputState.guessing == 0) {
5939:
5940:                            jt.setUsingList(names);
5941:
5942:                        }
5943:                    }
5944:                } else {
5945:                    boolean synPredMatched225 = false;
5946:                    if (((LA(1) == LITERAL_on) && (LA(2) == LITERAL_unique
5947:                            || LA(2) == LPAREN || LA(2) == LITERAL_default
5948:                            || LA(2) == LITERAL_insert || LA(2) == LITERAL_not
5949:                            || LA(2) == LITERAL_null || LA(2) == LITERAL_char
5950:                            || LA(2) == LITERAL_date || LA(2) == LITERAL_time
5951:                            || LA(2) == LITERAL_timestamp
5952:                            || LA(2) == LITERAL_interval
5953:                            || LA(2) == LITERAL_exists || LA(2) == PLUS
5954:                            || LA(2) == MINUS || LA(2) == STRING_LITERAL
5955:                            || LA(2) == QUESTION || LA(2) == INT
5956:                            || LA(2) == REAL || LA(2) == BINSTR
5957:                            || LA(2) == HEXSTR || LA(2) == LITERAL_case
5958:                            || LA(2) == LITERAL_hour || LA(2) == LITERAL_left
5959:                            || LA(2) == LITERAL_minute
5960:                            || LA(2) == LITERAL_month || LA(2) == LITERAL_right
5961:                            || LA(2) == LITERAL_second || LA(2) == LITERAL_year
5962:                            || LA(2) == LITERAL_user
5963:                            || LA(2) == LITERAL_current_user
5964:                            || LA(2) == LITERAL_session_user
5965:                            || LA(2) == LITERAL_system_user
5966:                            || LA(2) == LITERAL_current_date
5967:                            || LA(2) == LITERAL_current_time
5968:                            || LA(2) == LITERAL_current_timestamp
5969:                            || LA(2) == LITERAL_sql_tsi_frac_second
5970:                            || LA(2) == LITERAL_sql_tsi_second
5971:                            || LA(2) == LITERAL_sql_tsi_minute
5972:                            || LA(2) == LITERAL_sql_tsi_hour
5973:                            || LA(2) == LITERAL_sql_tsi_day
5974:                            || LA(2) == LITERAL_sql_tsi_week
5975:                            || LA(2) == LITERAL_sql_tsi_month
5976:                            || LA(2) == LITERAL_sql_tsi_quarter
5977:                            || LA(2) == LITERAL_sql_tsi_year
5978:                            || LA(2) == LITERAL_cast || LA(2) == LITERAL_true
5979:                            || LA(2) == LITERAL_false || LA(2) == LITERAL_avg
5980:                            || LA(2) == LITERAL_min || LA(2) == LITERAL_max
5981:                            || LA(2) == LITERAL_sum || LA(2) == LITERAL_count || LA(2) == ID))) {
5982:                        int _m225 = mark();
5983:                        synPredMatched225 = true;
5984:                        inputState.guessing++;
5985:                        try {
5986:                            {
5987:                                match(LITERAL_on);
5988:                            }
5989:                        } catch (RecognitionException pe) {
5990:                            synPredMatched225 = false;
5991:                        }
5992:                        rewind(_m225);
5993:                        inputState.guessing--;
5994:                    }
5995:                    if (synPredMatched225) {
5996:                        {
5997:                            match(LITERAL_on);
5998:                            predicate = expression();
5999:                            if (inputState.guessing == 0) {
6000:
6001:                                jt.setOnExpression(predicate);
6002:
6003:                            }
6004:                        }
6005:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_create
6006:                            || LA(1) == LITERAL_unique || LA(1) == LITERAL_on
6007:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
6008:                            || LA(1) == LITERAL_primary
6009:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
6010:                            || LA(1) == LITERAL_after
6011:                            || LA(1) == LITERAL_default || LA(1) == LITERAL_as
6012:                            || LA(1) == LITERAL_with || LA(1) == COMMA
6013:                            || LA(1) == LITERAL_where || LA(1) == LITERAL_from
6014:                            || LA(1) == LITERAL_grant
6015:                            || LA(1) == LITERAL_references
6016:                            || LA(1) == LITERAL_not || LA(1) == LITERAL_full
6017:                            || LA(1) == LITERAL_initially
6018:                            || LA(1) == LITERAL_deferrable
6019:                            || LA(1) == LITERAL_for || LA(1) == LITERAL_order
6020:                            || LA(1) == LITERAL_having
6021:                            || LA(1) == LITERAL_using || LA(1) == LITERAL_group
6022:                            || LA(1) == CONCAT || LA(1) == LITERAL_or
6023:                            || LA(1) == LITERAL_and || LA(1) == LITERAL_when
6024:                            || LA(1) == LITERAL_then || LA(1) == LITERAL_else
6025:                            || LA(1) == LITERAL_end || LA(1) == LITERAL_left
6026:                            || LA(1) == LITERAL_right || LA(1) == LITERAL_cross
6027:                            || LA(1) == LITERAL_join
6028:                            || LA(1) == LITERAL_natural
6029:                            || LA(1) == LITERAL_union || LA(1) == LITERAL_inner
6030:                            || LA(1) == LITERAL_intersect
6031:                            || LA(1) == LITERAL_except || LA(1) == ID)
6032:                            && (LA(2) == EOF || LA(2) == LITERAL_create
6033:                                    || LA(2) == LITERAL_unique
6034:                                    || LA(2) == LITERAL_index
6035:                                    || LA(2) == LITERAL_temporary
6036:                                    || LA(2) == LITERAL_table
6037:                                    || LA(2) == LITERAL_view
6038:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
6039:                                    || LA(2) == RPAREN
6040:                                    || LA(2) == LITERAL_constraint
6041:                                    || LA(2) == LITERAL_primary
6042:                                    || LA(2) == LITERAL_foreign
6043:                                    || LA(2) == LITERAL_check
6044:                                    || LA(2) == LITERAL_first
6045:                                    || LA(2) == LITERAL_after
6046:                                    || LA(2) == LITERAL_default
6047:                                    || LA(2) == LITERAL_as
6048:                                    || LA(2) == LITERAL_with
6049:                                    || LA(2) == LITERAL_cascaded
6050:                                    || LA(2) == LITERAL_update
6051:                                    || LA(2) == COMMA || LA(2) == LITERAL_where
6052:                                    || LA(2) == EQ || LA(2) == LITERAL_delete
6053:                                    || LA(2) == LITERAL_from
6054:                                    || LA(2) == LITERAL_global
6055:                                    || LA(2) == LITERAL_local
6056:                                    || LA(2) == LITERAL_grant
6057:                                    || LA(2) == LITERAL_all
6058:                                    || LA(2) == LITERAL_select
6059:                                    || LA(2) == LITERAL_insert
6060:                                    || LA(2) == LITERAL_references
6061:                                    || LA(2) == LITERAL_usage
6062:                                    || LA(2) == LITERAL_not
6063:                                    || LA(2) == LITERAL_null
6064:                                    || LA(2) == LITERAL_key
6065:                                    || LA(2) == LITERAL_identity
6066:                                    || LA(2) == LITERAL_full
6067:                                    || LA(2) == LITERAL_initially
6068:                                    || LA(2) == LITERAL_deferred
6069:                                    || LA(2) == LITERAL_immediate
6070:                                    || LA(2) == LITERAL_deferrable
6071:                                    || LA(2) == LITERAL_bit
6072:                                    || LA(2) == LITERAL_varbinary
6073:                                    || LA(2) == LITERAL_binary
6074:                                    || LA(2) == LITERAL_blob
6075:                                    || LA(2) == LITERAL_clob
6076:                                    || LA(2) == LITERAL_character
6077:                                    || LA(2) == LITERAL_char
6078:                                    || LA(2) == LITERAL_varchar
6079:                                    || LA(2) == LITERAL_int
6080:                                    || LA(2) == LITERAL_integer
6081:                                    || LA(2) == LITERAL_smallint
6082:                                    || LA(2) == LITERAL_tinyint
6083:                                    || LA(2) == LITERAL_bigint
6084:                                    || LA(2) == LITERAL_dec
6085:                                    || LA(2) == LITERAL_decimal
6086:                                    || LA(2) == LITERAL_numeric
6087:                                    || LA(2) == LITERAL_real
6088:                                    || LA(2) == LITERAL_double
6089:                                    || LA(2) == LITERAL_float
6090:                                    || LA(2) == LITERAL_boolean
6091:                                    || LA(2) == LITERAL_date
6092:                                    || LA(2) == LITERAL_time
6093:                                    || LA(2) == LITERAL_timestamp
6094:                                    || LA(2) == LITERAL_interval
6095:                                    || LA(2) == LITERAL_for
6096:                                    || LA(2) == LITERAL_read
6097:                                    || LA(2) == LITERAL_order
6098:                                    || LA(2) == LITERAL_by || LA(2) == STAR
6099:                                    || LA(2) == LITERAL_having
6100:                                    || LA(2) == LITERAL_corresponding
6101:                                    || LA(2) == LITERAL_values
6102:                                    || LA(2) == LITERAL_using
6103:                                    || LA(2) == LITERAL_group
6104:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
6105:                                    || LA(2) == LITERAL_and
6106:                                    || LA(2) == LITERAL_is
6107:                                    || LA(2) == LITERAL_like
6108:                                    || LA(2) == LITERAL_between
6109:                                    || LA(2) == LITERAL_in
6110:                                    || LA(2) == LITERAL_exists
6111:                                    || LA(2) == LITERAL_escape || LA(2) == 120
6112:                                    || LA(2) == PLUS || LA(2) == MINUS
6113:                                    || LA(2) == STRING_LITERAL
6114:                                    || LA(2) == QUESTION || LA(2) == INT
6115:                                    || LA(2) == REAL || LA(2) == BINSTR
6116:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
6117:                                    || LA(2) == LITERAL_when
6118:                                    || LA(2) == LITERAL_then
6119:                                    || LA(2) == LITERAL_else
6120:                                    || LA(2) == LITERAL_end
6121:                                    || LA(2) == LITERAL_hour
6122:                                    || LA(2) == LITERAL_left
6123:                                    || LA(2) == LITERAL_minute
6124:                                    || LA(2) == LITERAL_month
6125:                                    || LA(2) == LITERAL_right
6126:                                    || LA(2) == LITERAL_second
6127:                                    || LA(2) == LITERAL_year
6128:                                    || LA(2) == LITERAL_user
6129:                                    || LA(2) == LITERAL_current_user
6130:                                    || LA(2) == LITERAL_session_user
6131:                                    || LA(2) == LITERAL_system_user
6132:                                    || LA(2) == LITERAL_current_date
6133:                                    || LA(2) == LITERAL_current_time
6134:                                    || LA(2) == LITERAL_current_timestamp
6135:                                    || LA(2) == LITERAL_sql_tsi_frac_second
6136:                                    || LA(2) == LITERAL_sql_tsi_second
6137:                                    || LA(2) == LITERAL_sql_tsi_minute
6138:                                    || LA(2) == LITERAL_sql_tsi_hour
6139:                                    || LA(2) == LITERAL_sql_tsi_day
6140:                                    || LA(2) == LITERAL_sql_tsi_week
6141:                                    || LA(2) == LITERAL_sql_tsi_month
6142:                                    || LA(2) == LITERAL_sql_tsi_quarter
6143:                                    || LA(2) == LITERAL_sql_tsi_year
6144:                                    || LA(2) == LITERAL_cast
6145:                                    || LA(2) == LITERAL_true
6146:                                    || LA(2) == LITERAL_false
6147:                                    || LA(2) == LITERAL_avg
6148:                                    || LA(2) == LITERAL_min
6149:                                    || LA(2) == LITERAL_max
6150:                                    || LA(2) == LITERAL_sum
6151:                                    || LA(2) == LITERAL_count || LA(2) == LT
6152:                                    || LA(2) == LE || LA(2) == GT
6153:                                    || LA(2) == GE || LA(2) == NE
6154:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
6155:                                    || LA(2) == LITERAL_join
6156:                                    || LA(2) == LITERAL_natural
6157:                                    || LA(2) == LITERAL_union
6158:                                    || LA(2) == LITERAL_inner
6159:                                    || LA(2) == LITERAL_outer
6160:                                    || LA(2) == LITERAL_intersect
6161:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
6162:                    } else {
6163:                        throw new NoViableAltException(LT(1), getFilename());
6164:                    }
6165:                }
6166:            }
6167:
6168:            public final VectorExpression vectorExpression()
6169:                    throws RecognitionException, TokenStreamException {
6170:                VectorExpression e;
6171:
6172:                e = new VectorExpression();
6173:                Expression f = null;
6174:
6175:                match(LPAREN);
6176:                {
6177:                    switch (LA(1)) {
6178:                    case LITERAL_unique:
6179:                    case LPAREN:
6180:                    case LITERAL_default:
6181:                    case LITERAL_insert:
6182:                    case LITERAL_not:
6183:                    case LITERAL_null:
6184:                    case LITERAL_char:
6185:                    case LITERAL_date:
6186:                    case LITERAL_time:
6187:                    case LITERAL_timestamp:
6188:                    case LITERAL_interval:
6189:                    case LITERAL_exists:
6190:                    case PLUS:
6191:                    case MINUS:
6192:                    case STRING_LITERAL:
6193:                    case QUESTION:
6194:                    case INT:
6195:                    case REAL:
6196:                    case BINSTR:
6197:                    case HEXSTR:
6198:                    case LITERAL_case:
6199:                    case LITERAL_hour:
6200:                    case LITERAL_left:
6201:                    case LITERAL_minute:
6202:                    case LITERAL_month:
6203:                    case LITERAL_right:
6204:                    case LITERAL_second:
6205:                    case LITERAL_year:
6206:                    case LITERAL_user:
6207:                    case LITERAL_current_user:
6208:                    case LITERAL_session_user:
6209:                    case LITERAL_system_user:
6210:                    case LITERAL_current_date:
6211:                    case LITERAL_current_time:
6212:                    case LITERAL_current_timestamp:
6213:                    case LITERAL_sql_tsi_frac_second:
6214:                    case LITERAL_sql_tsi_second:
6215:                    case LITERAL_sql_tsi_minute:
6216:                    case LITERAL_sql_tsi_hour:
6217:                    case LITERAL_sql_tsi_day:
6218:                    case LITERAL_sql_tsi_week:
6219:                    case LITERAL_sql_tsi_month:
6220:                    case LITERAL_sql_tsi_quarter:
6221:                    case LITERAL_sql_tsi_year:
6222:                    case LITERAL_cast:
6223:                    case LITERAL_true:
6224:                    case LITERAL_false:
6225:                    case LITERAL_avg:
6226:                    case LITERAL_min:
6227:                    case LITERAL_max:
6228:                    case LITERAL_sum:
6229:                    case LITERAL_count:
6230:                    case ID: {
6231:                        f = scalarExpression();
6232:                        if (inputState.guessing == 0) {
6233:
6234:                            e.addElement(f);
6235:
6236:                        }
6237:                        {
6238:                            _loop233: do {
6239:                                if ((LA(1) == COMMA || LA(1) == LITERAL_from || LA(1) == LITERAL_for)) {
6240:                                    {
6241:                                        switch (LA(1)) {
6242:                                        case COMMA: {
6243:                                            match(COMMA);
6244:                                            break;
6245:                                        }
6246:                                        case LITERAL_from: {
6247:                                            match(LITERAL_from);
6248:                                            break;
6249:                                        }
6250:                                        case LITERAL_for: {
6251:                                            match(LITERAL_for);
6252:                                            break;
6253:                                        }
6254:                                        default: {
6255:                                            throw new NoViableAltException(
6256:                                                    LT(1), getFilename());
6257:                                        }
6258:                                        }
6259:                                    }
6260:                                    f = scalarExpression();
6261:                                    if (inputState.guessing == 0) {
6262:
6263:                                        e.addElement(f);
6264:
6265:                                    }
6266:                                } else {
6267:                                    break _loop233;
6268:                                }
6269:
6270:                            } while (true);
6271:                        }
6272:                        break;
6273:                    }
6274:                    case RPAREN: {
6275:                        break;
6276:                    }
6277:                    default: {
6278:                        throw new NoViableAltException(LT(1), getFilename());
6279:                    }
6280:                    }
6281:                }
6282:                match(RPAREN);
6283:                return e;
6284:            }
6285:
6286:            public final Expression scalarExpression()
6287:                    throws RecognitionException, TokenStreamException {
6288:                Expression e;
6289:
6290:                e = null;
6291:                Expression f = null;
6292:
6293:                e = orExpression();
6294:                {
6295:                    _loop237: do {
6296:                        if ((LA(1) == CONCAT)
6297:                                && (LA(2) == LITERAL_unique || LA(2) == LPAREN
6298:                                        || LA(2) == LITERAL_default
6299:                                        || LA(2) == LITERAL_insert
6300:                                        || LA(2) == LITERAL_not
6301:                                        || LA(2) == LITERAL_null
6302:                                        || LA(2) == LITERAL_char
6303:                                        || LA(2) == LITERAL_date
6304:                                        || LA(2) == LITERAL_time
6305:                                        || LA(2) == LITERAL_timestamp
6306:                                        || LA(2) == LITERAL_interval
6307:                                        || LA(2) == LITERAL_exists
6308:                                        || LA(2) == PLUS || LA(2) == MINUS
6309:                                        || LA(2) == STRING_LITERAL
6310:                                        || LA(2) == QUESTION || LA(2) == INT
6311:                                        || LA(2) == REAL || LA(2) == BINSTR
6312:                                        || LA(2) == HEXSTR
6313:                                        || LA(2) == LITERAL_case
6314:                                        || LA(2) == LITERAL_hour
6315:                                        || LA(2) == LITERAL_left
6316:                                        || LA(2) == LITERAL_minute
6317:                                        || LA(2) == LITERAL_month
6318:                                        || LA(2) == LITERAL_right
6319:                                        || LA(2) == LITERAL_second
6320:                                        || LA(2) == LITERAL_year
6321:                                        || LA(2) == LITERAL_user
6322:                                        || LA(2) == LITERAL_current_user
6323:                                        || LA(2) == LITERAL_session_user
6324:                                        || LA(2) == LITERAL_system_user
6325:                                        || LA(2) == LITERAL_current_date
6326:                                        || LA(2) == LITERAL_current_time
6327:                                        || LA(2) == LITERAL_current_timestamp
6328:                                        || LA(2) == LITERAL_sql_tsi_frac_second
6329:                                        || LA(2) == LITERAL_sql_tsi_second
6330:                                        || LA(2) == LITERAL_sql_tsi_minute
6331:                                        || LA(2) == LITERAL_sql_tsi_hour
6332:                                        || LA(2) == LITERAL_sql_tsi_day
6333:                                        || LA(2) == LITERAL_sql_tsi_week
6334:                                        || LA(2) == LITERAL_sql_tsi_month
6335:                                        || LA(2) == LITERAL_sql_tsi_quarter
6336:                                        || LA(2) == LITERAL_sql_tsi_year
6337:                                        || LA(2) == LITERAL_cast
6338:                                        || LA(2) == LITERAL_true
6339:                                        || LA(2) == LITERAL_false
6340:                                        || LA(2) == LITERAL_avg
6341:                                        || LA(2) == LITERAL_min
6342:                                        || LA(2) == LITERAL_max
6343:                                        || LA(2) == LITERAL_sum
6344:                                        || LA(2) == LITERAL_count || LA(2) == ID)) {
6345:                            match(CONCAT);
6346:                            f = orExpression();
6347:                            if (inputState.guessing == 0) {
6348:
6349:                                e = new BinaryExpression(Op.CONCAT, e, f);
6350:
6351:                            }
6352:                        } else {
6353:                            break _loop237;
6354:                        }
6355:
6356:                    } while (true);
6357:                }
6358:                return e;
6359:            }
6360:
6361:            public final Expression orExpression() throws RecognitionException,
6362:                    TokenStreamException {
6363:                Expression e;
6364:
6365:                e = null;
6366:                Expression f = null;
6367:
6368:                e = andExpression();
6369:                {
6370:                    _loop240: do {
6371:                        if ((LA(1) == LITERAL_or)
6372:                                && (LA(2) == LITERAL_unique || LA(2) == LPAREN
6373:                                        || LA(2) == LITERAL_default
6374:                                        || LA(2) == LITERAL_insert
6375:                                        || LA(2) == LITERAL_not
6376:                                        || LA(2) == LITERAL_null
6377:                                        || LA(2) == LITERAL_char
6378:                                        || LA(2) == LITERAL_date
6379:                                        || LA(2) == LITERAL_time
6380:                                        || LA(2) == LITERAL_timestamp
6381:                                        || LA(2) == LITERAL_interval
6382:                                        || LA(2) == LITERAL_exists
6383:                                        || LA(2) == PLUS || LA(2) == MINUS
6384:                                        || LA(2) == STRING_LITERAL
6385:                                        || LA(2) == QUESTION || LA(2) == INT
6386:                                        || LA(2) == REAL || LA(2) == BINSTR
6387:                                        || LA(2) == HEXSTR
6388:                                        || LA(2) == LITERAL_case
6389:                                        || LA(2) == LITERAL_hour
6390:                                        || LA(2) == LITERAL_left
6391:                                        || LA(2) == LITERAL_minute
6392:                                        || LA(2) == LITERAL_month
6393:                                        || LA(2) == LITERAL_right
6394:                                        || LA(2) == LITERAL_second
6395:                                        || LA(2) == LITERAL_year
6396:                                        || LA(2) == LITERAL_user
6397:                                        || LA(2) == LITERAL_current_user
6398:                                        || LA(2) == LITERAL_session_user
6399:                                        || LA(2) == LITERAL_system_user
6400:                                        || LA(2) == LITERAL_current_date
6401:                                        || LA(2) == LITERAL_current_time
6402:                                        || LA(2) == LITERAL_current_timestamp
6403:                                        || LA(2) == LITERAL_sql_tsi_frac_second
6404:                                        || LA(2) == LITERAL_sql_tsi_second
6405:                                        || LA(2) == LITERAL_sql_tsi_minute
6406:                                        || LA(2) == LITERAL_sql_tsi_hour
6407:                                        || LA(2) == LITERAL_sql_tsi_day
6408:                                        || LA(2) == LITERAL_sql_tsi_week
6409:                                        || LA(2) == LITERAL_sql_tsi_month
6410:                                        || LA(2) == LITERAL_sql_tsi_quarter
6411:                                        || LA(2) == LITERAL_sql_tsi_year
6412:                                        || LA(2) == LITERAL_cast
6413:                                        || LA(2) == LITERAL_true
6414:                                        || LA(2) == LITERAL_false
6415:                                        || LA(2) == LITERAL_avg
6416:                                        || LA(2) == LITERAL_min
6417:                                        || LA(2) == LITERAL_max
6418:                                        || LA(2) == LITERAL_sum
6419:                                        || LA(2) == LITERAL_count || LA(2) == ID)) {
6420:                            match(LITERAL_or);
6421:                            f = andExpression();
6422:                            if (inputState.guessing == 0) {
6423:
6424:                                e = new BinaryExpression(Op.OR, e, f);
6425:
6426:                            }
6427:                        } else {
6428:                            break _loop240;
6429:                        }
6430:
6431:                    } while (true);
6432:                }
6433:                return e;
6434:            }
6435:
6436:            public final Expression andExpression()
6437:                    throws RecognitionException, TokenStreamException {
6438:                Expression e;
6439:
6440:                e = null;
6441:                Expression f = null;
6442:
6443:                e = notExpression();
6444:                {
6445:                    _loop243: do {
6446:                        if ((LA(1) == LITERAL_and)
6447:                                && (LA(2) == LITERAL_unique || LA(2) == LPAREN
6448:                                        || LA(2) == LITERAL_default
6449:                                        || LA(2) == LITERAL_insert
6450:                                        || LA(2) == LITERAL_not
6451:                                        || LA(2) == LITERAL_null
6452:                                        || LA(2) == LITERAL_char
6453:                                        || LA(2) == LITERAL_date
6454:                                        || LA(2) == LITERAL_time
6455:                                        || LA(2) == LITERAL_timestamp
6456:                                        || LA(2) == LITERAL_interval
6457:                                        || LA(2) == LITERAL_exists
6458:                                        || LA(2) == PLUS || LA(2) == MINUS
6459:                                        || LA(2) == STRING_LITERAL
6460:                                        || LA(2) == QUESTION || LA(2) == INT
6461:                                        || LA(2) == REAL || LA(2) == BINSTR
6462:                                        || LA(2) == HEXSTR
6463:                                        || LA(2) == LITERAL_case
6464:                                        || LA(2) == LITERAL_hour
6465:                                        || LA(2) == LITERAL_left
6466:                                        || LA(2) == LITERAL_minute
6467:                                        || LA(2) == LITERAL_month
6468:                                        || LA(2) == LITERAL_right
6469:                                        || LA(2) == LITERAL_second
6470:                                        || LA(2) == LITERAL_year
6471:                                        || LA(2) == LITERAL_user
6472:                                        || LA(2) == LITERAL_current_user
6473:                                        || LA(2) == LITERAL_session_user
6474:                                        || LA(2) == LITERAL_system_user
6475:                                        || LA(2) == LITERAL_current_date
6476:                                        || LA(2) == LITERAL_current_time
6477:                                        || LA(2) == LITERAL_current_timestamp
6478:                                        || LA(2) == LITERAL_sql_tsi_frac_second
6479:                                        || LA(2) == LITERAL_sql_tsi_second
6480:                                        || LA(2) == LITERAL_sql_tsi_minute
6481:                                        || LA(2) == LITERAL_sql_tsi_hour
6482:                                        || LA(2) == LITERAL_sql_tsi_day
6483:                                        || LA(2) == LITERAL_sql_tsi_week
6484:                                        || LA(2) == LITERAL_sql_tsi_month
6485:                                        || LA(2) == LITERAL_sql_tsi_quarter
6486:                                        || LA(2) == LITERAL_sql_tsi_year
6487:                                        || LA(2) == LITERAL_cast
6488:                                        || LA(2) == LITERAL_true
6489:                                        || LA(2) == LITERAL_false
6490:                                        || LA(2) == LITERAL_avg
6491:                                        || LA(2) == LITERAL_min
6492:                                        || LA(2) == LITERAL_max
6493:                                        || LA(2) == LITERAL_sum
6494:                                        || LA(2) == LITERAL_count || LA(2) == ID)) {
6495:                            match(LITERAL_and);
6496:                            f = notExpression();
6497:                            if (inputState.guessing == 0) {
6498:
6499:                                e = new BinaryExpression(Op.AND, e, f);
6500:
6501:                            }
6502:                        } else {
6503:                            break _loop243;
6504:                        }
6505:
6506:                    } while (true);
6507:                }
6508:                return e;
6509:            }
6510:
6511:            public final Expression notExpression()
6512:                    throws RecognitionException, TokenStreamException {
6513:                Expression e;
6514:
6515:                e = null;
6516:                boolean not = false;
6517:
6518:                not = isOrNot();
6519:                e = compareExpression();
6520:                if (inputState.guessing == 0) {
6521:
6522:                    if (not)
6523:                        e.invert();
6524:
6525:                }
6526:                return e;
6527:            }
6528:
6529:            public final boolean isOrNot() throws RecognitionException,
6530:                    TokenStreamException {
6531:                boolean not;
6532:
6533:                not = false;
6534:
6535:                {
6536:                    switch (LA(1)) {
6537:                    case LITERAL_not: {
6538:                        match(LITERAL_not);
6539:                        if (inputState.guessing == 0) {
6540:                            not = true;
6541:                        }
6542:                        break;
6543:                    }
6544:                    case LITERAL_unique:
6545:                    case LPAREN:
6546:                    case LITERAL_default:
6547:                    case LITERAL_insert:
6548:                    case LITERAL_null:
6549:                    case LITERAL_char:
6550:                    case LITERAL_date:
6551:                    case LITERAL_time:
6552:                    case LITERAL_timestamp:
6553:                    case LITERAL_interval:
6554:                    case LITERAL_like:
6555:                    case LITERAL_between:
6556:                    case LITERAL_in:
6557:                    case LITERAL_exists:
6558:                    case PLUS:
6559:                    case MINUS:
6560:                    case STRING_LITERAL:
6561:                    case QUESTION:
6562:                    case INT:
6563:                    case REAL:
6564:                    case BINSTR:
6565:                    case HEXSTR:
6566:                    case LITERAL_case:
6567:                    case LITERAL_hour:
6568:                    case LITERAL_left:
6569:                    case LITERAL_minute:
6570:                    case LITERAL_month:
6571:                    case LITERAL_right:
6572:                    case LITERAL_second:
6573:                    case LITERAL_year:
6574:                    case LITERAL_user:
6575:                    case LITERAL_current_user:
6576:                    case LITERAL_session_user:
6577:                    case LITERAL_system_user:
6578:                    case LITERAL_current_date:
6579:                    case LITERAL_current_time:
6580:                    case LITERAL_current_timestamp:
6581:                    case LITERAL_sql_tsi_frac_second:
6582:                    case LITERAL_sql_tsi_second:
6583:                    case LITERAL_sql_tsi_minute:
6584:                    case LITERAL_sql_tsi_hour:
6585:                    case LITERAL_sql_tsi_day:
6586:                    case LITERAL_sql_tsi_week:
6587:                    case LITERAL_sql_tsi_month:
6588:                    case LITERAL_sql_tsi_quarter:
6589:                    case LITERAL_sql_tsi_year:
6590:                    case LITERAL_cast:
6591:                    case LITERAL_true:
6592:                    case LITERAL_false:
6593:                    case LITERAL_avg:
6594:                    case LITERAL_min:
6595:                    case LITERAL_max:
6596:                    case LITERAL_sum:
6597:                    case LITERAL_count:
6598:                    case LITERAL_unknown:
6599:                    case ID: {
6600:                        break;
6601:                    }
6602:                    default: {
6603:                        throw new NoViableAltException(LT(1), getFilename());
6604:                    }
6605:                    }
6606:                }
6607:                return not;
6608:            }
6609:
6610:            public final Expression compareExpression()
6611:                    throws RecognitionException, TokenStreamException {
6612:                Expression e;
6613:
6614:                e = null;
6615:                Expression f = null;
6616:                Expression g = null;
6617:                Expression q = null;
6618:                boolean not = false;
6619:                int op = 0;
6620:                int quant = 0;
6621:
6622:                switch (LA(1)) {
6623:                case LPAREN:
6624:                case LITERAL_default:
6625:                case LITERAL_insert:
6626:                case LITERAL_null:
6627:                case LITERAL_char:
6628:                case LITERAL_date:
6629:                case LITERAL_time:
6630:                case LITERAL_timestamp:
6631:                case LITERAL_interval:
6632:                case PLUS:
6633:                case MINUS:
6634:                case STRING_LITERAL:
6635:                case QUESTION:
6636:                case INT:
6637:                case REAL:
6638:                case BINSTR:
6639:                case HEXSTR:
6640:                case LITERAL_case:
6641:                case LITERAL_hour:
6642:                case LITERAL_left:
6643:                case LITERAL_minute:
6644:                case LITERAL_month:
6645:                case LITERAL_right:
6646:                case LITERAL_second:
6647:                case LITERAL_year:
6648:                case LITERAL_user:
6649:                case LITERAL_current_user:
6650:                case LITERAL_session_user:
6651:                case LITERAL_system_user:
6652:                case LITERAL_current_date:
6653:                case LITERAL_current_time:
6654:                case LITERAL_current_timestamp:
6655:                case LITERAL_sql_tsi_frac_second:
6656:                case LITERAL_sql_tsi_second:
6657:                case LITERAL_sql_tsi_minute:
6658:                case LITERAL_sql_tsi_hour:
6659:                case LITERAL_sql_tsi_day:
6660:                case LITERAL_sql_tsi_week:
6661:                case LITERAL_sql_tsi_month:
6662:                case LITERAL_sql_tsi_quarter:
6663:                case LITERAL_sql_tsi_year:
6664:                case LITERAL_cast:
6665:                case LITERAL_true:
6666:                case LITERAL_false:
6667:                case LITERAL_avg:
6668:                case LITERAL_min:
6669:                case LITERAL_max:
6670:                case LITERAL_sum:
6671:                case LITERAL_count:
6672:                case ID: {
6673:                    e = simpleExpression();
6674:                    {
6675:                        switch (LA(1)) {
6676:                        case LITERAL_is: {
6677:                            match(LITERAL_is);
6678:                            not = isOrNot();
6679:                            op = truthConst();
6680:                            if (inputState.guessing == 0) {
6681:
6682:                                e = new UnaryExpression(op, e);
6683:                                if (not)
6684:                                    e.invert();
6685:
6686:                            }
6687:                            break;
6688:                        }
6689:                        case EQ:
6690:                        case LT:
6691:                        case LE:
6692:                        case GT:
6693:                        case GE:
6694:                        case NE: {
6695:                            op = relOp();
6696:                            {
6697:                                switch (LA(1)) {
6698:                                case LPAREN:
6699:                                case LITERAL_default:
6700:                                case LITERAL_insert:
6701:                                case LITERAL_null:
6702:                                case LITERAL_char:
6703:                                case LITERAL_date:
6704:                                case LITERAL_time:
6705:                                case LITERAL_timestamp:
6706:                                case LITERAL_interval:
6707:                                case PLUS:
6708:                                case MINUS:
6709:                                case STRING_LITERAL:
6710:                                case QUESTION:
6711:                                case INT:
6712:                                case REAL:
6713:                                case BINSTR:
6714:                                case HEXSTR:
6715:                                case LITERAL_case:
6716:                                case LITERAL_hour:
6717:                                case LITERAL_left:
6718:                                case LITERAL_minute:
6719:                                case LITERAL_month:
6720:                                case LITERAL_right:
6721:                                case LITERAL_second:
6722:                                case LITERAL_year:
6723:                                case LITERAL_user:
6724:                                case LITERAL_current_user:
6725:                                case LITERAL_session_user:
6726:                                case LITERAL_system_user:
6727:                                case LITERAL_current_date:
6728:                                case LITERAL_current_time:
6729:                                case LITERAL_current_timestamp:
6730:                                case LITERAL_sql_tsi_frac_second:
6731:                                case LITERAL_sql_tsi_second:
6732:                                case LITERAL_sql_tsi_minute:
6733:                                case LITERAL_sql_tsi_hour:
6734:                                case LITERAL_sql_tsi_day:
6735:                                case LITERAL_sql_tsi_week:
6736:                                case LITERAL_sql_tsi_month:
6737:                                case LITERAL_sql_tsi_quarter:
6738:                                case LITERAL_sql_tsi_year:
6739:                                case LITERAL_cast:
6740:                                case LITERAL_true:
6741:                                case LITERAL_false:
6742:                                case LITERAL_avg:
6743:                                case LITERAL_min:
6744:                                case LITERAL_max:
6745:                                case LITERAL_sum:
6746:                                case LITERAL_count:
6747:                                case ID: {
6748:                                    f = simpleExpression();
6749:                                    if (inputState.guessing == 0) {
6750:
6751:                                        e = new BinaryExpression(op, e, f);
6752:
6753:                                    }
6754:                                    break;
6755:                                }
6756:                                case LITERAL_all:
6757:                                case LITERAL_any:
6758:                                case LITERAL_some: {
6759:                                    quant = quantifier();
6760:                                    q = queryExpression();
6761:                                    if (inputState.guessing == 0) {
6762:
6763:                                        e = new QuantifiedCompare(e, op, quant,
6764:                                                q);
6765:
6766:                                    }
6767:                                    break;
6768:                                }
6769:                                default: {
6770:                                    throw new NoViableAltException(LT(1),
6771:                                            getFilename());
6772:                                }
6773:                                }
6774:                            }
6775:                            break;
6776:                        }
6777:                        default:
6778:                            boolean synPredMatched250 = false;
6779:                            if (((LA(1) == LITERAL_not || LA(1) == LITERAL_like
6780:                                    || LA(1) == LITERAL_between || LA(1) == LITERAL_in) && (LA(2) == LITERAL_table
6781:                                    || LA(2) == LPAREN
6782:                                    || LA(2) == LITERAL_default
6783:                                    || LA(2) == LITERAL_select
6784:                                    || LA(2) == LITERAL_insert
6785:                                    || LA(2) == LITERAL_null
6786:                                    || LA(2) == LITERAL_char
6787:                                    || LA(2) == LITERAL_date
6788:                                    || LA(2) == LITERAL_time
6789:                                    || LA(2) == LITERAL_timestamp
6790:                                    || LA(2) == LITERAL_interval
6791:                                    || LA(2) == LITERAL_values
6792:                                    || LA(2) == LITERAL_like
6793:                                    || LA(2) == LITERAL_between
6794:                                    || LA(2) == LITERAL_in
6795:                                    || LA(2) == PLUS
6796:                                    || LA(2) == MINUS
6797:                                    || LA(2) == STRING_LITERAL
6798:                                    || LA(2) == QUESTION
6799:                                    || LA(2) == INT
6800:                                    || LA(2) == REAL
6801:                                    || LA(2) == BINSTR
6802:                                    || LA(2) == HEXSTR
6803:                                    || LA(2) == LITERAL_case
6804:                                    || LA(2) == LITERAL_hour
6805:                                    || LA(2) == LITERAL_left
6806:                                    || LA(2) == LITERAL_minute
6807:                                    || LA(2) == LITERAL_month
6808:                                    || LA(2) == LITERAL_right
6809:                                    || LA(2) == LITERAL_second
6810:                                    || LA(2) == LITERAL_year
6811:                                    || LA(2) == LITERAL_user
6812:                                    || LA(2) == LITERAL_current_user
6813:                                    || LA(2) == LITERAL_session_user
6814:                                    || LA(2) == LITERAL_system_user
6815:                                    || LA(2) == LITERAL_current_date
6816:                                    || LA(2) == LITERAL_current_time
6817:                                    || LA(2) == LITERAL_current_timestamp
6818:                                    || LA(2) == LITERAL_sql_tsi_frac_second
6819:                                    || LA(2) == LITERAL_sql_tsi_second
6820:                                    || LA(2) == LITERAL_sql_tsi_minute
6821:                                    || LA(2) == LITERAL_sql_tsi_hour
6822:                                    || LA(2) == LITERAL_sql_tsi_day
6823:                                    || LA(2) == LITERAL_sql_tsi_week
6824:                                    || LA(2) == LITERAL_sql_tsi_month
6825:                                    || LA(2) == LITERAL_sql_tsi_quarter
6826:                                    || LA(2) == LITERAL_sql_tsi_year
6827:                                    || LA(2) == LITERAL_cast
6828:                                    || LA(2) == LITERAL_true
6829:                                    || LA(2) == LITERAL_false
6830:                                    || LA(2) == LITERAL_avg
6831:                                    || LA(2) == LITERAL_min
6832:                                    || LA(2) == LITERAL_max
6833:                                    || LA(2) == LITERAL_sum
6834:                                    || LA(2) == LITERAL_count || LA(2) == ID))) {
6835:                                int _m250 = mark();
6836:                                synPredMatched250 = true;
6837:                                inputState.guessing++;
6838:                                try {
6839:                                    {
6840:                                        isOrNot();
6841:                                        {
6842:                                            switch (LA(1)) {
6843:                                            case LITERAL_like: {
6844:                                                match(LITERAL_like);
6845:                                                break;
6846:                                            }
6847:                                            case LITERAL_between: {
6848:                                                match(LITERAL_between);
6849:                                                break;
6850:                                            }
6851:                                            case LITERAL_in: {
6852:                                                match(LITERAL_in);
6853:                                                break;
6854:                                            }
6855:                                            default: {
6856:                                                throw new NoViableAltException(
6857:                                                        LT(1), getFilename());
6858:                                            }
6859:                                            }
6860:                                        }
6861:                                    }
6862:                                } catch (RecognitionException pe) {
6863:                                    synPredMatched250 = false;
6864:                                }
6865:                                rewind(_m250);
6866:                                inputState.guessing--;
6867:                            }
6868:                            if (synPredMatched250) {
6869:                                not = isOrNot();
6870:                                {
6871:                                    switch (LA(1)) {
6872:                                    case LITERAL_like: {
6873:                                        match(LITERAL_like);
6874:                                        f = patternExpression();
6875:                                        if (inputState.guessing == 0) {
6876:
6877:                                            op = Op.LIKE;
6878:                                            e = new BinaryExpression(op, e, f);
6879:                                            if (not)
6880:                                                e.invert();
6881:
6882:                                        }
6883:                                        break;
6884:                                    }
6885:                                    case LITERAL_between: {
6886:                                        match(LITERAL_between);
6887:                                        f = simpleExpression();
6888:                                        match(LITERAL_and);
6889:                                        g = simpleExpression();
6890:                                        if (inputState.guessing == 0) {
6891:
6892:                                            op = Op.BETWEEN;
6893:                                            e = new TernaryExpression(op, e, f,
6894:                                                    g);
6895:                                            if (not)
6896:                                                e.invert();
6897:
6898:                                        }
6899:                                        break;
6900:                                    }
6901:                                    case LITERAL_in: {
6902:                                        match(LITERAL_in);
6903:                                        {
6904:                                            boolean synPredMatched254 = false;
6905:                                            if (((LA(1) == LPAREN) && (LA(2) == LITERAL_unique
6906:                                                    || LA(2) == LPAREN
6907:                                                    || LA(2) == RPAREN
6908:                                                    || LA(2) == LITERAL_default
6909:                                                    || LA(2) == LITERAL_insert
6910:                                                    || LA(2) == LITERAL_not
6911:                                                    || LA(2) == LITERAL_null
6912:                                                    || LA(2) == LITERAL_char
6913:                                                    || LA(2) == LITERAL_date
6914:                                                    || LA(2) == LITERAL_time
6915:                                                    || LA(2) == LITERAL_timestamp
6916:                                                    || LA(2) == LITERAL_interval
6917:                                                    || LA(2) == LITERAL_exists
6918:                                                    || LA(2) == PLUS
6919:                                                    || LA(2) == MINUS
6920:                                                    || LA(2) == STRING_LITERAL
6921:                                                    || LA(2) == QUESTION
6922:                                                    || LA(2) == INT
6923:                                                    || LA(2) == REAL
6924:                                                    || LA(2) == BINSTR
6925:                                                    || LA(2) == HEXSTR
6926:                                                    || LA(2) == LITERAL_case
6927:                                                    || LA(2) == LITERAL_hour
6928:                                                    || LA(2) == LITERAL_left
6929:                                                    || LA(2) == LITERAL_minute
6930:                                                    || LA(2) == LITERAL_month
6931:                                                    || LA(2) == LITERAL_right
6932:                                                    || LA(2) == LITERAL_second
6933:                                                    || LA(2) == LITERAL_year
6934:                                                    || LA(2) == LITERAL_user
6935:                                                    || LA(2) == LITERAL_current_user
6936:                                                    || LA(2) == LITERAL_session_user
6937:                                                    || LA(2) == LITERAL_system_user
6938:                                                    || LA(2) == LITERAL_current_date
6939:                                                    || LA(2) == LITERAL_current_time
6940:                                                    || LA(2) == LITERAL_current_timestamp
6941:                                                    || LA(2) == LITERAL_sql_tsi_frac_second
6942:                                                    || LA(2) == LITERAL_sql_tsi_second
6943:                                                    || LA(2) == LITERAL_sql_tsi_minute
6944:                                                    || LA(2) == LITERAL_sql_tsi_hour
6945:                                                    || LA(2) == LITERAL_sql_tsi_day
6946:                                                    || LA(2) == LITERAL_sql_tsi_week
6947:                                                    || LA(2) == LITERAL_sql_tsi_month
6948:                                                    || LA(2) == LITERAL_sql_tsi_quarter
6949:                                                    || LA(2) == LITERAL_sql_tsi_year
6950:                                                    || LA(2) == LITERAL_cast
6951:                                                    || LA(2) == LITERAL_true
6952:                                                    || LA(2) == LITERAL_false
6953:                                                    || LA(2) == LITERAL_avg
6954:                                                    || LA(2) == LITERAL_min
6955:                                                    || LA(2) == LITERAL_max
6956:                                                    || LA(2) == LITERAL_sum
6957:                                                    || LA(2) == LITERAL_count || LA(2) == ID))) {
6958:                                                int _m254 = mark();
6959:                                                synPredMatched254 = true;
6960:                                                inputState.guessing++;
6961:                                                try {
6962:                                                    {
6963:                                                        match(LPAREN);
6964:                                                        unaryExpression();
6965:                                                    }
6966:                                                } catch (RecognitionException pe) {
6967:                                                    synPredMatched254 = false;
6968:                                                }
6969:                                                rewind(_m254);
6970:                                                inputState.guessing--;
6971:                                            }
6972:                                            if (synPredMatched254) {
6973:                                                q = vectorExpression();
6974:                                            } else if ((LA(1) == LITERAL_table
6975:                                                    || LA(1) == LPAREN
6976:                                                    || LA(1) == LITERAL_select
6977:                                                    || LA(1) == LITERAL_values || LA(1) == ID)
6978:                                                    && (LA(2) == EOF
6979:                                                            || LA(2) == LITERAL_create
6980:                                                            || LA(2) == LITERAL_unique
6981:                                                            || LA(2) == LITERAL_table
6982:                                                            || LA(2) == LITERAL_on
6983:                                                            || LA(2) == LPAREN
6984:                                                            || LA(2) == RPAREN
6985:                                                            || LA(2) == LITERAL_constraint
6986:                                                            || LA(2) == LITERAL_primary
6987:                                                            || LA(2) == LITERAL_check
6988:                                                            || LA(2) == LITERAL_first
6989:                                                            || LA(2) == LITERAL_after
6990:                                                            || LA(2) == LITERAL_default
6991:                                                            || LA(2) == LITERAL_as
6992:                                                            || LA(2) == LITERAL_with
6993:                                                            || LA(2) == COMMA
6994:                                                            || LA(2) == LITERAL_where
6995:                                                            || LA(2) == LITERAL_from
6996:                                                            || LA(2) == LITERAL_grant
6997:                                                            || LA(2) == LITERAL_all
6998:                                                            || LA(2) == LITERAL_select
6999:                                                            || LA(2) == LITERAL_insert
7000:                                                            || LA(2) == LITERAL_references
7001:                                                            || LA(2) == LITERAL_not
7002:                                                            || LA(2) == LITERAL_null
7003:                                                            || LA(2) == LITERAL_full
7004:                                                            || LA(2) == LITERAL_initially
7005:                                                            || LA(2) == LITERAL_deferrable
7006:                                                            || LA(2) == LITERAL_char
7007:                                                            || LA(2) == LITERAL_date
7008:                                                            || LA(2) == LITERAL_time
7009:                                                            || LA(2) == LITERAL_timestamp
7010:                                                            || LA(2) == LITERAL_interval
7011:                                                            || LA(2) == LITERAL_for
7012:                                                            || LA(2) == LITERAL_order
7013:                                                            || LA(2) == LITERAL_distinct
7014:                                                            || LA(2) == STAR
7015:                                                            || LA(2) == LITERAL_having
7016:                                                            || LA(2) == LITERAL_values
7017:                                                            || LA(2) == LITERAL_using
7018:                                                            || LA(2) == LITERAL_group
7019:                                                            || LA(2) == CONCAT
7020:                                                            || LA(2) == LITERAL_or
7021:                                                            || LA(2) == LITERAL_and
7022:                                                            || LA(2) == LITERAL_exists
7023:                                                            || LA(2) == PLUS
7024:                                                            || LA(2) == MINUS
7025:                                                            || LA(2) == STRING_LITERAL
7026:                                                            || LA(2) == QUESTION
7027:                                                            || LA(2) == INT
7028:                                                            || LA(2) == REAL
7029:                                                            || LA(2) == BINSTR
7030:                                                            || LA(2) == HEXSTR
7031:                                                            || LA(2) == LITERAL_case
7032:                                                            || LA(2) == LITERAL_when
7033:                                                            || LA(2) == LITERAL_then
7034:                                                            || LA(2) == LITERAL_else
7035:                                                            || LA(2) == LITERAL_end
7036:                                                            || LA(2) == LITERAL_hour
7037:                                                            || LA(2) == LITERAL_left
7038:                                                            || LA(2) == LITERAL_minute
7039:                                                            || LA(2) == LITERAL_month
7040:                                                            || LA(2) == LITERAL_right
7041:                                                            || LA(2) == LITERAL_second
7042:                                                            || LA(2) == LITERAL_year
7043:                                                            || LA(2) == LITERAL_user
7044:                                                            || LA(2) == LITERAL_current_user
7045:                                                            || LA(2) == LITERAL_session_user
7046:                                                            || LA(2) == LITERAL_system_user
7047:                                                            || LA(2) == LITERAL_current_date
7048:                                                            || LA(2) == LITERAL_current_time
7049:                                                            || LA(2) == LITERAL_current_timestamp
7050:                                                            || LA(2) == LITERAL_sql_tsi_frac_second
7051:                                                            || LA(2) == LITERAL_sql_tsi_second
7052:                                                            || LA(2) == LITERAL_sql_tsi_minute
7053:                                                            || LA(2) == LITERAL_sql_tsi_hour
7054:                                                            || LA(2) == LITERAL_sql_tsi_day
7055:                                                            || LA(2) == LITERAL_sql_tsi_week
7056:                                                            || LA(2) == LITERAL_sql_tsi_month
7057:                                                            || LA(2) == LITERAL_sql_tsi_quarter
7058:                                                            || LA(2) == LITERAL_sql_tsi_year
7059:                                                            || LA(2) == LITERAL_cast
7060:                                                            || LA(2) == LITERAL_true
7061:                                                            || LA(2) == LITERAL_false
7062:                                                            || LA(2) == LITERAL_avg
7063:                                                            || LA(2) == LITERAL_min
7064:                                                            || LA(2) == LITERAL_max
7065:                                                            || LA(2) == LITERAL_sum
7066:                                                            || LA(2) == LITERAL_count
7067:                                                            || LA(2) == LITERAL_cross
7068:                                                            || LA(2) == LITERAL_join
7069:                                                            || LA(2) == LITERAL_natural
7070:                                                            || LA(2) == LITERAL_union
7071:                                                            || LA(2) == LITERAL_inner
7072:                                                            || LA(2) == LITERAL_intersect
7073:                                                            || LA(2) == LITERAL_except || LA(2) == ID)) {
7074:                                                q = queryExpression();
7075:                                            } else {
7076:                                                throw new NoViableAltException(
7077:                                                        LT(1), getFilename());
7078:                                            }
7079:
7080:                                        }
7081:                                        if (inputState.guessing == 0) {
7082:
7083:                                            e = new InExpression(e, q);
7084:                                            if (not)
7085:                                                e.invert();
7086:
7087:                                        }
7088:                                        break;
7089:                                    }
7090:                                    default: {
7091:                                        throw new NoViableAltException(LT(1),
7092:                                                getFilename());
7093:                                    }
7094:                                    }
7095:                                }
7096:                            } else if ((LA(1) == EOF || LA(1) == LITERAL_create
7097:                                    || LA(1) == LITERAL_unique
7098:                                    || LA(1) == LITERAL_on || LA(1) == RPAREN
7099:                                    || LA(1) == LITERAL_constraint
7100:                                    || LA(1) == LITERAL_primary
7101:                                    || LA(1) == LITERAL_check
7102:                                    || LA(1) == LITERAL_first
7103:                                    || LA(1) == LITERAL_after
7104:                                    || LA(1) == LITERAL_default
7105:                                    || LA(1) == LITERAL_as
7106:                                    || LA(1) == LITERAL_with || LA(1) == COMMA
7107:                                    || LA(1) == LITERAL_where
7108:                                    || LA(1) == LITERAL_from
7109:                                    || LA(1) == LITERAL_grant
7110:                                    || LA(1) == LITERAL_references
7111:                                    || LA(1) == LITERAL_not
7112:                                    || LA(1) == LITERAL_full
7113:                                    || LA(1) == LITERAL_initially
7114:                                    || LA(1) == LITERAL_deferrable
7115:                                    || LA(1) == LITERAL_for
7116:                                    || LA(1) == LITERAL_order
7117:                                    || LA(1) == LITERAL_having
7118:                                    || LA(1) == LITERAL_using
7119:                                    || LA(1) == LITERAL_group
7120:                                    || LA(1) == CONCAT || LA(1) == LITERAL_or
7121:                                    || LA(1) == LITERAL_and
7122:                                    || LA(1) == LITERAL_when
7123:                                    || LA(1) == LITERAL_then
7124:                                    || LA(1) == LITERAL_else
7125:                                    || LA(1) == LITERAL_end
7126:                                    || LA(1) == LITERAL_left
7127:                                    || LA(1) == LITERAL_right
7128:                                    || LA(1) == LITERAL_cross
7129:                                    || LA(1) == LITERAL_join
7130:                                    || LA(1) == LITERAL_natural
7131:                                    || LA(1) == LITERAL_union
7132:                                    || LA(1) == LITERAL_inner
7133:                                    || LA(1) == LITERAL_intersect
7134:                                    || LA(1) == LITERAL_except || LA(1) == ID)
7135:                                    && (LA(2) == EOF
7136:                                            || LA(2) == LITERAL_create
7137:                                            || LA(2) == LITERAL_unique
7138:                                            || LA(2) == LITERAL_index
7139:                                            || LA(2) == LITERAL_temporary
7140:                                            || LA(2) == LITERAL_table
7141:                                            || LA(2) == LITERAL_view
7142:                                            || LA(2) == LITERAL_on
7143:                                            || LA(2) == LPAREN
7144:                                            || LA(2) == RPAREN
7145:                                            || LA(2) == LITERAL_constraint
7146:                                            || LA(2) == LITERAL_primary
7147:                                            || LA(2) == LITERAL_foreign
7148:                                            || LA(2) == LITERAL_check
7149:                                            || LA(2) == LITERAL_first
7150:                                            || LA(2) == LITERAL_after
7151:                                            || LA(2) == LITERAL_default
7152:                                            || LA(2) == LITERAL_as
7153:                                            || LA(2) == LITERAL_with
7154:                                            || LA(2) == LITERAL_cascaded
7155:                                            || LA(2) == LITERAL_update
7156:                                            || LA(2) == COMMA
7157:                                            || LA(2) == LITERAL_where
7158:                                            || LA(2) == EQ
7159:                                            || LA(2) == LITERAL_delete
7160:                                            || LA(2) == LITERAL_from
7161:                                            || LA(2) == LITERAL_global
7162:                                            || LA(2) == LITERAL_local
7163:                                            || LA(2) == LITERAL_grant
7164:                                            || LA(2) == LITERAL_all
7165:                                            || LA(2) == LITERAL_select
7166:                                            || LA(2) == LITERAL_insert
7167:                                            || LA(2) == LITERAL_references
7168:                                            || LA(2) == LITERAL_usage
7169:                                            || LA(2) == LITERAL_not
7170:                                            || LA(2) == LITERAL_null
7171:                                            || LA(2) == LITERAL_key
7172:                                            || LA(2) == LITERAL_identity
7173:                                            || LA(2) == LITERAL_full
7174:                                            || LA(2) == LITERAL_initially
7175:                                            || LA(2) == LITERAL_deferred
7176:                                            || LA(2) == LITERAL_immediate
7177:                                            || LA(2) == LITERAL_deferrable
7178:                                            || LA(2) == LITERAL_bit
7179:                                            || LA(2) == LITERAL_varbinary
7180:                                            || LA(2) == LITERAL_binary
7181:                                            || LA(2) == LITERAL_blob
7182:                                            || LA(2) == LITERAL_clob
7183:                                            || LA(2) == LITERAL_character
7184:                                            || LA(2) == LITERAL_char
7185:                                            || LA(2) == LITERAL_varchar
7186:                                            || LA(2) == LITERAL_int
7187:                                            || LA(2) == LITERAL_integer
7188:                                            || LA(2) == LITERAL_smallint
7189:                                            || LA(2) == LITERAL_tinyint
7190:                                            || LA(2) == LITERAL_bigint
7191:                                            || LA(2) == LITERAL_dec
7192:                                            || LA(2) == LITERAL_decimal
7193:                                            || LA(2) == LITERAL_numeric
7194:                                            || LA(2) == LITERAL_real
7195:                                            || LA(2) == LITERAL_double
7196:                                            || LA(2) == LITERAL_float
7197:                                            || LA(2) == LITERAL_boolean
7198:                                            || LA(2) == LITERAL_date
7199:                                            || LA(2) == LITERAL_time
7200:                                            || LA(2) == LITERAL_timestamp
7201:                                            || LA(2) == LITERAL_interval
7202:                                            || LA(2) == LITERAL_for
7203:                                            || LA(2) == LITERAL_read
7204:                                            || LA(2) == LITERAL_order
7205:                                            || LA(2) == LITERAL_by
7206:                                            || LA(2) == STAR
7207:                                            || LA(2) == LITERAL_having
7208:                                            || LA(2) == LITERAL_corresponding
7209:                                            || LA(2) == LITERAL_values
7210:                                            || LA(2) == LITERAL_using
7211:                                            || LA(2) == LITERAL_group
7212:                                            || LA(2) == CONCAT
7213:                                            || LA(2) == LITERAL_or
7214:                                            || LA(2) == LITERAL_and
7215:                                            || LA(2) == LITERAL_is
7216:                                            || LA(2) == LITERAL_like
7217:                                            || LA(2) == LITERAL_between
7218:                                            || LA(2) == LITERAL_in
7219:                                            || LA(2) == LITERAL_exists
7220:                                            || LA(2) == LITERAL_escape
7221:                                            || LA(2) == 120
7222:                                            || LA(2) == PLUS
7223:                                            || LA(2) == MINUS
7224:                                            || LA(2) == STRING_LITERAL
7225:                                            || LA(2) == QUESTION
7226:                                            || LA(2) == INT
7227:                                            || LA(2) == REAL
7228:                                            || LA(2) == BINSTR
7229:                                            || LA(2) == HEXSTR
7230:                                            || LA(2) == LITERAL_case
7231:                                            || LA(2) == LITERAL_when
7232:                                            || LA(2) == LITERAL_then
7233:                                            || LA(2) == LITERAL_else
7234:                                            || LA(2) == LITERAL_end
7235:                                            || LA(2) == LITERAL_hour
7236:                                            || LA(2) == LITERAL_left
7237:                                            || LA(2) == LITERAL_minute
7238:                                            || LA(2) == LITERAL_month
7239:                                            || LA(2) == LITERAL_right
7240:                                            || LA(2) == LITERAL_second
7241:                                            || LA(2) == LITERAL_year
7242:                                            || LA(2) == LITERAL_user
7243:                                            || LA(2) == LITERAL_current_user
7244:                                            || LA(2) == LITERAL_session_user
7245:                                            || LA(2) == LITERAL_system_user
7246:                                            || LA(2) == LITERAL_current_date
7247:                                            || LA(2) == LITERAL_current_time
7248:                                            || LA(2) == LITERAL_current_timestamp
7249:                                            || LA(2) == LITERAL_sql_tsi_frac_second
7250:                                            || LA(2) == LITERAL_sql_tsi_second
7251:                                            || LA(2) == LITERAL_sql_tsi_minute
7252:                                            || LA(2) == LITERAL_sql_tsi_hour
7253:                                            || LA(2) == LITERAL_sql_tsi_day
7254:                                            || LA(2) == LITERAL_sql_tsi_week
7255:                                            || LA(2) == LITERAL_sql_tsi_month
7256:                                            || LA(2) == LITERAL_sql_tsi_quarter
7257:                                            || LA(2) == LITERAL_sql_tsi_year
7258:                                            || LA(2) == LITERAL_cast
7259:                                            || LA(2) == LITERAL_true
7260:                                            || LA(2) == LITERAL_false
7261:                                            || LA(2) == LITERAL_avg
7262:                                            || LA(2) == LITERAL_min
7263:                                            || LA(2) == LITERAL_max
7264:                                            || LA(2) == LITERAL_sum
7265:                                            || LA(2) == LITERAL_count
7266:                                            || LA(2) == LT || LA(2) == LE
7267:                                            || LA(2) == GT || LA(2) == GE
7268:                                            || LA(2) == NE || LA(2) == SLASH
7269:                                            || LA(2) == LITERAL_cross
7270:                                            || LA(2) == LITERAL_join
7271:                                            || LA(2) == LITERAL_natural
7272:                                            || LA(2) == LITERAL_union
7273:                                            || LA(2) == LITERAL_inner
7274:                                            || LA(2) == LITERAL_outer
7275:                                            || LA(2) == LITERAL_intersect
7276:                                            || LA(2) == LITERAL_except || LA(2) == ID)) {
7277:                            } else {
7278:                                throw new NoViableAltException(LT(1),
7279:                                        getFilename());
7280:                            }
7281:                        }
7282:                    }
7283:                    break;
7284:                }
7285:                case LITERAL_exists: {
7286:                    match(LITERAL_exists);
7287:                    q = queryExpression();
7288:                    if (inputState.guessing == 0) {
7289:
7290:                        e = new UnaryExpression(Op.EXISTS, q);
7291:
7292:                    }
7293:                    break;
7294:                }
7295:                case LITERAL_unique: {
7296:                    match(LITERAL_unique);
7297:                    q = queryExpression();
7298:                    if (inputState.guessing == 0) {
7299:
7300:                        e = new UnaryExpression(Op.UNIQUE, q);
7301:
7302:                    }
7303:                    break;
7304:                }
7305:                default: {
7306:                    throw new NoViableAltException(LT(1), getFilename());
7307:                }
7308:                }
7309:                return e;
7310:            }
7311:
7312:            public final Expression simpleExpression()
7313:                    throws RecognitionException, TokenStreamException {
7314:                Expression e;
7315:
7316:                e = null;
7317:                Expression f = null;
7318:                int op = 0;
7319:
7320:                e = multExpression();
7321:                {
7322:                    _loop261: do {
7323:                        if ((LA(1) == CONCAT || LA(1) == PLUS || LA(1) == MINUS)
7324:                                && (LA(2) == LPAREN || LA(2) == LITERAL_default
7325:                                        || LA(2) == LITERAL_insert
7326:                                        || LA(2) == LITERAL_null
7327:                                        || LA(2) == LITERAL_char
7328:                                        || LA(2) == LITERAL_date
7329:                                        || LA(2) == LITERAL_time
7330:                                        || LA(2) == LITERAL_timestamp
7331:                                        || LA(2) == LITERAL_interval
7332:                                        || LA(2) == PLUS || LA(2) == MINUS
7333:                                        || LA(2) == STRING_LITERAL
7334:                                        || LA(2) == QUESTION || LA(2) == INT
7335:                                        || LA(2) == REAL || LA(2) == BINSTR
7336:                                        || LA(2) == HEXSTR
7337:                                        || LA(2) == LITERAL_case
7338:                                        || LA(2) == LITERAL_hour
7339:                                        || LA(2) == LITERAL_left
7340:                                        || LA(2) == LITERAL_minute
7341:                                        || LA(2) == LITERAL_month
7342:                                        || LA(2) == LITERAL_right
7343:                                        || LA(2) == LITERAL_second
7344:                                        || LA(2) == LITERAL_year
7345:                                        || LA(2) == LITERAL_user
7346:                                        || LA(2) == LITERAL_current_user
7347:                                        || LA(2) == LITERAL_session_user
7348:                                        || LA(2) == LITERAL_system_user
7349:                                        || LA(2) == LITERAL_current_date
7350:                                        || LA(2) == LITERAL_current_time
7351:                                        || LA(2) == LITERAL_current_timestamp
7352:                                        || LA(2) == LITERAL_sql_tsi_frac_second
7353:                                        || LA(2) == LITERAL_sql_tsi_second
7354:                                        || LA(2) == LITERAL_sql_tsi_minute
7355:                                        || LA(2) == LITERAL_sql_tsi_hour
7356:                                        || LA(2) == LITERAL_sql_tsi_day
7357:                                        || LA(2) == LITERAL_sql_tsi_week
7358:                                        || LA(2) == LITERAL_sql_tsi_month
7359:                                        || LA(2) == LITERAL_sql_tsi_quarter
7360:                                        || LA(2) == LITERAL_sql_tsi_year
7361:                                        || LA(2) == LITERAL_cast
7362:                                        || LA(2) == LITERAL_true
7363:                                        || LA(2) == LITERAL_false
7364:                                        || LA(2) == LITERAL_avg
7365:                                        || LA(2) == LITERAL_min
7366:                                        || LA(2) == LITERAL_max
7367:                                        || LA(2) == LITERAL_sum
7368:                                        || LA(2) == LITERAL_count || LA(2) == ID)) {
7369:                            op = addOp();
7370:                            f = multExpression();
7371:                            if (inputState.guessing == 0) {
7372:
7373:                                e = new BinaryExpression(op, e, f);
7374:
7375:                            }
7376:                        } else {
7377:                            break _loop261;
7378:                        }
7379:
7380:                    } while (true);
7381:                }
7382:                return e;
7383:            }
7384:
7385:            public final int truthConst() throws RecognitionException,
7386:                    TokenStreamException {
7387:                int t;
7388:
7389:                t = 0;
7390:
7391:                switch (LA(1)) {
7392:                case LITERAL_true: {
7393:                    match(LITERAL_true);
7394:                    if (inputState.guessing == 0) {
7395:                        t = Op.TRUE;
7396:                    }
7397:                    break;
7398:                }
7399:                case LITERAL_false: {
7400:                    match(LITERAL_false);
7401:                    if (inputState.guessing == 0) {
7402:                        t = Op.FALSE;
7403:                    }
7404:                    break;
7405:                }
7406:                case LITERAL_unknown: {
7407:                    match(LITERAL_unknown);
7408:                    if (inputState.guessing == 0) {
7409:                        t = Op.UNKNOWN;
7410:                    }
7411:                    break;
7412:                }
7413:                case LITERAL_null: {
7414:                    match(LITERAL_null);
7415:                    if (inputState.guessing == 0) {
7416:                        t = Op.NULL;
7417:                    }
7418:                    break;
7419:                }
7420:                default: {
7421:                    throw new NoViableAltException(LT(1), getFilename());
7422:                }
7423:                }
7424:                return t;
7425:            }
7426:
7427:            public final int relOp() throws RecognitionException,
7428:                    TokenStreamException {
7429:                int op;
7430:
7431:                op = 0;
7432:
7433:                switch (LA(1)) {
7434:                case LT: {
7435:                    match(LT);
7436:                    if (inputState.guessing == 0) {
7437:                        op = Op.LT;
7438:                    }
7439:                    break;
7440:                }
7441:                case LE: {
7442:                    match(LE);
7443:                    if (inputState.guessing == 0) {
7444:                        op = Op.LE;
7445:                    }
7446:                    break;
7447:                }
7448:                case GT: {
7449:                    match(GT);
7450:                    if (inputState.guessing == 0) {
7451:                        op = Op.GT;
7452:                    }
7453:                    break;
7454:                }
7455:                case GE: {
7456:                    match(GE);
7457:                    if (inputState.guessing == 0) {
7458:                        op = Op.GE;
7459:                    }
7460:                    break;
7461:                }
7462:                case EQ: {
7463:                    match(EQ);
7464:                    if (inputState.guessing == 0) {
7465:                        op = Op.EQ;
7466:                    }
7467:                    break;
7468:                }
7469:                case NE: {
7470:                    match(NE);
7471:                    if (inputState.guessing == 0) {
7472:                        op = Op.NE;
7473:                    }
7474:                    break;
7475:                }
7476:                default: {
7477:                    throw new NoViableAltException(LT(1), getFilename());
7478:                }
7479:                }
7480:                return op;
7481:            }
7482:
7483:            public final int quantifier() throws RecognitionException,
7484:                    TokenStreamException {
7485:                int op;
7486:
7487:                op = 0;
7488:
7489:                switch (LA(1)) {
7490:                case LITERAL_any: {
7491:                    match(LITERAL_any);
7492:                    if (inputState.guessing == 0) {
7493:                        op = Op.ANY;
7494:                    }
7495:                    break;
7496:                }
7497:                case LITERAL_all: {
7498:                    match(LITERAL_all);
7499:                    if (inputState.guessing == 0) {
7500:                        op = Op.ALL;
7501:                    }
7502:                    break;
7503:                }
7504:                case LITERAL_some: {
7505:                    match(LITERAL_some);
7506:                    if (inputState.guessing == 0) {
7507:                        op = Op.ANY;
7508:                    }
7509:                    break;
7510:                }
7511:                default: {
7512:                    throw new NoViableAltException(LT(1), getFilename());
7513:                }
7514:                }
7515:                return op;
7516:            }
7517:
7518:            public final Expression patternExpression()
7519:                    throws RecognitionException, TokenStreamException {
7520:                Expression v;
7521:
7522:                v = null;
7523:                Expression pat = null;
7524:                Expression esc = null;
7525:
7526:                pat = primaryExpression();
7527:                {
7528:                    switch (LA(1)) {
7529:                    case LITERAL_escape: {
7530:                        match(LITERAL_escape);
7531:                        esc = primaryExpression();
7532:                        if (inputState.guessing == 0) {
7533:                            v = new BinaryExpression(Op.PATTERN, pat, esc);
7534:                        }
7535:                        break;
7536:                    }
7537:                    case EOF:
7538:                    case LITERAL_create:
7539:                    case LITERAL_unique:
7540:                    case LITERAL_on:
7541:                    case RPAREN:
7542:                    case LITERAL_constraint:
7543:                    case LITERAL_primary:
7544:                    case LITERAL_check:
7545:                    case LITERAL_first:
7546:                    case LITERAL_after:
7547:                    case LITERAL_default:
7548:                    case LITERAL_as:
7549:                    case LITERAL_with:
7550:                    case COMMA:
7551:                    case LITERAL_where:
7552:                    case LITERAL_from:
7553:                    case LITERAL_grant:
7554:                    case LITERAL_references:
7555:                    case LITERAL_not:
7556:                    case LITERAL_full:
7557:                    case LITERAL_initially:
7558:                    case LITERAL_deferrable:
7559:                    case LITERAL_for:
7560:                    case LITERAL_order:
7561:                    case LITERAL_having:
7562:                    case LITERAL_using:
7563:                    case LITERAL_group:
7564:                    case CONCAT:
7565:                    case LITERAL_or:
7566:                    case LITERAL_and:
7567:                    case LITERAL_when:
7568:                    case LITERAL_then:
7569:                    case LITERAL_else:
7570:                    case LITERAL_end:
7571:                    case LITERAL_left:
7572:                    case LITERAL_right:
7573:                    case LITERAL_cross:
7574:                    case LITERAL_join:
7575:                    case LITERAL_natural:
7576:                    case LITERAL_union:
7577:                    case LITERAL_inner:
7578:                    case LITERAL_intersect:
7579:                    case LITERAL_except:
7580:                    case ID: {
7581:                        if (inputState.guessing == 0) {
7582:                            v = new UnaryExpression(Op.PATTERN, pat);
7583:                        }
7584:                        break;
7585:                    }
7586:                    default: {
7587:                        throw new NoViableAltException(LT(1), getFilename());
7588:                    }
7589:                    }
7590:                }
7591:                return v;
7592:            }
7593:
7594:            public final Expression unaryExpression()
7595:                    throws RecognitionException, TokenStreamException {
7596:                Expression e;
7597:
7598:                e = null;
7599:                int op = 0;
7600:
7601:                {
7602:                    switch (LA(1)) {
7603:                    case PLUS: {
7604:                        match(PLUS);
7605:                        if (inputState.guessing == 0) {
7606:                            op = Op.PLUS;
7607:                        }
7608:                        break;
7609:                    }
7610:                    case MINUS: {
7611:                        match(MINUS);
7612:                        if (inputState.guessing == 0) {
7613:                            op = Op.MINUS;
7614:                        }
7615:                        break;
7616:                    }
7617:                    case LPAREN:
7618:                    case LITERAL_default:
7619:                    case LITERAL_insert:
7620:                    case LITERAL_null:
7621:                    case LITERAL_char:
7622:                    case LITERAL_date:
7623:                    case LITERAL_time:
7624:                    case LITERAL_timestamp:
7625:                    case LITERAL_interval:
7626:                    case STRING_LITERAL:
7627:                    case QUESTION:
7628:                    case INT:
7629:                    case REAL:
7630:                    case BINSTR:
7631:                    case HEXSTR:
7632:                    case LITERAL_case:
7633:                    case LITERAL_hour:
7634:                    case LITERAL_left:
7635:                    case LITERAL_minute:
7636:                    case LITERAL_month:
7637:                    case LITERAL_right:
7638:                    case LITERAL_second:
7639:                    case LITERAL_year:
7640:                    case LITERAL_user:
7641:                    case LITERAL_current_user:
7642:                    case LITERAL_session_user:
7643:                    case LITERAL_system_user:
7644:                    case LITERAL_current_date:
7645:                    case LITERAL_current_time:
7646:                    case LITERAL_current_timestamp:
7647:                    case LITERAL_sql_tsi_frac_second:
7648:                    case LITERAL_sql_tsi_second:
7649:                    case LITERAL_sql_tsi_minute:
7650:                    case LITERAL_sql_tsi_hour:
7651:                    case LITERAL_sql_tsi_day:
7652:                    case LITERAL_sql_tsi_week:
7653:                    case LITERAL_sql_tsi_month:
7654:                    case LITERAL_sql_tsi_quarter:
7655:                    case LITERAL_sql_tsi_year:
7656:                    case LITERAL_cast:
7657:                    case LITERAL_true:
7658:                    case LITERAL_false:
7659:                    case LITERAL_avg:
7660:                    case LITERAL_min:
7661:                    case LITERAL_max:
7662:                    case LITERAL_sum:
7663:                    case LITERAL_count:
7664:                    case ID: {
7665:                        break;
7666:                    }
7667:                    default: {
7668:                        throw new NoViableAltException(LT(1), getFilename());
7669:                    }
7670:                    }
7671:                }
7672:                e = primaryExpression();
7673:                if (inputState.guessing == 0) {
7674:
7675:                    if (op != 0)
7676:                        e = new UnaryExpression(op, e);
7677:
7678:                }
7679:                return e;
7680:            }
7681:
7682:            public final Expression primaryExpression()
7683:                    throws RecognitionException, TokenStreamException {
7684:                Expression e;
7685:
7686:                Token t1 = null;
7687:                Token t4 = null;
7688:                Token t5 = null;
7689:                Token t6 = null;
7690:
7691:                e = null;
7692:                String id = null;
7693:                VectorExpression args = null;
7694:
7695:                switch (LA(1)) {
7696:                case LITERAL_null: {
7697:                    match(LITERAL_null);
7698:                    if (inputState.guessing == 0) {
7699:
7700:                        e = new ValueExpression(new ValueNull());
7701:
7702:                    }
7703:                    break;
7704:                }
7705:                case LITERAL_default: {
7706:                    match(LITERAL_default);
7707:                    if (inputState.guessing == 0) {
7708:
7709:                        e = new ValueExpression(new ValueDefault());
7710:
7711:                    }
7712:                    break;
7713:                }
7714:                case INT: {
7715:                    t1 = LT(1);
7716:                    match(INT);
7717:                    if (inputState.guessing == 0) {
7718:
7719:                        try {
7720:                            ValueInteger x = new ValueInteger(Integer
7721:                                    .parseInt(t1.getText()));
7722:                            e = new ValueExpression(x);
7723:                        } catch (NumberFormatException ne1) {
7724:                            try {
7725:                                ValueLong x = new ValueLong(Long.parseLong(t1
7726:                                        .getText()));
7727:                                e = new ValueExpression(x);
7728:                            } catch (NumberFormatException ne2) {
7729:                                try {
7730:                                    ValueDouble x = new ValueDouble(t1
7731:                                            .getText());
7732:                                    e = new ValueExpression(x);
7733:                                } catch (ValueException ve) {
7734:                                    try {
7735:                                        ValueScaledInteger x = new ValueScaledInteger(
7736:                                                t1.getText());
7737:                                        e = new ValueExpression(x);
7738:                                    } catch (ValueException ve1) {
7739:                                        throw new DbException(ve1);
7740:                                    }
7741:                                }
7742:                            }
7743:                        }
7744:
7745:                    }
7746:                    break;
7747:                }
7748:                case REAL: {
7749:                    t4 = LT(1);
7750:                    match(REAL);
7751:                    if (inputState.guessing == 0) {
7752:
7753:                        try {
7754:                            e = new ValueExpression(new ValueDouble(t4
7755:                                    .getText()));
7756:                        } catch (ValueException ve) {
7757:                            throw new DbException(ve);
7758:                        }
7759:
7760:                    }
7761:                    break;
7762:                }
7763:                case BINSTR: {
7764:                    t5 = LT(1);
7765:                    match(BINSTR);
7766:                    if (inputState.guessing == 0) {
7767:
7768:                        e = new ValueExpression(new ValueOctets(t5.getText()));
7769:
7770:                    }
7771:                    break;
7772:                }
7773:                case HEXSTR: {
7774:                    t6 = LT(1);
7775:                    match(HEXSTR);
7776:                    if (inputState.guessing == 0) {
7777:
7778:                        e = new ValueExpression(new ValueOctets(t6.getText()));
7779:
7780:                    }
7781:                    break;
7782:                }
7783:                case QUESTION: {
7784:                    match(QUESTION);
7785:                    if (inputState.guessing == 0) {
7786:
7787:                        ParameterExpression pe = new ParameterExpression();
7788:                        addParameter(pe);
7789:                        e = pe;
7790:
7791:                    }
7792:                    break;
7793:                }
7794:                case LPAREN: {
7795:                    match(LPAREN);
7796:                    {
7797:                        switch (LA(1)) {
7798:                        case LITERAL_unique:
7799:                        case LPAREN:
7800:                        case LITERAL_default:
7801:                        case LITERAL_insert:
7802:                        case LITERAL_not:
7803:                        case LITERAL_null:
7804:                        case LITERAL_char:
7805:                        case LITERAL_date:
7806:                        case LITERAL_time:
7807:                        case LITERAL_timestamp:
7808:                        case LITERAL_interval:
7809:                        case LITERAL_exists:
7810:                        case PLUS:
7811:                        case MINUS:
7812:                        case STRING_LITERAL:
7813:                        case QUESTION:
7814:                        case INT:
7815:                        case REAL:
7816:                        case BINSTR:
7817:                        case HEXSTR:
7818:                        case LITERAL_case:
7819:                        case LITERAL_hour:
7820:                        case LITERAL_left:
7821:                        case LITERAL_minute:
7822:                        case LITERAL_month:
7823:                        case LITERAL_right:
7824:                        case LITERAL_second:
7825:                        case LITERAL_year:
7826:                        case LITERAL_user:
7827:                        case LITERAL_current_user:
7828:                        case LITERAL_session_user:
7829:                        case LITERAL_system_user:
7830:                        case LITERAL_current_date:
7831:                        case LITERAL_current_time:
7832:                        case LITERAL_current_timestamp:
7833:                        case LITERAL_sql_tsi_frac_second:
7834:                        case LITERAL_sql_tsi_second:
7835:                        case LITERAL_sql_tsi_minute:
7836:                        case LITERAL_sql_tsi_hour:
7837:                        case LITERAL_sql_tsi_day:
7838:                        case LITERAL_sql_tsi_week:
7839:                        case LITERAL_sql_tsi_month:
7840:                        case LITERAL_sql_tsi_quarter:
7841:                        case LITERAL_sql_tsi_year:
7842:                        case LITERAL_cast:
7843:                        case LITERAL_true:
7844:                        case LITERAL_false:
7845:                        case LITERAL_avg:
7846:                        case LITERAL_min:
7847:                        case LITERAL_max:
7848:                        case LITERAL_sum:
7849:                        case LITERAL_count:
7850:                        case ID: {
7851:                            e = expression();
7852:                            break;
7853:                        }
7854:                        case LITERAL_select: {
7855:                            e = querySpecification();
7856:                            break;
7857:                        }
7858:                        default: {
7859:                            throw new NoViableAltException(LT(1), getFilename());
7860:                        }
7861:                        }
7862:                    }
7863:                    match(RPAREN);
7864:                    break;
7865:                }
7866:                case STRING_LITERAL: {
7867:                    e = stringExpression();
7868:                    break;
7869:                }
7870:                case LITERAL_avg:
7871:                case LITERAL_min:
7872:                case LITERAL_max:
7873:                case LITERAL_sum:
7874:                case LITERAL_count: {
7875:                    e = aggregateExpression();
7876:                    break;
7877:                }
7878:                case LITERAL_date:
7879:                case LITERAL_time:
7880:                case LITERAL_timestamp: {
7881:                    e = dateTimeLiteral();
7882:                    break;
7883:                }
7884:                case LITERAL_interval: {
7885:                    e = intervalLiteral();
7886:                    break;
7887:                }
7888:                case LITERAL_true:
7889:                case LITERAL_false: {
7890:                    e = booleanLiteral();
7891:                    break;
7892:                }
7893:                case LITERAL_user:
7894:                case LITERAL_current_user:
7895:                case LITERAL_session_user:
7896:                case LITERAL_system_user:
7897:                case LITERAL_current_date:
7898:                case LITERAL_current_time:
7899:                case LITERAL_current_timestamp:
7900:                case LITERAL_sql_tsi_frac_second:
7901:                case LITERAL_sql_tsi_second:
7902:                case LITERAL_sql_tsi_minute:
7903:                case LITERAL_sql_tsi_hour:
7904:                case LITERAL_sql_tsi_day:
7905:                case LITERAL_sql_tsi_week:
7906:                case LITERAL_sql_tsi_month:
7907:                case LITERAL_sql_tsi_quarter:
7908:                case LITERAL_sql_tsi_year: {
7909:                    e = systemVariable();
7910:                    break;
7911:                }
7912:                case LITERAL_insert:
7913:                case LITERAL_char:
7914:                case LITERAL_hour:
7915:                case LITERAL_left:
7916:                case LITERAL_minute:
7917:                case LITERAL_month:
7918:                case LITERAL_right:
7919:                case LITERAL_second:
7920:                case LITERAL_year:
7921:                case ID: {
7922:                    e = fnvarExpression();
7923:                    break;
7924:                }
7925:                case LITERAL_cast: {
7926:                    e = castExpression();
7927:                    break;
7928:                }
7929:                case LITERAL_case: {
7930:                    e = caseExpression();
7931:                    break;
7932:                }
7933:                default: {
7934:                    throw new NoViableAltException(LT(1), getFilename());
7935:                }
7936:                }
7937:                return e;
7938:            }
7939:
7940:            public final Expression multExpression()
7941:                    throws RecognitionException, TokenStreamException {
7942:                Expression e;
7943:
7944:                e = null;
7945:                Expression f = null;
7946:                int op = 0;
7947:
7948:                e = expExpression();
7949:                {
7950:                    _loop264: do {
7951:                        if ((LA(1) == STAR || LA(1) == SLASH)) {
7952:                            op = mulOp();
7953:                            f = expExpression();
7954:                            if (inputState.guessing == 0) {
7955:
7956:                                e = new BinaryExpression(op, e, f);
7957:
7958:                            }
7959:                        } else {
7960:                            break _loop264;
7961:                        }
7962:
7963:                    } while (true);
7964:                }
7965:                return e;
7966:            }
7967:
7968:            public final int addOp() throws RecognitionException,
7969:                    TokenStreamException {
7970:                int op;
7971:
7972:                op = 0;
7973:
7974:                switch (LA(1)) {
7975:                case PLUS: {
7976:                    match(PLUS);
7977:                    if (inputState.guessing == 0) {
7978:                        op = Op.PLUS;
7979:                    }
7980:                    break;
7981:                }
7982:                case MINUS: {
7983:                    match(MINUS);
7984:                    if (inputState.guessing == 0) {
7985:                        op = Op.MINUS;
7986:                    }
7987:                    break;
7988:                }
7989:                case CONCAT: {
7990:                    match(CONCAT);
7991:                    if (inputState.guessing == 0) {
7992:                        op = Op.CONCAT;
7993:                    }
7994:                    break;
7995:                }
7996:                default: {
7997:                    throw new NoViableAltException(LT(1), getFilename());
7998:                }
7999:                }
8000:                return op;
8001:            }
8002:
8003:            public final Expression expExpression()
8004:                    throws RecognitionException, TokenStreamException {
8005:                Expression e;
8006:
8007:                e = null;
8008:                Expression f = null;
8009:
8010:                e = unaryExpression();
8011:                {
8012:                    _loop267: do {
8013:                        if ((LA(1) == 120)) {
8014:                            match(120);
8015:                            f = unaryExpression();
8016:                            if (inputState.guessing == 0) {
8017:
8018:                                e = new BinaryExpression(Op.EXP, e, f);
8019:
8020:                            }
8021:                        } else {
8022:                            break _loop267;
8023:                        }
8024:
8025:                    } while (true);
8026:                }
8027:                return e;
8028:            }
8029:
8030:            public final int mulOp() throws RecognitionException,
8031:                    TokenStreamException {
8032:                int op;
8033:
8034:                op = 0;
8035:
8036:                switch (LA(1)) {
8037:                case STAR: {
8038:                    match(STAR);
8039:                    if (inputState.guessing == 0) {
8040:                        op = Op.TIMES;
8041:                    }
8042:                    break;
8043:                }
8044:                case SLASH: {
8045:                    match(SLASH);
8046:                    if (inputState.guessing == 0) {
8047:                        op = Op.DIVIDE;
8048:                    }
8049:                    break;
8050:                }
8051:                default: {
8052:                    throw new NoViableAltException(LT(1), getFilename());
8053:                }
8054:                }
8055:                return op;
8056:            }
8057:
8058:            public final Expression patternString()
8059:                    throws RecognitionException, TokenStreamException {
8060:                Expression e;
8061:
8062:                Token t1 = null;
8063:
8064:                e = null;
8065:
8066:                switch (LA(1)) {
8067:                case STRING_LITERAL: {
8068:                    t1 = LT(1);
8069:                    match(STRING_LITERAL);
8070:                    if (inputState.guessing == 0) {
8071:                        e = new ValueExpression(new ValueString(t1.getText()));
8072:                    }
8073:                    break;
8074:                }
8075:                case QUESTION: {
8076:                    match(QUESTION);
8077:                    if (inputState.guessing == 0) {
8078:
8079:                        ParameterExpression pe = new ParameterExpression();
8080:                        addParameter(pe);
8081:                        e = pe;
8082:
8083:                    }
8084:                    break;
8085:                }
8086:                default: {
8087:                    throw new NoViableAltException(LT(1), getFilename());
8088:                }
8089:                }
8090:                return e;
8091:            }
8092:
8093:            public final Expression stringExpression()
8094:                    throws RecognitionException, TokenStreamException {
8095:                Expression e;
8096:
8097:                Token t1 = null;
8098:                Token t2 = null;
8099:
8100:                e = null;
8101:                StringBuffer sb = new StringBuffer();
8102:
8103:                t1 = LT(1);
8104:                match(STRING_LITERAL);
8105:                if (inputState.guessing == 0) {
8106:                    sb.append(t1.getText());
8107:                }
8108:                {
8109:                    _loop287: do {
8110:                        if ((LA(1) == STRING_LITERAL)) {
8111:                            t2 = LT(1);
8112:                            match(STRING_LITERAL);
8113:                            if (inputState.guessing == 0) {
8114:                                sb.append(t2.getText());
8115:                            }
8116:                        } else {
8117:                            break _loop287;
8118:                        }
8119:
8120:                    } while (true);
8121:                }
8122:                if (inputState.guessing == 0) {
8123:
8124:                    e = new ValueExpression(new ValueString(sb.toString()));
8125:
8126:                }
8127:                return e;
8128:            }
8129:
8130:            public final Expression aggregateExpression()
8131:                    throws RecognitionException, TokenStreamException {
8132:                Expression e;
8133:
8134:                e = null;
8135:                int op = -1;
8136:                boolean all = true;
8137:                Expression v = null;
8138:
8139:                {
8140:                    switch (LA(1)) {
8141:                    case LITERAL_avg: {
8142:                        match(LITERAL_avg);
8143:                        if (inputState.guessing == 0) {
8144:                            op = AggregateExpression.AVG;
8145:                        }
8146:                        break;
8147:                    }
8148:                    case LITERAL_min: {
8149:                        match(LITERAL_min);
8150:                        if (inputState.guessing == 0) {
8151:                            op = AggregateExpression.MIN;
8152:                        }
8153:                        break;
8154:                    }
8155:                    case LITERAL_max: {
8156:                        match(LITERAL_max);
8157:                        if (inputState.guessing == 0) {
8158:                            op = AggregateExpression.MAX;
8159:                        }
8160:                        break;
8161:                    }
8162:                    case LITERAL_sum: {
8163:                        match(LITERAL_sum);
8164:                        if (inputState.guessing == 0) {
8165:                            op = AggregateExpression.SUM;
8166:                        }
8167:                        break;
8168:                    }
8169:                    case LITERAL_count: {
8170:                        match(LITERAL_count);
8171:                        if (inputState.guessing == 0) {
8172:                            op = AggregateExpression.COUNT;
8173:                        }
8174:                        break;
8175:                    }
8176:                    default: {
8177:                        throw new NoViableAltException(LT(1), getFilename());
8178:                    }
8179:                    }
8180:                }
8181:                match(LPAREN);
8182:                {
8183:                    switch (LA(1)) {
8184:                    case LITERAL_all: {
8185:                        match(LITERAL_all);
8186:                        if (inputState.guessing == 0) {
8187:                            all = true;
8188:                        }
8189:                        break;
8190:                    }
8191:                    case LITERAL_distinct: {
8192:                        match(LITERAL_distinct);
8193:                        if (inputState.guessing == 0) {
8194:                            all = false;
8195:                        }
8196:                        break;
8197:                    }
8198:                    case LITERAL_unique:
8199:                    case LPAREN:
8200:                    case LITERAL_default:
8201:                    case LITERAL_insert:
8202:                    case LITERAL_not:
8203:                    case LITERAL_null:
8204:                    case LITERAL_char:
8205:                    case LITERAL_date:
8206:                    case LITERAL_time:
8207:                    case LITERAL_timestamp:
8208:                    case LITERAL_interval:
8209:                    case STAR:
8210:                    case LITERAL_exists:
8211:                    case PLUS:
8212:                    case MINUS:
8213:                    case STRING_LITERAL:
8214:                    case QUESTION:
8215:                    case INT:
8216:                    case REAL:
8217:                    case BINSTR:
8218:                    case HEXSTR:
8219:                    case LITERAL_case:
8220:                    case LITERAL_hour:
8221:                    case LITERAL_left:
8222:                    case LITERAL_minute:
8223:                    case LITERAL_month:
8224:                    case LITERAL_right:
8225:                    case LITERAL_second:
8226:                    case LITERAL_year:
8227:                    case LITERAL_user:
8228:                    case LITERAL_current_user:
8229:                    case LITERAL_session_user:
8230:                    case LITERAL_system_user:
8231:                    case LITERAL_current_date:
8232:                    case LITERAL_current_time:
8233:                    case LITERAL_current_timestamp:
8234:                    case LITERAL_sql_tsi_frac_second:
8235:                    case LITERAL_sql_tsi_second:
8236:                    case LITERAL_sql_tsi_minute:
8237:                    case LITERAL_sql_tsi_hour:
8238:                    case LITERAL_sql_tsi_day:
8239:                    case LITERAL_sql_tsi_week:
8240:                    case LITERAL_sql_tsi_month:
8241:                    case LITERAL_sql_tsi_quarter:
8242:                    case LITERAL_sql_tsi_year:
8243:                    case LITERAL_cast:
8244:                    case LITERAL_true:
8245:                    case LITERAL_false:
8246:                    case LITERAL_avg:
8247:                    case LITERAL_min:
8248:                    case LITERAL_max:
8249:                    case LITERAL_sum:
8250:                    case LITERAL_count:
8251:                    case ID: {
8252:                        break;
8253:                    }
8254:                    default: {
8255:                        throw new NoViableAltException(LT(1), getFilename());
8256:                    }
8257:                    }
8258:                }
8259:                {
8260:                    switch (LA(1)) {
8261:                    case STAR: {
8262:                        match(STAR);
8263:                        break;
8264:                    }
8265:                    case LITERAL_unique:
8266:                    case LPAREN:
8267:                    case LITERAL_default:
8268:                    case LITERAL_insert:
8269:                    case LITERAL_not:
8270:                    case LITERAL_null:
8271:                    case LITERAL_char:
8272:                    case LITERAL_date:
8273:                    case LITERAL_time:
8274:                    case LITERAL_timestamp:
8275:                    case LITERAL_interval:
8276:                    case LITERAL_exists:
8277:                    case PLUS:
8278:                    case MINUS:
8279:                    case STRING_LITERAL:
8280:                    case QUESTION:
8281:                    case INT:
8282:                    case REAL:
8283:                    case BINSTR:
8284:                    case HEXSTR:
8285:                    case LITERAL_case:
8286:                    case LITERAL_hour:
8287:                    case LITERAL_left:
8288:                    case LITERAL_minute:
8289:                    case LITERAL_month:
8290:                    case LITERAL_right:
8291:                    case LITERAL_second:
8292:                    case LITERAL_year:
8293:                    case LITERAL_user:
8294:                    case LITERAL_current_user:
8295:                    case LITERAL_session_user:
8296:                    case LITERAL_system_user:
8297:                    case LITERAL_current_date:
8298:                    case LITERAL_current_time:
8299:                    case LITERAL_current_timestamp:
8300:                    case LITERAL_sql_tsi_frac_second:
8301:                    case LITERAL_sql_tsi_second:
8302:                    case LITERAL_sql_tsi_minute:
8303:                    case LITERAL_sql_tsi_hour:
8304:                    case LITERAL_sql_tsi_day:
8305:                    case LITERAL_sql_tsi_week:
8306:                    case LITERAL_sql_tsi_month:
8307:                    case LITERAL_sql_tsi_quarter:
8308:                    case LITERAL_sql_tsi_year:
8309:                    case LITERAL_cast:
8310:                    case LITERAL_true:
8311:                    case LITERAL_false:
8312:                    case LITERAL_avg:
8313:                    case LITERAL_min:
8314:                    case LITERAL_max:
8315:                    case LITERAL_sum:
8316:                    case LITERAL_count:
8317:                    case ID: {
8318:                        v = expression();
8319:                        break;
8320:                    }
8321:                    default: {
8322:                        throw new NoViableAltException(LT(1), getFilename());
8323:                    }
8324:                    }
8325:                }
8326:                match(RPAREN);
8327:                if (inputState.guessing == 0) {
8328:                    e = new AggregateExpression(op, all, v);
8329:                }
8330:                return e;
8331:            }
8332:
8333:            public final Expression dateTimeLiteral()
8334:                    throws RecognitionException, TokenStreamException {
8335:                Expression e;
8336:
8337:                Token d1 = null;
8338:                Token d2 = null;
8339:                Token d3 = null;
8340:
8341:                e = null;
8342:
8343:                switch (LA(1)) {
8344:                case LITERAL_date: {
8345:                    match(LITERAL_date);
8346:                    d1 = LT(1);
8347:                    match(STRING_LITERAL);
8348:                    if (inputState.guessing == 0) {
8349:
8350:                        ValueDate x = new ValueDate(d1.getText());
8351:                        e = new ValueExpression(x);
8352:
8353:                    }
8354:                    break;
8355:                }
8356:                case LITERAL_time: {
8357:                    match(LITERAL_time);
8358:                    d2 = LT(1);
8359:                    match(STRING_LITERAL);
8360:                    if (inputState.guessing == 0) {
8361:
8362:                        ValueTime x = new ValueTime(d2.getText());
8363:                        e = new ValueExpression(x);
8364:
8365:                    }
8366:                    break;
8367:                }
8368:                case LITERAL_timestamp: {
8369:                    match(LITERAL_timestamp);
8370:                    d3 = LT(1);
8371:                    match(STRING_LITERAL);
8372:                    if (inputState.guessing == 0) {
8373:
8374:                        ValueTimestamp x = new ValueTimestamp(d3.getText());
8375:                        e = new ValueExpression(x);
8376:
8377:                    }
8378:                    break;
8379:                }
8380:                default: {
8381:                    throw new NoViableAltException(LT(1), getFilename());
8382:                }
8383:                }
8384:                return e;
8385:            }
8386:
8387:            public final Expression intervalLiteral()
8388:                    throws RecognitionException, TokenStreamException {
8389:                Expression e;
8390:
8391:                Token d1 = null;
8392:
8393:                e = null;
8394:                int sign = 1;
8395:                TypeInterval type = null;
8396:
8397:                match(LITERAL_interval);
8398:                {
8399:                    switch (LA(1)) {
8400:                    case PLUS: {
8401:                        match(PLUS);
8402:                        break;
8403:                    }
8404:                    case MINUS: {
8405:                        match(MINUS);
8406:                        if (inputState.guessing == 0) {
8407:                            sign = -1;
8408:                        }
8409:                        break;
8410:                    }
8411:                    case STRING_LITERAL: {
8412:                        break;
8413:                    }
8414:                    default: {
8415:                        throw new NoViableAltException(LT(1), getFilename());
8416:                    }
8417:                    }
8418:                }
8419:                d1 = LT(1);
8420:                match(STRING_LITERAL);
8421:                {
8422:                    switch (LA(1)) {
8423:                    case LITERAL_hour:
8424:                    case LITERAL_minute:
8425:                    case LITERAL_month:
8426:                    case LITERAL_second:
8427:                    case LITERAL_year:
8428:                    case LITERAL_day: {
8429:                        type = intervalQualifier();
8430:                        break;
8431:                    }
8432:                    case EOF:
8433:                    case LITERAL_create:
8434:                    case LITERAL_unique:
8435:                    case LITERAL_on:
8436:                    case RPAREN:
8437:                    case LITERAL_constraint:
8438:                    case LITERAL_primary:
8439:                    case LITERAL_check:
8440:                    case LITERAL_first:
8441:                    case LITERAL_after:
8442:                    case LITERAL_default:
8443:                    case LITERAL_as:
8444:                    case LITERAL_with:
8445:                    case COMMA:
8446:                    case LITERAL_where:
8447:                    case EQ:
8448:                    case LITERAL_from:
8449:                    case LITERAL_grant:
8450:                    case LITERAL_references:
8451:                    case LITERAL_not:
8452:                    case LITERAL_full:
8453:                    case LITERAL_initially:
8454:                    case LITERAL_deferrable:
8455:                    case LITERAL_for:
8456:                    case LITERAL_order:
8457:                    case STAR:
8458:                    case LITERAL_having:
8459:                    case LITERAL_using:
8460:                    case LITERAL_group:
8461:                    case CONCAT:
8462:                    case LITERAL_or:
8463:                    case LITERAL_and:
8464:                    case LITERAL_is:
8465:                    case LITERAL_like:
8466:                    case LITERAL_between:
8467:                    case LITERAL_in:
8468:                    case LITERAL_escape:
8469:                    case 120:
8470:                    case PLUS:
8471:                    case MINUS:
8472:                    case LITERAL_when:
8473:                    case LITERAL_then:
8474:                    case LITERAL_else:
8475:                    case LITERAL_end:
8476:                    case LITERAL_left:
8477:                    case LITERAL_right:
8478:                    case LT:
8479:                    case LE:
8480:                    case GT:
8481:                    case GE:
8482:                    case NE:
8483:                    case SLASH:
8484:                    case LITERAL_cross:
8485:                    case LITERAL_join:
8486:                    case LITERAL_natural:
8487:                    case LITERAL_union:
8488:                    case LITERAL_inner:
8489:                    case LITERAL_intersect:
8490:                    case LITERAL_except:
8491:                    case ID: {
8492:                        break;
8493:                    }
8494:                    default: {
8495:                        throw new NoViableAltException(LT(1), getFilename());
8496:                    }
8497:                    }
8498:                }
8499:                if (inputState.guessing == 0) {
8500:
8501:                    ValueInterval x = new ValueInterval(d1.getText(), sign,
8502:                            type);
8503:                    e = new ValueExpression(x);
8504:
8505:                }
8506:                return e;
8507:            }
8508:
8509:            public final Expression booleanLiteral()
8510:                    throws RecognitionException, TokenStreamException {
8511:                Expression e;
8512:
8513:                e = null;
8514:
8515:                switch (LA(1)) {
8516:                case LITERAL_true: {
8517:                    match(LITERAL_true);
8518:                    if (inputState.guessing == 0) {
8519:                        e = new ValueExpression(ValueBoolean.trueBoolean);
8520:                    }
8521:                    break;
8522:                }
8523:                case LITERAL_false: {
8524:                    match(LITERAL_false);
8525:                    if (inputState.guessing == 0) {
8526:                        e = new ValueExpression(ValueBoolean.falseBoolean);
8527:                    }
8528:                    break;
8529:                }
8530:                default: {
8531:                    throw new NoViableAltException(LT(1), getFilename());
8532:                }
8533:                }
8534:                return e;
8535:            }
8536:
8537:            public final Expression systemVariable()
8538:                    throws RecognitionException, TokenStreamException {
8539:                Expression e;
8540:
8541:                e = null;
8542:
8543:                switch (LA(1)) {
8544:                case LITERAL_user:
8545:                case LITERAL_current_user:
8546:                case LITERAL_session_user: {
8547:                    {
8548:                        switch (LA(1)) {
8549:                        case LITERAL_user: {
8550:                            match(LITERAL_user);
8551:                            break;
8552:                        }
8553:                        case LITERAL_current_user: {
8554:                            match(LITERAL_current_user);
8555:                            break;
8556:                        }
8557:                        case LITERAL_session_user: {
8558:                            match(LITERAL_session_user);
8559:                            break;
8560:                        }
8561:                        default: {
8562:                            throw new NoViableAltException(LT(1), getFilename());
8563:                        }
8564:                        }
8565:                    }
8566:                    if (inputState.guessing == 0) {
8567:                        e = new ValueExpression(
8568:                                new ValueString(qConn.getAuth()));
8569:                    }
8570:                    break;
8571:                }
8572:                case LITERAL_system_user: {
8573:                    match(LITERAL_system_user);
8574:                    if (inputState.guessing == 0) {
8575:                        e = new ValueExpression(new ValueString(System
8576:                                .getProperty("user.name")));
8577:                    }
8578:                    break;
8579:                }
8580:                case LITERAL_current_date: {
8581:                    match(LITERAL_current_date);
8582:                    if (inputState.guessing == 0) {
8583:                        e = new ValueExpression(new ValueDate(System
8584:                                .currentTimeMillis()));
8585:                    }
8586:                    break;
8587:                }
8588:                case LITERAL_current_time: {
8589:                    match(LITERAL_current_time);
8590:                    if (inputState.guessing == 0) {
8591:                        e = new ValueExpression(new ValueTime(System
8592:                                .currentTimeMillis()));
8593:                    }
8594:                    break;
8595:                }
8596:                case LITERAL_current_timestamp: {
8597:                    match(LITERAL_current_timestamp);
8598:                    if (inputState.guessing == 0) {
8599:                        e = new ValueExpression(new ValueTimestamp(System
8600:                                .currentTimeMillis()));
8601:                    }
8602:                    break;
8603:                }
8604:                case LITERAL_sql_tsi_frac_second: {
8605:                    match(LITERAL_sql_tsi_frac_second);
8606:                    if (inputState.guessing == 0) {
8607:                        e = new ValueExpression(new ValueInteger(
8608:                                FunctionExpression.TSI_FRAC_SECOND));
8609:                    }
8610:                    break;
8611:                }
8612:                case LITERAL_sql_tsi_second: {
8613:                    match(LITERAL_sql_tsi_second);
8614:                    if (inputState.guessing == 0) {
8615:                        e = new ValueExpression(new ValueInteger(
8616:                                FunctionExpression.TSI_SECOND));
8617:                    }
8618:                    break;
8619:                }
8620:                case LITERAL_sql_tsi_minute: {
8621:                    match(LITERAL_sql_tsi_minute);
8622:                    if (inputState.guessing == 0) {
8623:                        e = new ValueExpression(new ValueInteger(
8624:                                FunctionExpression.TSI_MINUTE));
8625:                    }
8626:                    break;
8627:                }
8628:                case LITERAL_sql_tsi_hour: {
8629:                    match(LITERAL_sql_tsi_hour);
8630:                    if (inputState.guessing == 0) {
8631:                        e = new ValueExpression(new ValueInteger(
8632:                                FunctionExpression.TSI_HOUR));
8633:                    }
8634:                    break;
8635:                }
8636:                case LITERAL_sql_tsi_day: {
8637:                    match(LITERAL_sql_tsi_day);
8638:                    if (inputState.guessing == 0) {
8639:                        e = new ValueExpression(new ValueInteger(
8640:                                FunctionExpression.TSI_DAY));
8641:                    }
8642:                    break;
8643:                }
8644:                case LITERAL_sql_tsi_week: {
8645:                    match(LITERAL_sql_tsi_week);
8646:                    if (inputState.guessing == 0) {
8647:                        e = new ValueExpression(new ValueInteger(
8648:                                FunctionExpression.TSI_WEEK));
8649:                    }
8650:                    break;
8651:                }
8652:                case LITERAL_sql_tsi_month: {
8653:                    match(LITERAL_sql_tsi_month);
8654:                    if (inputState.guessing == 0) {
8655:                        e = new ValueExpression(new ValueInteger(
8656:                                FunctionExpression.TSI_MONTH));
8657:                    }
8658:                    break;
8659:                }
8660:                case LITERAL_sql_tsi_quarter: {
8661:                    match(LITERAL_sql_tsi_quarter);
8662:                    if (inputState.guessing == 0) {
8663:                        e = new ValueExpression(new ValueInteger(
8664:                                FunctionExpression.TSI_QUARTER));
8665:                    }
8666:                    break;
8667:                }
8668:                case LITERAL_sql_tsi_year: {
8669:                    match(LITERAL_sql_tsi_year);
8670:                    if (inputState.guessing == 0) {
8671:                        e = new ValueExpression(new ValueInteger(
8672:                                FunctionExpression.TSI_YEAR));
8673:                    }
8674:                    break;
8675:                }
8676:                default: {
8677:                    throw new NoViableAltException(LT(1), getFilename());
8678:                }
8679:                }
8680:                return e;
8681:            }
8682:
8683:            public final Expression fnvarExpression()
8684:                    throws RecognitionException, TokenStreamException {
8685:                Expression e;
8686:
8687:                e = null;
8688:                String id = null;
8689:                VectorExpression args = null;
8690:
8691:                id = functionId();
8692:                {
8693:                    switch (LA(1)) {
8694:                    case LPAREN: {
8695:                        args = vectorExpression();
8696:                        break;
8697:                    }
8698:                    case EOF:
8699:                    case LITERAL_create:
8700:                    case LITERAL_unique:
8701:                    case LITERAL_on:
8702:                    case RPAREN:
8703:                    case LITERAL_constraint:
8704:                    case LITERAL_primary:
8705:                    case LITERAL_check:
8706:                    case LITERAL_first:
8707:                    case LITERAL_after:
8708:                    case LITERAL_default:
8709:                    case LITERAL_as:
8710:                    case LITERAL_with:
8711:                    case COMMA:
8712:                    case LITERAL_where:
8713:                    case EQ:
8714:                    case LITERAL_from:
8715:                    case LITERAL_grant:
8716:                    case LITERAL_references:
8717:                    case LITERAL_not:
8718:                    case LITERAL_full:
8719:                    case LITERAL_initially:
8720:                    case LITERAL_deferrable:
8721:                    case LITERAL_for:
8722:                    case LITERAL_order:
8723:                    case STAR:
8724:                    case LITERAL_having:
8725:                    case LITERAL_using:
8726:                    case LITERAL_group:
8727:                    case CONCAT:
8728:                    case LITERAL_or:
8729:                    case LITERAL_and:
8730:                    case LITERAL_is:
8731:                    case LITERAL_like:
8732:                    case LITERAL_between:
8733:                    case LITERAL_in:
8734:                    case LITERAL_escape:
8735:                    case 120:
8736:                    case PLUS:
8737:                    case MINUS:
8738:                    case LITERAL_when:
8739:                    case LITERAL_then:
8740:                    case LITERAL_else:
8741:                    case LITERAL_end:
8742:                    case LITERAL_left:
8743:                    case LITERAL_right:
8744:                    case LT:
8745:                    case LE:
8746:                    case GT:
8747:                    case GE:
8748:                    case NE:
8749:                    case SLASH:
8750:                    case LITERAL_cross:
8751:                    case LITERAL_join:
8752:                    case LITERAL_natural:
8753:                    case LITERAL_union:
8754:                    case LITERAL_inner:
8755:                    case LITERAL_intersect:
8756:                    case LITERAL_except:
8757:                    case ID: {
8758:                        break;
8759:                    }
8760:                    default: {
8761:                        throw new NoViableAltException(LT(1), getFilename());
8762:                    }
8763:                    }
8764:                }
8765:                if (inputState.guessing == 0) {
8766:
8767:                    if (args == null)
8768:                        e = new NameExpression(id);
8769:                    else
8770:                        e = new FunctionExpression(id, args);
8771:
8772:                }
8773:                return e;
8774:            }
8775:
8776:            public final Expression castExpression()
8777:                    throws RecognitionException, TokenStreamException {
8778:                Expression e;
8779:
8780:                e = null;
8781:                Expression f = null;
8782:                Type type;
8783:
8784:                match(LITERAL_cast);
8785:                match(LPAREN);
8786:                f = scalarExpression();
8787:                match(LITERAL_as);
8788:                type = type();
8789:                match(RPAREN);
8790:                if (inputState.guessing == 0) {
8791:
8792:                    VectorExpression v = new VectorExpression();
8793:                    v.addElement(f);
8794:                    v.addElement(new ValueExpression(new ValueType(type)));
8795:                    e = new FunctionExpression("cast", v);
8796:
8797:                }
8798:                return e;
8799:            }
8800:
8801:            public final Expression caseExpression()
8802:                    throws RecognitionException, TokenStreamException {
8803:                Expression e;
8804:
8805:                e = null;
8806:                VectorExpression c = null;
8807:                Expression ex = null;
8808:
8809:                match(LITERAL_case);
8810:                if (inputState.guessing == 0) {
8811:                    c = new VectorExpression();
8812:                }
8813:                {
8814:                    _loop275: do {
8815:                        if ((LA(1) == LITERAL_when)) {
8816:                            match(LITERAL_when);
8817:                            ex = expression();
8818:                            if (inputState.guessing == 0) {
8819:                                c.addElement(ex);
8820:                            }
8821:                            match(LITERAL_then);
8822:                            ex = expression();
8823:                            if (inputState.guessing == 0) {
8824:                                c.addElement(ex);
8825:                            }
8826:                        } else {
8827:                            break _loop275;
8828:                        }
8829:
8830:                    } while (true);
8831:                }
8832:                {
8833:                    switch (LA(1)) {
8834:                    case LITERAL_else: {
8835:                        match(LITERAL_else);
8836:                        ex = expression();
8837:                        if (inputState.guessing == 0) {
8838:                            c.addElement(ex);
8839:                        }
8840:                        break;
8841:                    }
8842:                    case LITERAL_end: {
8843:                        break;
8844:                    }
8845:                    default: {
8846:                        throw new NoViableAltException(LT(1), getFilename());
8847:                    }
8848:                    }
8849:                }
8850:                match(LITERAL_end);
8851:                if (inputState.guessing == 0) {
8852:                    e = new FunctionExpression("case", c);
8853:                }
8854:                return e;
8855:            }
8856:
8857:            public final String functionId() throws RecognitionException,
8858:                    TokenStreamException {
8859:                String id;
8860:
8861:                id = null;
8862:
8863:                switch (LA(1)) {
8864:                case ID: {
8865:                    id = sqlId();
8866:                    break;
8867:                }
8868:                case LITERAL_char: {
8869:                    match(LITERAL_char);
8870:                    if (inputState.guessing == 0) {
8871:                        id = "char";
8872:                    }
8873:                    break;
8874:                }
8875:                case LITERAL_hour: {
8876:                    match(LITERAL_hour);
8877:                    if (inputState.guessing == 0) {
8878:                        id = "hour";
8879:                    }
8880:                    break;
8881:                }
8882:                case LITERAL_insert: {
8883:                    match(LITERAL_insert);
8884:                    if (inputState.guessing == 0) {
8885:                        id = "insert";
8886:                    }
8887:                    break;
8888:                }
8889:                case LITERAL_left: {
8890:                    match(LITERAL_left);
8891:                    if (inputState.guessing == 0) {
8892:                        id = "left";
8893:                    }
8894:                    break;
8895:                }
8896:                case LITERAL_minute: {
8897:                    match(LITERAL_minute);
8898:                    if (inputState.guessing == 0) {
8899:                        id = "minute";
8900:                    }
8901:                    break;
8902:                }
8903:                case LITERAL_month: {
8904:                    match(LITERAL_month);
8905:                    if (inputState.guessing == 0) {
8906:                        id = "month";
8907:                    }
8908:                    break;
8909:                }
8910:                case LITERAL_right: {
8911:                    match(LITERAL_right);
8912:                    if (inputState.guessing == 0) {
8913:                        id = "right";
8914:                    }
8915:                    break;
8916:                }
8917:                case LITERAL_second: {
8918:                    match(LITERAL_second);
8919:                    if (inputState.guessing == 0) {
8920:                        id = "second";
8921:                    }
8922:                    break;
8923:                }
8924:                case LITERAL_year: {
8925:                    match(LITERAL_year);
8926:                    if (inputState.guessing == 0) {
8927:                        id = "year";
8928:                    }
8929:                    break;
8930:                }
8931:                default: {
8932:                    throw new NoViableAltException(LT(1), getFilename());
8933:                }
8934:                }
8935:                return id;
8936:            }
8937:
8938:            public final TypeInterval intervalRange()
8939:                    throws RecognitionException, TokenStreamException {
8940:                TypeInterval type;
8941:
8942:                type = null;
8943:                int start = 0;
8944:                int startPrecision = 2;
8945:                int end = 0;
8946:                int secPrecision = 6;
8947:
8948:                {
8949:                    switch (LA(1)) {
8950:                    case LITERAL_year: {
8951:                        match(LITERAL_year);
8952:                        if (inputState.guessing == 0) {
8953:                            start = TypeInterval.YEAR;
8954:                        }
8955:                        break;
8956:                    }
8957:                    case LITERAL_day: {
8958:                        match(LITERAL_day);
8959:                        if (inputState.guessing == 0) {
8960:                            start = TypeInterval.DAY;
8961:                        }
8962:                        break;
8963:                    }
8964:                    case LITERAL_hour: {
8965:                        match(LITERAL_hour);
8966:                        if (inputState.guessing == 0) {
8967:                            start = TypeInterval.HOUR;
8968:                        }
8969:                        break;
8970:                    }
8971:                    case LITERAL_minute: {
8972:                        match(LITERAL_minute);
8973:                        if (inputState.guessing == 0) {
8974:                            start = TypeInterval.MINUTE;
8975:                        }
8976:                        break;
8977:                    }
8978:                    default: {
8979:                        throw new NoViableAltException(LT(1), getFilename());
8980:                    }
8981:                    }
8982:                }
8983:                {
8984:                    switch (LA(1)) {
8985:                    case LPAREN: {
8986:                        match(LPAREN);
8987:                        startPrecision = integer();
8988:                        match(RPAREN);
8989:                        break;
8990:                    }
8991:                    case LITERAL_to: {
8992:                        break;
8993:                    }
8994:                    default: {
8995:                        throw new NoViableAltException(LT(1), getFilename());
8996:                    }
8997:                    }
8998:                }
8999:                match(LITERAL_to);
9000:                {
9001:                    switch (LA(1)) {
9002:                    case LITERAL_year: {
9003:                        match(LITERAL_year);
9004:                        if (inputState.guessing == 0) {
9005:                            end = TypeInterval.YEAR;
9006:                        }
9007:                        break;
9008:                    }
9009:                    case LITERAL_month: {
9010:                        match(LITERAL_month);
9011:                        if (inputState.guessing == 0) {
9012:                            end = TypeInterval.MONTH;
9013:                        }
9014:                        break;
9015:                    }
9016:                    case LITERAL_day: {
9017:                        match(LITERAL_day);
9018:                        if (inputState.guessing == 0) {
9019:                            end = TypeInterval.DAY;
9020:                        }
9021:                        break;
9022:                    }
9023:                    case LITERAL_hour: {
9024:                        match(LITERAL_hour);
9025:                        if (inputState.guessing == 0) {
9026:                            end = TypeInterval.HOUR;
9027:                        }
9028:                        break;
9029:                    }
9030:                    case LITERAL_minute: {
9031:                        match(LITERAL_minute);
9032:                        if (inputState.guessing == 0) {
9033:                            end = TypeInterval.MINUTE;
9034:                        }
9035:                        break;
9036:                    }
9037:                    case LITERAL_second: {
9038:                        match(LITERAL_second);
9039:                        if (inputState.guessing == 0) {
9040:                            end = TypeInterval.SECOND;
9041:                        }
9042:                        {
9043:                            switch (LA(1)) {
9044:                            case LPAREN: {
9045:                                match(LPAREN);
9046:                                secPrecision = integer();
9047:                                match(RPAREN);
9048:                                break;
9049:                            }
9050:                            case EOF:
9051:                            case LITERAL_create:
9052:                            case LITERAL_unique:
9053:                            case LITERAL_on:
9054:                            case RPAREN:
9055:                            case LITERAL_constraint:
9056:                            case LITERAL_primary:
9057:                            case LITERAL_check:
9058:                            case LITERAL_first:
9059:                            case LITERAL_after:
9060:                            case LITERAL_default:
9061:                            case LITERAL_as:
9062:                            case LITERAL_with:
9063:                            case COMMA:
9064:                            case LITERAL_where:
9065:                            case EQ:
9066:                            case LITERAL_from:
9067:                            case LITERAL_grant:
9068:                            case LITERAL_references:
9069:                            case LITERAL_not:
9070:                            case LITERAL_full:
9071:                            case LITERAL_initially:
9072:                            case LITERAL_deferrable:
9073:                            case LITERAL_for:
9074:                            case LITERAL_order:
9075:                            case STAR:
9076:                            case LITERAL_having:
9077:                            case LITERAL_using:
9078:                            case LITERAL_group:
9079:                            case CONCAT:
9080:                            case LITERAL_or:
9081:                            case LITERAL_and:
9082:                            case LITERAL_is:
9083:                            case LITERAL_like:
9084:                            case LITERAL_between:
9085:                            case LITERAL_in:
9086:                            case LITERAL_escape:
9087:                            case 120:
9088:                            case PLUS:
9089:                            case MINUS:
9090:                            case LITERAL_when:
9091:                            case LITERAL_then:
9092:                            case LITERAL_else:
9093:                            case LITERAL_end:
9094:                            case LITERAL_left:
9095:                            case LITERAL_right:
9096:                            case LT:
9097:                            case LE:
9098:                            case GT:
9099:                            case GE:
9100:                            case NE:
9101:                            case SLASH:
9102:                            case LITERAL_cross:
9103:                            case LITERAL_join:
9104:                            case LITERAL_natural:
9105:                            case LITERAL_union:
9106:                            case LITERAL_inner:
9107:                            case LITERAL_intersect:
9108:                            case LITERAL_except:
9109:                            case ID: {
9110:                                break;
9111:                            }
9112:                            default: {
9113:                                throw new NoViableAltException(LT(1),
9114:                                        getFilename());
9115:                            }
9116:                            }
9117:                        }
9118:                        break;
9119:                    }
9120:                    default: {
9121:                        throw new NoViableAltException(LT(1), getFilename());
9122:                    }
9123:                    }
9124:                }
9125:                if (inputState.guessing == 0) {
9126:                    type = new TypeInterval(start, startPrecision, end,
9127:                            secPrecision);
9128:                }
9129:                return type;
9130:            }
9131:
9132:            public final TypeInterval intervalSingleField()
9133:                    throws RecognitionException, TokenStreamException {
9134:                TypeInterval type;
9135:
9136:                type = null;
9137:                int start = 0;
9138:                int startPrecision = 2;
9139:                int secPrecision = 6;
9140:
9141:                switch (LA(1)) {
9142:                case LITERAL_hour:
9143:                case LITERAL_minute:
9144:                case LITERAL_month:
9145:                case LITERAL_year:
9146:                case LITERAL_day: {
9147:                    {
9148:                        switch (LA(1)) {
9149:                        case LITERAL_year: {
9150:                            match(LITERAL_year);
9151:                            if (inputState.guessing == 0) {
9152:                                start = TypeInterval.YEAR;
9153:                            }
9154:                            break;
9155:                        }
9156:                        case LITERAL_month: {
9157:                            match(LITERAL_month);
9158:                            if (inputState.guessing == 0) {
9159:                                start = TypeInterval.MONTH;
9160:                            }
9161:                            break;
9162:                        }
9163:                        case LITERAL_day: {
9164:                            match(LITERAL_day);
9165:                            if (inputState.guessing == 0) {
9166:                                start = TypeInterval.DAY;
9167:                            }
9168:                            break;
9169:                        }
9170:                        case LITERAL_hour: {
9171:                            match(LITERAL_hour);
9172:                            if (inputState.guessing == 0) {
9173:                                start = TypeInterval.HOUR;
9174:                            }
9175:                            break;
9176:                        }
9177:                        case LITERAL_minute: {
9178:                            match(LITERAL_minute);
9179:                            if (inputState.guessing == 0) {
9180:                                start = TypeInterval.MINUTE;
9181:                            }
9182:                            break;
9183:                        }
9184:                        default: {
9185:                            throw new NoViableAltException(LT(1), getFilename());
9186:                        }
9187:                        }
9188:                    }
9189:                    {
9190:                        switch (LA(1)) {
9191:                        case LPAREN: {
9192:                            match(LPAREN);
9193:                            startPrecision = integer();
9194:                            match(RPAREN);
9195:                            break;
9196:                        }
9197:                        case EOF:
9198:                        case LITERAL_create:
9199:                        case LITERAL_unique:
9200:                        case LITERAL_on:
9201:                        case RPAREN:
9202:                        case LITERAL_constraint:
9203:                        case LITERAL_primary:
9204:                        case LITERAL_check:
9205:                        case LITERAL_first:
9206:                        case LITERAL_after:
9207:                        case LITERAL_default:
9208:                        case LITERAL_as:
9209:                        case LITERAL_with:
9210:                        case COMMA:
9211:                        case LITERAL_where:
9212:                        case EQ:
9213:                        case LITERAL_from:
9214:                        case LITERAL_grant:
9215:                        case LITERAL_references:
9216:                        case LITERAL_not:
9217:                        case LITERAL_full:
9218:                        case LITERAL_initially:
9219:                        case LITERAL_deferrable:
9220:                        case LITERAL_for:
9221:                        case LITERAL_order:
9222:                        case STAR:
9223:                        case LITERAL_having:
9224:                        case LITERAL_using:
9225:                        case LITERAL_group:
9226:                        case CONCAT:
9227:                        case LITERAL_or:
9228:                        case LITERAL_and:
9229:                        case LITERAL_is:
9230:                        case LITERAL_like:
9231:                        case LITERAL_between:
9232:                        case LITERAL_in:
9233:                        case LITERAL_escape:
9234:                        case 120:
9235:                        case PLUS:
9236:                        case MINUS:
9237:                        case LITERAL_when:
9238:                        case LITERAL_then:
9239:                        case LITERAL_else:
9240:                        case LITERAL_end:
9241:                        case LITERAL_left:
9242:                        case LITERAL_right:
9243:                        case LT:
9244:                        case LE:
9245:                        case GT:
9246:                        case GE:
9247:                        case NE:
9248:                        case SLASH:
9249:                        case LITERAL_cross:
9250:                        case LITERAL_join:
9251:                        case LITERAL_natural:
9252:                        case LITERAL_union:
9253:                        case LITERAL_inner:
9254:                        case LITERAL_intersect:
9255:                        case LITERAL_except:
9256:                        case ID: {
9257:                            break;
9258:                        }
9259:                        default: {
9260:                            throw new NoViableAltException(LT(1), getFilename());
9261:                        }
9262:                        }
9263:                    }
9264:                    if (inputState.guessing == 0) {
9265:                        type = new TypeInterval(start, startPrecision, 0);
9266:                    }
9267:                    break;
9268:                }
9269:                case LITERAL_second: {
9270:                    match(LITERAL_second);
9271:                    {
9272:                        switch (LA(1)) {
9273:                        case LPAREN: {
9274:                            match(LPAREN);
9275:                            startPrecision = integer();
9276:                            {
9277:                                switch (LA(1)) {
9278:                                case COMMA: {
9279:                                    match(COMMA);
9280:                                    secPrecision = integer();
9281:                                    break;
9282:                                }
9283:                                case RPAREN: {
9284:                                    break;
9285:                                }
9286:                                default: {
9287:                                    throw new NoViableAltException(LT(1),
9288:                                            getFilename());
9289:                                }
9290:                                }
9291:                            }
9292:                            match(RPAREN);
9293:                            break;
9294:                        }
9295:                        case EOF:
9296:                        case LITERAL_create:
9297:                        case LITERAL_unique:
9298:                        case LITERAL_on:
9299:                        case RPAREN:
9300:                        case LITERAL_constraint:
9301:                        case LITERAL_primary:
9302:                        case LITERAL_check:
9303:                        case LITERAL_first:
9304:                        case LITERAL_after:
9305:                        case LITERAL_default:
9306:                        case LITERAL_as:
9307:                        case LITERAL_with:
9308:                        case COMMA:
9309:                        case LITERAL_where:
9310:                        case EQ:
9311:                        case LITERAL_from:
9312:                        case LITERAL_grant:
9313:                        case LITERAL_references:
9314:                        case LITERAL_not:
9315:                        case LITERAL_full:
9316:                        case LITERAL_initially:
9317:                        case LITERAL_deferrable:
9318:                        case LITERAL_for:
9319:                        case LITERAL_order:
9320:                        case STAR:
9321:                        case LITERAL_having:
9322:                        case LITERAL_using:
9323:                        case LITERAL_group:
9324:                        case CONCAT:
9325:                        case LITERAL_or:
9326:                        case LITERAL_and:
9327:                        case LITERAL_is:
9328:                        case LITERAL_like:
9329:                        case LITERAL_between:
9330:                        case LITERAL_in:
9331:                        case LITERAL_escape:
9332:                        case 120:
9333:                        case PLUS:
9334:                        case MINUS:
9335:                        case LITERAL_when:
9336:                        case LITERAL_then:
9337:                        case LITERAL_else:
9338:                        case LITERAL_end:
9339:                        case LITERAL_left:
9340:                        case LITERAL_right:
9341:                        case LT:
9342:                        case LE:
9343:                        case GT:
9344:                        case GE:
9345:                        case NE:
9346:                        case SLASH:
9347:                        case LITERAL_cross:
9348:                        case LITERAL_join:
9349:                        case LITERAL_natural:
9350:                        case LITERAL_union:
9351:                        case LITERAL_inner:
9352:                        case LITERAL_intersect:
9353:                        case LITERAL_except:
9354:                        case ID: {
9355:                            break;
9356:                        }
9357:                        default: {
9358:                            throw new NoViableAltException(LT(1), getFilename());
9359:                        }
9360:                        }
9361:                    }
9362:                    if (inputState.guessing == 0) {
9363:                        type = new TypeInterval(TypeInterval.SECOND,
9364:                                startPrecision, TypeInterval.NANO, secPrecision);
9365:                    }
9366:                    break;
9367:                }
9368:                default: {
9369:                    throw new NoViableAltException(LT(1), getFilename());
9370:                }
9371:                }
9372:                return type;
9373:            }
9374:
9375:            public final SelectItem selectItem() throws RecognitionException,
9376:                    TokenStreamException {
9377:                SelectItem item;
9378:
9379:                item = null;
9380:                Expression e = null;
9381:                String id = null;
9382:
9383:                e = expression();
9384:                if (inputState.guessing == 0) {
9385:
9386:                    item = new SelectItem(e);
9387:
9388:                }
9389:                {
9390:                    if ((LA(1) == LITERAL_as || LA(1) == ID)
9391:                            && (LA(2) == EOF || LA(2) == LITERAL_create
9392:                                    || LA(2) == LITERAL_unique
9393:                                    || LA(2) == LITERAL_on || LA(2) == RPAREN
9394:                                    || LA(2) == LITERAL_constraint
9395:                                    || LA(2) == LITERAL_primary
9396:                                    || LA(2) == LITERAL_check
9397:                                    || LA(2) == LITERAL_first
9398:                                    || LA(2) == LITERAL_after
9399:                                    || LA(2) == LITERAL_default
9400:                                    || LA(2) == LITERAL_as
9401:                                    || LA(2) == LITERAL_with || LA(2) == COMMA
9402:                                    || LA(2) == LITERAL_where
9403:                                    || LA(2) == LITERAL_from
9404:                                    || LA(2) == LITERAL_grant
9405:                                    || LA(2) == LITERAL_references
9406:                                    || LA(2) == LITERAL_not
9407:                                    || LA(2) == LITERAL_full
9408:                                    || LA(2) == LITERAL_initially
9409:                                    || LA(2) == LITERAL_deferrable
9410:                                    || LA(2) == LITERAL_for
9411:                                    || LA(2) == LITERAL_order
9412:                                    || LA(2) == LITERAL_having
9413:                                    || LA(2) == LITERAL_using
9414:                                    || LA(2) == LITERAL_group
9415:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
9416:                                    || LA(2) == LITERAL_and
9417:                                    || LA(2) == LITERAL_when
9418:                                    || LA(2) == LITERAL_then
9419:                                    || LA(2) == LITERAL_else
9420:                                    || LA(2) == LITERAL_end
9421:                                    || LA(2) == LITERAL_left
9422:                                    || LA(2) == LITERAL_right
9423:                                    || LA(2) == LITERAL_cross
9424:                                    || LA(2) == LITERAL_join
9425:                                    || LA(2) == LITERAL_natural
9426:                                    || LA(2) == LITERAL_union
9427:                                    || LA(2) == LITERAL_inner
9428:                                    || LA(2) == LITERAL_intersect
9429:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
9430:                        {
9431:                            switch (LA(1)) {
9432:                            case LITERAL_as: {
9433:                                match(LITERAL_as);
9434:                                break;
9435:                            }
9436:                            case ID: {
9437:                                break;
9438:                            }
9439:                            default: {
9440:                                throw new NoViableAltException(LT(1),
9441:                                        getFilename());
9442:                            }
9443:                            }
9444:                        }
9445:                        id = sqlId();
9446:                        if (inputState.guessing == 0) {
9447:                            item.setAs(id);
9448:                        }
9449:                    } else if ((LA(1) == EOF || LA(1) == LITERAL_create
9450:                            || LA(1) == LITERAL_unique || LA(1) == LITERAL_on
9451:                            || LA(1) == RPAREN || LA(1) == LITERAL_constraint
9452:                            || LA(1) == LITERAL_primary
9453:                            || LA(1) == LITERAL_check || LA(1) == LITERAL_first
9454:                            || LA(1) == LITERAL_after
9455:                            || LA(1) == LITERAL_default || LA(1) == LITERAL_as
9456:                            || LA(1) == LITERAL_with || LA(1) == COMMA
9457:                            || LA(1) == LITERAL_where || LA(1) == LITERAL_from
9458:                            || LA(1) == LITERAL_grant
9459:                            || LA(1) == LITERAL_references
9460:                            || LA(1) == LITERAL_not || LA(1) == LITERAL_full
9461:                            || LA(1) == LITERAL_initially
9462:                            || LA(1) == LITERAL_deferrable
9463:                            || LA(1) == LITERAL_for || LA(1) == LITERAL_order
9464:                            || LA(1) == LITERAL_having
9465:                            || LA(1) == LITERAL_using || LA(1) == LITERAL_group
9466:                            || LA(1) == CONCAT || LA(1) == LITERAL_or
9467:                            || LA(1) == LITERAL_and || LA(1) == LITERAL_when
9468:                            || LA(1) == LITERAL_then || LA(1) == LITERAL_else
9469:                            || LA(1) == LITERAL_end || LA(1) == LITERAL_left
9470:                            || LA(1) == LITERAL_right || LA(1) == LITERAL_cross
9471:                            || LA(1) == LITERAL_join
9472:                            || LA(1) == LITERAL_natural
9473:                            || LA(1) == LITERAL_union || LA(1) == LITERAL_inner
9474:                            || LA(1) == LITERAL_intersect
9475:                            || LA(1) == LITERAL_except || LA(1) == ID)
9476:                            && (LA(2) == EOF || LA(2) == LITERAL_create
9477:                                    || LA(2) == LITERAL_unique
9478:                                    || LA(2) == LITERAL_index
9479:                                    || LA(2) == LITERAL_temporary
9480:                                    || LA(2) == LITERAL_table
9481:                                    || LA(2) == LITERAL_view
9482:                                    || LA(2) == LITERAL_on || LA(2) == LPAREN
9483:                                    || LA(2) == RPAREN
9484:                                    || LA(2) == LITERAL_constraint
9485:                                    || LA(2) == LITERAL_primary
9486:                                    || LA(2) == LITERAL_foreign
9487:                                    || LA(2) == LITERAL_check
9488:                                    || LA(2) == LITERAL_first
9489:                                    || LA(2) == LITERAL_after
9490:                                    || LA(2) == LITERAL_default
9491:                                    || LA(2) == LITERAL_as
9492:                                    || LA(2) == LITERAL_with
9493:                                    || LA(2) == LITERAL_cascaded
9494:                                    || LA(2) == LITERAL_update
9495:                                    || LA(2) == COMMA || LA(2) == LITERAL_where
9496:                                    || LA(2) == EQ || LA(2) == LITERAL_delete
9497:                                    || LA(2) == LITERAL_from
9498:                                    || LA(2) == LITERAL_global
9499:                                    || LA(2) == LITERAL_local
9500:                                    || LA(2) == LITERAL_grant
9501:                                    || LA(2) == LITERAL_all
9502:                                    || LA(2) == LITERAL_select
9503:                                    || LA(2) == LITERAL_insert
9504:                                    || LA(2) == LITERAL_references
9505:                                    || LA(2) == LITERAL_usage
9506:                                    || LA(2) == LITERAL_not
9507:                                    || LA(2) == LITERAL_null
9508:                                    || LA(2) == LITERAL_key
9509:                                    || LA(2) == LITERAL_identity
9510:                                    || LA(2) == LITERAL_full
9511:                                    || LA(2) == LITERAL_initially
9512:                                    || LA(2) == LITERAL_deferred
9513:                                    || LA(2) == LITERAL_immediate
9514:                                    || LA(2) == LITERAL_deferrable
9515:                                    || LA(2) == LITERAL_bit
9516:                                    || LA(2) == LITERAL_varbinary
9517:                                    || LA(2) == LITERAL_binary
9518:                                    || LA(2) == LITERAL_blob
9519:                                    || LA(2) == LITERAL_clob
9520:                                    || LA(2) == LITERAL_character
9521:                                    || LA(2) == LITERAL_char
9522:                                    || LA(2) == LITERAL_varchar
9523:                                    || LA(2) == LITERAL_int
9524:                                    || LA(2) == LITERAL_integer
9525:                                    || LA(2) == LITERAL_smallint
9526:                                    || LA(2) == LITERAL_tinyint
9527:                                    || LA(2) == LITERAL_bigint
9528:                                    || LA(2) == LITERAL_dec
9529:                                    || LA(2) == LITERAL_decimal
9530:                                    || LA(2) == LITERAL_numeric
9531:                                    || LA(2) == LITERAL_real
9532:                                    || LA(2) == LITERAL_double
9533:                                    || LA(2) == LITERAL_float
9534:                                    || LA(2) == LITERAL_boolean
9535:                                    || LA(2) == LITERAL_date
9536:                                    || LA(2) == LITERAL_time
9537:                                    || LA(2) == LITERAL_timestamp
9538:                                    || LA(2) == LITERAL_interval
9539:                                    || LA(2) == LITERAL_for
9540:                                    || LA(2) == LITERAL_read
9541:                                    || LA(2) == LITERAL_order
9542:                                    || LA(2) == LITERAL_by || LA(2) == STAR
9543:                                    || LA(2) == LITERAL_having
9544:                                    || LA(2) == LITERAL_corresponding
9545:                                    || LA(2) == LITERAL_values
9546:                                    || LA(2) == LITERAL_using
9547:                                    || LA(2) == LITERAL_group
9548:                                    || LA(2) == CONCAT || LA(2) == LITERAL_or
9549:                                    || LA(2) == LITERAL_and
9550:                                    || LA(2) == LITERAL_is
9551:                                    || LA(2) == LITERAL_like
9552:                                    || LA(2) == LITERAL_between
9553:                                    || LA(2) == LITERAL_in
9554:                                    || LA(2) == LITERAL_exists
9555:                                    || LA(2) == LITERAL_escape || LA(2) == 120
9556:                                    || LA(2) == PLUS || LA(2) == MINUS
9557:                                    || LA(2) == STRING_LITERAL
9558:                                    || LA(2) == QUESTION || LA(2) == INT
9559:                                    || LA(2) == REAL || LA(2) == BINSTR
9560:                                    || LA(2) == HEXSTR || LA(2) == LITERAL_case
9561:                                    || LA(2) == LITERAL_when
9562:                                    || LA(2) == LITERAL_then
9563:                                    || LA(2) == LITERAL_else
9564:                                    || LA(2) == LITERAL_end
9565:                                    || LA(2) == LITERAL_hour
9566:                                    || LA(2) == LITERAL_left
9567:                                    || LA(2) == LITERAL_minute
9568:                                    || LA(2) == LITERAL_month
9569:                                    || LA(2) == LITERAL_right
9570:                                    || LA(2) == LITERAL_second
9571:                                    || LA(2) == LITERAL_year
9572:                                    || LA(2) == LITERAL_user
9573:                                    || LA(2) == LITERAL_current_user
9574:                                    || LA(2) == LITERAL_session_user
9575:                                    || LA(2) == LITERAL_system_user
9576:                                    || LA(2) == LITERAL_current_date
9577:                                    || LA(2) == LITERAL_current_time
9578:                                    || LA(2) == LITERAL_current_timestamp
9579:                                    || LA(2) == LITERAL_sql_tsi_frac_second
9580:                                    || LA(2) == LITERAL_sql_tsi_second
9581:                                    || LA(2) == LITERAL_sql_tsi_minute
9582:                                    || LA(2) == LITERAL_sql_tsi_hour
9583:                                    || LA(2) == LITERAL_sql_tsi_day
9584:                                    || LA(2) == LITERAL_sql_tsi_week
9585:                                    || LA(2) == LITERAL_sql_tsi_month
9586:                                    || LA(2) == LITERAL_sql_tsi_quarter
9587:                                    || LA(2) == LITERAL_sql_tsi_year
9588:                                    || LA(2) == LITERAL_cast
9589:                                    || LA(2) == LITERAL_true
9590:                                    || LA(2) == LITERAL_false
9591:                                    || LA(2) == LITERAL_avg
9592:                                    || LA(2) == LITERAL_min
9593:                                    || LA(2) == LITERAL_max
9594:                                    || LA(2) == LITERAL_sum
9595:                                    || LA(2) == LITERAL_count || LA(2) == LT
9596:                                    || LA(2) == LE || LA(2) == GT
9597:                                    || LA(2) == GE || LA(2) == NE
9598:                                    || LA(2) == SLASH || LA(2) == LITERAL_cross
9599:                                    || LA(2) == LITERAL_join
9600:                                    || LA(2) == LITERAL_natural
9601:                                    || LA(2) == LITERAL_union
9602:                                    || LA(2) == LITERAL_inner
9603:                                    || LA(2) == LITERAL_outer
9604:                                    || LA(2) == LITERAL_intersect
9605:                                    || LA(2) == LITERAL_except || LA(2) == ID)) {
9606:                    } else {
9607:                        throw new NoViableAltException(LT(1), getFilename());
9608:                    }
9609:
9610:                }
9611:                return item;
9612:            }
9613:
9614:            public final int joinType() throws RecognitionException,
9615:                    TokenStreamException {
9616:                int type;
9617:
9618:                type = Op.INNER;
9619:
9620:                switch (LA(1)) {
9621:                case LITERAL_inner: {
9622:                    match(LITERAL_inner);
9623:                    if (inputState.guessing == 0) {
9624:                        type = Op.INNER;
9625:                    }
9626:                    break;
9627:                }
9628:                case LITERAL_full:
9629:                case LITERAL_left:
9630:                case LITERAL_right: {
9631:                    {
9632:                        switch (LA(1)) {
9633:                        case LITERAL_left: {
9634:                            match(LITERAL_left);
9635:                            if (inputState.guessing == 0) {
9636:                                type = Op.LEFT;
9637:                            }
9638:                            break;
9639:                        }
9640:                        case LITERAL_right: {
9641:                            match(LITERAL_right);
9642:                            if (inputState.guessing == 0) {
9643:                                type = Op.RIGHT;
9644:                            }
9645:                            break;
9646:                        }
9647:                        case LITERAL_full: {
9648:                            match(LITERAL_full);
9649:                            if (inputState.guessing == 0) {
9650:                                type = Op.FULL;
9651:                            }
9652:                            break;
9653:                        }
9654:                        default: {
9655:                            throw new NoViableAltException(LT(1), getFilename());
9656:                        }
9657:                        }
9658:                    }
9659:                    {
9660:                        switch (LA(1)) {
9661:                        case LITERAL_outer: {
9662:                            match(LITERAL_outer);
9663:                            break;
9664:                        }
9665:                        case LITERAL_join: {
9666:                            break;
9667:                        }
9668:                        default: {
9669:                            throw new NoViableAltException(LT(1), getFilename());
9670:                        }
9671:                        }
9672:                    }
9673:                    break;
9674:                }
9675:                case LITERAL_join: {
9676:                    break;
9677:                }
9678:                default: {
9679:                    throw new NoViableAltException(LT(1), getFilename());
9680:                }
9681:                }
9682:                return type;
9683:            }
9684:
9685:            public static final String[] _tokenNames = { "<0>", "EOF", "<2>",
9686:                    "NULL_TREE_LOOKAHEAD", "\"create\"", "\"unique\"",
9687:                    "\"index\"", "\"schema\"", "\"temporary\"", "\"table\"",
9688:                    "\"view\"", "\"drop\"", "\"commit\"", "\"work\"",
9689:                    "\"rollback\"", "\"transaction\"", "\"on\"", "'('", "')'",
9690:                    "\"alter\"", "\"add\"", "\"constraint\"", "\"primary\"",
9691:                    "\"foreign\"", "\"check\"", "\"rename\"", "\"column\"",
9692:                    "\"first\"", "\"after\"", "\"restrict\"", "\"cascade\"",
9693:                    "\"set\"", "\"default\"", "\"to\"", "\"as\"", "\"with\"",
9694:                    "\"cascaded\"", "\"option\"", "\"update\"", "COMMA",
9695:                    "\"where\"", "EQ", "\"delete\"", "\"from\"",
9696:                    "\"authorization\"", "\"global\"", "\"local\"",
9697:                    "\"grant\"", "\"public\"", "\"all\"", "\"privileges\"",
9698:                    "\"select\"", "\"insert\"", "\"references\"", "\"usage\"",
9699:                    "\"not\"", "\"null\"", "\"key\"", "\"identity\"",
9700:                    "\"match\"", "\"full\"", "\"partial\"", "\"no\"",
9701:                    "\"action\"", "\"initially\"", "\"deferred\"",
9702:                    "\"immediate\"", "\"deferrable\"", "\"bit\"",
9703:                    "\"varying\"", "\"varbinary\"", "\"binary\"", "\"blob\"",
9704:                    "\"large\"", "\"object\"", "\"clob\"", "\"character\"",
9705:                    "\"char\"", "\"varchar\"", "\"int\"", "\"integer\"",
9706:                    "\"smallint\"", "\"tinyint\"", "\"bigint\"", "\"dec\"",
9707:                    "\"decimal\"", "\"numeric\"", "\"real\"", "\"double\"",
9708:                    "\"precision\"", "\"float\"", "\"boolean\"", "\"date\"",
9709:                    "\"time\"", "\"zone\"", "\"timestamp\"", "\"interval\"",
9710:                    "\"for\"", "\"read\"", "\"only\"", "\"order\"", "\"by\"",
9711:                    "\"asc\"", "\"desc\"", "\"distinct\"", "STAR",
9712:                    "\"having\"", "\"corresponding\"", "\"values\"",
9713:                    "\"using\"", "\"group\"", "CONCAT", "\"or\"", "\"and\"",
9714:                    "\"is\"", "\"like\"", "\"between\"", "\"in\"",
9715:                    "\"exists\"", "\"escape\"", "\"**\"", "PLUS", "MINUS",
9716:                    "STRING_LITERAL", "QUESTION", "INT", "REAL", "BINSTR",
9717:                    "HEXSTR", "\"case\"", "\"when\"", "\"then\"", "\"else\"",
9718:                    "\"end\"", "\"hour\"", "\"left\"", "\"minute\"",
9719:                    "\"month\"", "\"right\"", "\"second\"", "\"year\"",
9720:                    "\"user\"", "\"current_user\"", "\"session_user\"",
9721:                    "\"system_user\"", "\"current_date\"", "\"current_time\"",
9722:                    "\"current_timestamp\"", "\"sql_tsi_frac_second\"",
9723:                    "\"sql_tsi_second\"", "\"sql_tsi_minute\"",
9724:                    "\"sql_tsi_hour\"", "\"sql_tsi_day\"", "\"sql_tsi_week\"",
9725:                    "\"sql_tsi_month\"", "\"sql_tsi_quarter\"",
9726:                    "\"sql_tsi_year\"", "\"cast\"", "\"day\"", "\"true\"",
9727:                    "\"false\"", "\"avg\"", "\"min\"", "\"max\"", "\"sum\"",
9728:                    "\"count\"", "\"into\"", "\"unknown\"", "LT", "LE", "GT",
9729:                    "GE", "NE", "\"any\"", "\"some\"", "SLASH", "\"cross\"",
9730:                    "\"join\"", "\"natural\"", "\"union\"", "\"inner\"",
9731:                    "\"outer\"", "\"intersect\"", "\"except\"",
9732:                    "an identifier", "WS", "SL_COMMENT", "ML_COMMENT", "NL",
9733:                    "LCURLY", "RCURLY", "SEMI", "DIGIT", "EXP", "INT_OR_REAL",
9734:                    "HEXDIGIT", "IDCHAR", "IDCHAR2", "SIMPID", "CASEID",
9735:                    "IDTERM" };
9736:
9737:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.