Source Code Cross Referenced for ANTLRParser.java in  » IDE-Netbeans » cnd » antlr » 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 » IDE Netbeans » cnd » antlr 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        // $ANTLR 2.7.3rc3: "antlr.g" -> "ANTLRParser.java"$
0002:
0003:        package antlr;
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.util.Enumeration;
0020:        import java.io.DataInputStream;
0021:        import java.io.InputStream;
0022:        import java.io.FileInputStream;
0023:        import java.io.IOException;
0024:
0025:        public class ANTLRParser extends antlr.LLkParser implements 
0026:                ANTLRTokenTypes {
0027:
0028:            private static final boolean DEBUG_PARSER = false;
0029:
0030:            ANTLRGrammarParseBehavior behavior;
0031:            Tool antlrTool;
0032:            protected int blockNesting = -1;
0033:
0034:            public ANTLRParser(TokenBuffer tokenBuf,
0035:                    ANTLRGrammarParseBehavior behavior_, Tool tool_) {
0036:                super (tokenBuf, 1);
0037:                tokenNames = _tokenNames;
0038:                behavior = behavior_;
0039:                antlrTool = tool_;
0040:            }
0041:
0042:            public void reportError(String s) {
0043:                antlrTool.error(s, getFilename(), -1, -1);
0044:            }
0045:
0046:            public void reportError(RecognitionException e) {
0047:                reportError(e, e.getMessage());
0048:            }
0049:
0050:            public void reportError(RecognitionException e, String s) {
0051:                antlrTool.error(s, e.getFilename(), e.getLine(), e.getColumn());
0052:            }
0053:
0054:            public void reportWarning(String s) {
0055:                antlrTool.warning(s, getFilename(), -1, -1);
0056:            }
0057:
0058:            private boolean lastInRule() throws TokenStreamException {
0059:                if (blockNesting == 0
0060:                        && (LA(1) == SEMI || LA(1) == LITERAL_exception || LA(1) == OR)) {
0061:                    return true;
0062:                }
0063:                return false;
0064:            }
0065:
0066:            private void checkForMissingEndRule(Token label) {
0067:                if (label.getColumn() == 1) {
0068:                    antlrTool.warning(
0069:                            "did you forget to terminate previous rule?",
0070:                            getFilename(), label.getLine(), label.getColumn());
0071:                }
0072:            }
0073:
0074:            protected ANTLRParser(TokenBuffer tokenBuf, int k) {
0075:                super (tokenBuf, k);
0076:                tokenNames = _tokenNames;
0077:            }
0078:
0079:            public ANTLRParser(TokenBuffer tokenBuf) {
0080:                this (tokenBuf, 2);
0081:            }
0082:
0083:            protected ANTLRParser(TokenStream lexer, int k) {
0084:                super (lexer, k);
0085:                tokenNames = _tokenNames;
0086:            }
0087:
0088:            public ANTLRParser(TokenStream lexer) {
0089:                this (lexer, 2);
0090:            }
0091:
0092:            public ANTLRParser(ParserSharedInputState state) {
0093:                super (state, 2);
0094:                tokenNames = _tokenNames;
0095:            }
0096:
0097:            public final void grammar() throws RecognitionException,
0098:                    TokenStreamException {
0099:
0100:                Token n = null;
0101:                Token h = null;
0102:
0103:                try { // for error handling
0104:                    {
0105:                        _loop4: do {
0106:                            if ((LA(1) == LITERAL_header)) {
0107:                                if (inputState.guessing == 0) {
0108:
0109:                                    n = null; // RK: prevent certain orders of header actions
0110:                                    // overwriting eachother.
0111:
0112:                                }
0113:                                match(LITERAL_header);
0114:                                {
0115:                                    switch (LA(1)) {
0116:                                    case STRING_LITERAL: {
0117:                                        n = LT(1);
0118:                                        match(STRING_LITERAL);
0119:                                        break;
0120:                                    }
0121:                                    case ACTION: {
0122:                                        break;
0123:                                    }
0124:                                    default: {
0125:                                        throw new NoViableAltException(LT(1),
0126:                                                getFilename());
0127:                                    }
0128:                                    }
0129:                                }
0130:                                h = LT(1);
0131:                                match(ACTION);
0132:                                if (inputState.guessing == 0) {
0133:
0134:                                    // store the header action
0135:                                    // FIXME: 'n' should be checked for validity
0136:                                    behavior.refHeaderAction(n, h);
0137:
0138:                                }
0139:                            } else {
0140:                                break _loop4;
0141:                            }
0142:
0143:                        } while (true);
0144:                    }
0145:                    {
0146:                        switch (LA(1)) {
0147:                        case OPTIONS: {
0148:                            fileOptionsSpec();
0149:                            break;
0150:                        }
0151:                        case EOF:
0152:                        case ACTION:
0153:                        case DOC_COMMENT:
0154:                        case LITERAL_lexclass:
0155:                        case LITERAL_class: {
0156:                            break;
0157:                        }
0158:                        default: {
0159:                            throw new NoViableAltException(LT(1), getFilename());
0160:                        }
0161:                        }
0162:                    }
0163:                    {
0164:                        _loop7: do {
0165:                            if (((LA(1) >= ACTION && LA(1) <= LITERAL_class))) {
0166:                                classDef();
0167:                            } else {
0168:                                break _loop7;
0169:                            }
0170:
0171:                        } while (true);
0172:                    }
0173:                    match(Token.EOF_TYPE);
0174:                } catch (RecognitionException ex) {
0175:                    if (inputState.guessing == 0) {
0176:
0177:                        reportError(ex, "rule grammar trapped:\n"
0178:                                + ex.toString());
0179:                        consumeUntil(EOF);
0180:
0181:                    } else {
0182:                        throw ex;
0183:                    }
0184:                }
0185:            }
0186:
0187:            public final void fileOptionsSpec() throws RecognitionException,
0188:                    TokenStreamException {
0189:
0190:                Token idTok;
0191:                Token value;
0192:
0193:                match(OPTIONS);
0194:                {
0195:                    _loop18: do {
0196:                        if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
0197:                            idTok = id();
0198:                            match(ASSIGN);
0199:                            value = optionValue();
0200:                            if (inputState.guessing == 0) {
0201:                                behavior.setFileOption(idTok, value,
0202:                                        getInputState().filename);
0203:                            }
0204:                            match(SEMI);
0205:                        } else {
0206:                            break _loop18;
0207:                        }
0208:
0209:                    } while (true);
0210:                }
0211:                match(RCURLY);
0212:            }
0213:
0214:            public final void classDef() throws RecognitionException,
0215:                    TokenStreamException {
0216:
0217:                Token a = null;
0218:                Token d = null;
0219:                String doc = null;
0220:
0221:                try { // for error handling
0222:                    {
0223:                        switch (LA(1)) {
0224:                        case ACTION: {
0225:                            a = LT(1);
0226:                            match(ACTION);
0227:                            if (inputState.guessing == 0) {
0228:                                behavior.refPreambleAction(a);
0229:                            }
0230:                            break;
0231:                        }
0232:                        case DOC_COMMENT:
0233:                        case LITERAL_lexclass:
0234:                        case LITERAL_class: {
0235:                            break;
0236:                        }
0237:                        default: {
0238:                            throw new NoViableAltException(LT(1), getFilename());
0239:                        }
0240:                        }
0241:                    }
0242:                    {
0243:                        switch (LA(1)) {
0244:                        case DOC_COMMENT: {
0245:                            d = LT(1);
0246:                            match(DOC_COMMENT);
0247:                            if (inputState.guessing == 0) {
0248:                                doc = d.getText();
0249:                            }
0250:                            break;
0251:                        }
0252:                        case LITERAL_lexclass:
0253:                        case LITERAL_class: {
0254:                            break;
0255:                        }
0256:                        default: {
0257:                            throw new NoViableAltException(LT(1), getFilename());
0258:                        }
0259:                        }
0260:                    }
0261:                    {
0262:                        boolean synPredMatched13 = false;
0263:                        if (((LA(1) == LITERAL_lexclass || LA(1) == LITERAL_class) && (LA(2) == TOKEN_REF || LA(2) == RULE_REF))) {
0264:                            int _m13 = mark();
0265:                            synPredMatched13 = true;
0266:                            inputState.guessing++;
0267:                            try {
0268:                                {
0269:                                    switch (LA(1)) {
0270:                                    case LITERAL_lexclass: {
0271:                                        match(LITERAL_lexclass);
0272:                                        break;
0273:                                    }
0274:                                    case LITERAL_class: {
0275:                                        match(LITERAL_class);
0276:                                        id();
0277:                                        match(LITERAL_extends);
0278:                                        match(LITERAL_Lexer);
0279:                                        break;
0280:                                    }
0281:                                    default: {
0282:                                        throw new NoViableAltException(LT(1),
0283:                                                getFilename());
0284:                                    }
0285:                                    }
0286:                                }
0287:                            } catch (RecognitionException pe) {
0288:                                synPredMatched13 = false;
0289:                            }
0290:                            rewind(_m13);
0291:                            inputState.guessing--;
0292:                        }
0293:                        if (synPredMatched13) {
0294:                            lexerSpec(doc);
0295:                        } else {
0296:                            boolean synPredMatched15 = false;
0297:                            if (((LA(1) == LITERAL_class) && (LA(2) == TOKEN_REF || LA(2) == RULE_REF))) {
0298:                                int _m15 = mark();
0299:                                synPredMatched15 = true;
0300:                                inputState.guessing++;
0301:                                try {
0302:                                    {
0303:                                        match(LITERAL_class);
0304:                                        id();
0305:                                        match(LITERAL_extends);
0306:                                        match(LITERAL_TreeParser);
0307:                                    }
0308:                                } catch (RecognitionException pe) {
0309:                                    synPredMatched15 = false;
0310:                                }
0311:                                rewind(_m15);
0312:                                inputState.guessing--;
0313:                            }
0314:                            if (synPredMatched15) {
0315:                                treeParserSpec(doc);
0316:                            } else if ((LA(1) == LITERAL_class)
0317:                                    && (LA(2) == TOKEN_REF || LA(2) == RULE_REF)) {
0318:                                parserSpec(doc);
0319:                            } else {
0320:                                throw new NoViableAltException(LT(1),
0321:                                        getFilename());
0322:                            }
0323:                        }
0324:                    }
0325:                    rules();
0326:                    if (inputState.guessing == 0) {
0327:                        behavior.endGrammar();
0328:                    }
0329:                } catch (RecognitionException ex) {
0330:                    if (inputState.guessing == 0) {
0331:
0332:                        if (ex instanceof  NoViableAltException) {
0333:                            NoViableAltException e = (NoViableAltException) ex;
0334:                            // RK: These probably generate inconsequent error messages...
0335:                            // have to see how this comes out..
0336:                            if (e.token.getType() == DOC_COMMENT) {
0337:                                reportError(ex,
0338:                                        "JAVADOC comments may only prefix rules and grammars");
0339:                            } else {
0340:                                reportError(ex, "rule classDef trapped:\n"
0341:                                        + ex.toString());
0342:                            }
0343:                        } else {
0344:                            reportError(ex, "rule classDef trapped:\n"
0345:                                    + ex.toString());
0346:                        }
0347:                        behavior.abortGrammar();
0348:                        boolean consuming = true;
0349:                        // consume everything until the next class definition or EOF
0350:                        while (consuming) {
0351:                            consume();
0352:                            switch (LA(1)) {
0353:                            case LITERAL_class:
0354:                            case LITERAL_lexclass:
0355:                            case EOF:
0356:                                consuming = false;
0357:                                break;
0358:                            }
0359:                        }
0360:
0361:                    } else {
0362:                        throw ex;
0363:                    }
0364:                }
0365:            }
0366:
0367:            public final Token id() throws RecognitionException,
0368:                    TokenStreamException {
0369:                Token idTok;
0370:
0371:                Token a = null;
0372:                Token b = null;
0373:                idTok = null;
0374:
0375:                switch (LA(1)) {
0376:                case TOKEN_REF: {
0377:                    a = LT(1);
0378:                    match(TOKEN_REF);
0379:                    if (inputState.guessing == 0) {
0380:                        idTok = a;
0381:                    }
0382:                    break;
0383:                }
0384:                case RULE_REF: {
0385:                    b = LT(1);
0386:                    match(RULE_REF);
0387:                    if (inputState.guessing == 0) {
0388:                        idTok = b;
0389:                    }
0390:                    break;
0391:                }
0392:                default: {
0393:                    throw new NoViableAltException(LT(1), getFilename());
0394:                }
0395:                }
0396:                return idTok;
0397:            }
0398:
0399:            public final void lexerSpec(String doc)
0400:                    throws RecognitionException, TokenStreamException {
0401:
0402:                Token lc = null;
0403:                Token a = null;
0404:
0405:                Token idTok;
0406:                String sup = null;
0407:
0408:                {
0409:                    switch (LA(1)) {
0410:                    case LITERAL_lexclass: {
0411:                        lc = LT(1);
0412:                        match(LITERAL_lexclass);
0413:                        idTok = id();
0414:                        if (inputState.guessing == 0) {
0415:
0416:                            antlrTool
0417:                                    .warning(
0418:                                            "lexclass' is deprecated; use 'class X extends Lexer'",
0419:                                            getFilename(), lc.getLine(), lc
0420:                                                    .getColumn());
0421:                            //				System.out.println("warning: line " + lc.getLine() + ": 'lexclass' is deprecated; use 'class X extends Lexer'");
0422:
0423:                        }
0424:                        break;
0425:                    }
0426:                    case LITERAL_class: {
0427:                        match(LITERAL_class);
0428:                        idTok = id();
0429:                        match(LITERAL_extends);
0430:                        match(LITERAL_Lexer);
0431:                        {
0432:                            switch (LA(1)) {
0433:                            case LPAREN: {
0434:                                sup = super Class();
0435:                                break;
0436:                            }
0437:                            case SEMI: {
0438:                                break;
0439:                            }
0440:                            default: {
0441:                                throw new NoViableAltException(LT(1),
0442:                                        getFilename());
0443:                            }
0444:                            }
0445:                        }
0446:                        break;
0447:                    }
0448:                    default: {
0449:                        throw new NoViableAltException(LT(1), getFilename());
0450:                    }
0451:                    }
0452:                }
0453:                if (inputState.guessing == 0) {
0454:                    behavior.startLexer(getFilename(), idTok, sup, doc);
0455:                }
0456:                match(SEMI);
0457:                {
0458:                    switch (LA(1)) {
0459:                    case OPTIONS: {
0460:                        lexerOptionsSpec();
0461:                        break;
0462:                    }
0463:                    case ACTION:
0464:                    case DOC_COMMENT:
0465:                    case TOKENS:
0466:                    case TOKEN_REF:
0467:                    case LITERAL_protected:
0468:                    case LITERAL_public:
0469:                    case LITERAL_private:
0470:                    case RULE_REF: {
0471:                        break;
0472:                    }
0473:                    default: {
0474:                        throw new NoViableAltException(LT(1), getFilename());
0475:                    }
0476:                    }
0477:                }
0478:                if (inputState.guessing == 0) {
0479:                    behavior.endOptions();
0480:                }
0481:                {
0482:                    switch (LA(1)) {
0483:                    case TOKENS: {
0484:                        tokensSpec();
0485:                        break;
0486:                    }
0487:                    case ACTION:
0488:                    case DOC_COMMENT:
0489:                    case TOKEN_REF:
0490:                    case LITERAL_protected:
0491:                    case LITERAL_public:
0492:                    case LITERAL_private:
0493:                    case RULE_REF: {
0494:                        break;
0495:                    }
0496:                    default: {
0497:                        throw new NoViableAltException(LT(1), getFilename());
0498:                    }
0499:                    }
0500:                }
0501:                {
0502:                    switch (LA(1)) {
0503:                    case ACTION: {
0504:                        a = LT(1);
0505:                        match(ACTION);
0506:                        if (inputState.guessing == 0) {
0507:                            behavior.refMemberAction(a);
0508:                        }
0509:                        break;
0510:                    }
0511:                    case DOC_COMMENT:
0512:                    case TOKEN_REF:
0513:                    case LITERAL_protected:
0514:                    case LITERAL_public:
0515:                    case LITERAL_private:
0516:                    case RULE_REF: {
0517:                        break;
0518:                    }
0519:                    default: {
0520:                        throw new NoViableAltException(LT(1), getFilename());
0521:                    }
0522:                    }
0523:                }
0524:            }
0525:
0526:            public final void treeParserSpec(String doc)
0527:                    throws RecognitionException, TokenStreamException {
0528:
0529:                Token a = null;
0530:
0531:                Token idTok;
0532:                String sup = null;
0533:
0534:                match(LITERAL_class);
0535:                idTok = id();
0536:                match(LITERAL_extends);
0537:                match(LITERAL_TreeParser);
0538:                {
0539:                    switch (LA(1)) {
0540:                    case LPAREN: {
0541:                        sup = super Class();
0542:                        break;
0543:                    }
0544:                    case SEMI: {
0545:                        break;
0546:                    }
0547:                    default: {
0548:                        throw new NoViableAltException(LT(1), getFilename());
0549:                    }
0550:                    }
0551:                }
0552:                if (inputState.guessing == 0) {
0553:                    behavior.startTreeWalker(getFilename(), idTok, sup, doc);
0554:                }
0555:                match(SEMI);
0556:                {
0557:                    switch (LA(1)) {
0558:                    case OPTIONS: {
0559:                        treeParserOptionsSpec();
0560:                        break;
0561:                    }
0562:                    case ACTION:
0563:                    case DOC_COMMENT:
0564:                    case TOKENS:
0565:                    case TOKEN_REF:
0566:                    case LITERAL_protected:
0567:                    case LITERAL_public:
0568:                    case LITERAL_private:
0569:                    case RULE_REF: {
0570:                        break;
0571:                    }
0572:                    default: {
0573:                        throw new NoViableAltException(LT(1), getFilename());
0574:                    }
0575:                    }
0576:                }
0577:                if (inputState.guessing == 0) {
0578:                    behavior.endOptions();
0579:                }
0580:                {
0581:                    switch (LA(1)) {
0582:                    case TOKENS: {
0583:                        tokensSpec();
0584:                        break;
0585:                    }
0586:                    case ACTION:
0587:                    case DOC_COMMENT:
0588:                    case TOKEN_REF:
0589:                    case LITERAL_protected:
0590:                    case LITERAL_public:
0591:                    case LITERAL_private:
0592:                    case RULE_REF: {
0593:                        break;
0594:                    }
0595:                    default: {
0596:                        throw new NoViableAltException(LT(1), getFilename());
0597:                    }
0598:                    }
0599:                }
0600:                {
0601:                    switch (LA(1)) {
0602:                    case ACTION: {
0603:                        a = LT(1);
0604:                        match(ACTION);
0605:                        if (inputState.guessing == 0) {
0606:                            behavior.refMemberAction(a);
0607:                        }
0608:                        break;
0609:                    }
0610:                    case DOC_COMMENT:
0611:                    case TOKEN_REF:
0612:                    case LITERAL_protected:
0613:                    case LITERAL_public:
0614:                    case LITERAL_private:
0615:                    case RULE_REF: {
0616:                        break;
0617:                    }
0618:                    default: {
0619:                        throw new NoViableAltException(LT(1), getFilename());
0620:                    }
0621:                    }
0622:                }
0623:            }
0624:
0625:            public final void parserSpec(String doc)
0626:                    throws RecognitionException, TokenStreamException {
0627:
0628:                Token a = null;
0629:
0630:                Token idTok;
0631:                String sup = null;
0632:
0633:                match(LITERAL_class);
0634:                idTok = id();
0635:                {
0636:                    switch (LA(1)) {
0637:                    case LITERAL_extends: {
0638:                        match(LITERAL_extends);
0639:                        match(LITERAL_Parser);
0640:                        {
0641:                            switch (LA(1)) {
0642:                            case LPAREN: {
0643:                                sup = super Class();
0644:                                break;
0645:                            }
0646:                            case SEMI: {
0647:                                break;
0648:                            }
0649:                            default: {
0650:                                throw new NoViableAltException(LT(1),
0651:                                        getFilename());
0652:                            }
0653:                            }
0654:                        }
0655:                        break;
0656:                    }
0657:                    case SEMI: {
0658:                        if (inputState.guessing == 0) {
0659:
0660:                            antlrTool.warning("use 'class X extends Parser'",
0661:                                    getFilename(), idTok.getLine(), idTok
0662:                                            .getColumn());
0663:                            //			System.out.println("warning: line " +
0664:                            //				idTok.getLine() + ": use 'class X extends Parser'");
0665:
0666:                        }
0667:                        break;
0668:                    }
0669:                    default: {
0670:                        throw new NoViableAltException(LT(1), getFilename());
0671:                    }
0672:                    }
0673:                }
0674:                if (inputState.guessing == 0) {
0675:                    behavior.startParser(getFilename(), idTok, sup, doc);
0676:                }
0677:                match(SEMI);
0678:                {
0679:                    switch (LA(1)) {
0680:                    case OPTIONS: {
0681:                        parserOptionsSpec();
0682:                        break;
0683:                    }
0684:                    case ACTION:
0685:                    case DOC_COMMENT:
0686:                    case TOKENS:
0687:                    case TOKEN_REF:
0688:                    case LITERAL_protected:
0689:                    case LITERAL_public:
0690:                    case LITERAL_private:
0691:                    case RULE_REF: {
0692:                        break;
0693:                    }
0694:                    default: {
0695:                        throw new NoViableAltException(LT(1), getFilename());
0696:                    }
0697:                    }
0698:                }
0699:                if (inputState.guessing == 0) {
0700:                    behavior.endOptions();
0701:                }
0702:                {
0703:                    switch (LA(1)) {
0704:                    case TOKENS: {
0705:                        tokensSpec();
0706:                        break;
0707:                    }
0708:                    case ACTION:
0709:                    case DOC_COMMENT:
0710:                    case TOKEN_REF:
0711:                    case LITERAL_protected:
0712:                    case LITERAL_public:
0713:                    case LITERAL_private:
0714:                    case RULE_REF: {
0715:                        break;
0716:                    }
0717:                    default: {
0718:                        throw new NoViableAltException(LT(1), getFilename());
0719:                    }
0720:                    }
0721:                }
0722:                {
0723:                    switch (LA(1)) {
0724:                    case ACTION: {
0725:                        a = LT(1);
0726:                        match(ACTION);
0727:                        if (inputState.guessing == 0) {
0728:                            behavior.refMemberAction(a);
0729:                        }
0730:                        break;
0731:                    }
0732:                    case DOC_COMMENT:
0733:                    case TOKEN_REF:
0734:                    case LITERAL_protected:
0735:                    case LITERAL_public:
0736:                    case LITERAL_private:
0737:                    case RULE_REF: {
0738:                        break;
0739:                    }
0740:                    default: {
0741:                        throw new NoViableAltException(LT(1), getFilename());
0742:                    }
0743:                    }
0744:                }
0745:            }
0746:
0747:            public final void rules() throws RecognitionException,
0748:                    TokenStreamException {
0749:
0750:                {
0751:                    int _cnt68 = 0;
0752:                    _loop68: do {
0753:                        if ((_tokenSet_0.member(LA(1)))
0754:                                && (_tokenSet_1.member(LA(2)))) {
0755:                            rule();
0756:                        } else {
0757:                            if (_cnt68 >= 1) {
0758:                                break _loop68;
0759:                            } else {
0760:                                throw new NoViableAltException(LT(1),
0761:                                        getFilename());
0762:                            }
0763:                        }
0764:
0765:                        _cnt68++;
0766:                    } while (true);
0767:                }
0768:            }
0769:
0770:            public final Token optionValue() throws RecognitionException,
0771:                    TokenStreamException {
0772:                Token retval;
0773:
0774:                Token sl = null;
0775:                Token cl = null;
0776:                Token il = null;
0777:                retval = null;
0778:
0779:                switch (LA(1)) {
0780:                case TOKEN_REF:
0781:                case RULE_REF: {
0782:                    retval = qualifiedID();
0783:                    break;
0784:                }
0785:                case STRING_LITERAL: {
0786:                    sl = LT(1);
0787:                    match(STRING_LITERAL);
0788:                    if (inputState.guessing == 0) {
0789:                        retval = sl;
0790:                    }
0791:                    break;
0792:                }
0793:                case CHAR_LITERAL: {
0794:                    cl = LT(1);
0795:                    match(CHAR_LITERAL);
0796:                    if (inputState.guessing == 0) {
0797:                        retval = cl;
0798:                    }
0799:                    break;
0800:                }
0801:                case INT: {
0802:                    il = LT(1);
0803:                    match(INT);
0804:                    if (inputState.guessing == 0) {
0805:                        retval = il;
0806:                    }
0807:                    break;
0808:                }
0809:                default: {
0810:                    throw new NoViableAltException(LT(1), getFilename());
0811:                }
0812:                }
0813:                return retval;
0814:            }
0815:
0816:            public final void parserOptionsSpec() throws RecognitionException,
0817:                    TokenStreamException {
0818:
0819:                Token idTok;
0820:                Token value;
0821:
0822:                match(OPTIONS);
0823:                {
0824:                    _loop21: do {
0825:                        if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
0826:                            idTok = id();
0827:                            match(ASSIGN);
0828:                            value = optionValue();
0829:                            if (inputState.guessing == 0) {
0830:                                behavior.setGrammarOption(idTok, value);
0831:                            }
0832:                            match(SEMI);
0833:                        } else {
0834:                            break _loop21;
0835:                        }
0836:
0837:                    } while (true);
0838:                }
0839:                match(RCURLY);
0840:            }
0841:
0842:            public final void treeParserOptionsSpec()
0843:                    throws RecognitionException, TokenStreamException {
0844:
0845:                Token idTok;
0846:                Token value;
0847:
0848:                match(OPTIONS);
0849:                {
0850:                    _loop24: do {
0851:                        if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
0852:                            idTok = id();
0853:                            match(ASSIGN);
0854:                            value = optionValue();
0855:                            if (inputState.guessing == 0) {
0856:                                behavior.setGrammarOption(idTok, value);
0857:                            }
0858:                            match(SEMI);
0859:                        } else {
0860:                            break _loop24;
0861:                        }
0862:
0863:                    } while (true);
0864:                }
0865:                match(RCURLY);
0866:            }
0867:
0868:            public final void lexerOptionsSpec() throws RecognitionException,
0869:                    TokenStreamException {
0870:
0871:                Token idTok;
0872:                Token value;
0873:                BitSet b;
0874:
0875:                match(OPTIONS);
0876:                {
0877:                    _loop27: do {
0878:                        switch (LA(1)) {
0879:                        case LITERAL_charVocabulary: {
0880:                            match(LITERAL_charVocabulary);
0881:                            match(ASSIGN);
0882:                            b = charSet();
0883:                            match(SEMI);
0884:                            if (inputState.guessing == 0) {
0885:                                behavior.setCharVocabulary(b);
0886:                            }
0887:                            break;
0888:                        }
0889:                        case TOKEN_REF:
0890:                        case RULE_REF: {
0891:                            idTok = id();
0892:                            match(ASSIGN);
0893:                            value = optionValue();
0894:                            if (inputState.guessing == 0) {
0895:                                behavior.setGrammarOption(idTok, value);
0896:                            }
0897:                            match(SEMI);
0898:                            break;
0899:                        }
0900:                        default: {
0901:                            break _loop27;
0902:                        }
0903:                        }
0904:                    } while (true);
0905:                }
0906:                match(RCURLY);
0907:            }
0908:
0909:            public final BitSet charSet() throws RecognitionException,
0910:                    TokenStreamException {
0911:                BitSet b;
0912:
0913:                b = null;
0914:                BitSet tmpSet = null;
0915:
0916:                b = setBlockElement();
0917:                {
0918:                    _loop34: do {
0919:                        if ((LA(1) == OR)) {
0920:                            match(OR);
0921:                            tmpSet = setBlockElement();
0922:                            if (inputState.guessing == 0) {
0923:                                b.orInPlace(tmpSet);
0924:                            }
0925:                        } else {
0926:                            break _loop34;
0927:                        }
0928:
0929:                    } while (true);
0930:                }
0931:                return b;
0932:            }
0933:
0934:            public final void subruleOptionsSpec() throws RecognitionException,
0935:                    TokenStreamException {
0936:
0937:                Token idTok;
0938:                Token value;
0939:
0940:                match(OPTIONS);
0941:                {
0942:                    _loop30: do {
0943:                        if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
0944:                            idTok = id();
0945:                            match(ASSIGN);
0946:                            value = optionValue();
0947:                            if (inputState.guessing == 0) {
0948:                                behavior.setSubruleOption(idTok, value);
0949:                            }
0950:                            match(SEMI);
0951:                        } else {
0952:                            break _loop30;
0953:                        }
0954:
0955:                    } while (true);
0956:                }
0957:                match(RCURLY);
0958:            }
0959:
0960:            /** Match a.b.c.d qualified ids; WILDCARD here is overloaded as
0961:             *  id separator; that is, I need a reference to the '.' token.
0962:             */
0963:            public final Token qualifiedID() throws RecognitionException,
0964:                    TokenStreamException {
0965:                Token qidTok = null;
0966:
0967:                StringBuffer buf = new StringBuffer(30);
0968:                Token a;
0969:
0970:                a = id();
0971:                if (inputState.guessing == 0) {
0972:                    buf.append(a.getText());
0973:                }
0974:                {
0975:                    _loop144: do {
0976:                        if ((LA(1) == WILDCARD)) {
0977:                            match(WILDCARD);
0978:                            a = id();
0979:                            if (inputState.guessing == 0) {
0980:                                buf.append('.');
0981:                                buf.append(a.getText());
0982:                            }
0983:                        } else {
0984:                            break _loop144;
0985:                        }
0986:
0987:                    } while (true);
0988:                }
0989:                if (inputState.guessing == 0) {
0990:
0991:                    // can use either TOKEN_REF or RULE_REF; should
0992:                    // really create a QID or something instead.
0993:                    qidTok = new CommonToken(TOKEN_REF, buf.toString());
0994:                    qidTok.setLine(a.getLine());
0995:
0996:                }
0997:                return qidTok;
0998:            }
0999:
1000:            public final BitSet setBlockElement() throws RecognitionException,
1001:                    TokenStreamException {
1002:                BitSet b;
1003:
1004:                Token c1 = null;
1005:                Token c2 = null;
1006:
1007:                b = null;
1008:                int rangeMin = 0;
1009:
1010:                c1 = LT(1);
1011:                match(CHAR_LITERAL);
1012:                if (inputState.guessing == 0) {
1013:
1014:                    rangeMin = ANTLRLexer.tokenTypeForCharLiteral(c1.getText());
1015:                    b = BitSet.of(rangeMin);
1016:
1017:                }
1018:                {
1019:                    switch (LA(1)) {
1020:                    case RANGE: {
1021:                        match(RANGE);
1022:                        c2 = LT(1);
1023:                        match(CHAR_LITERAL);
1024:                        if (inputState.guessing == 0) {
1025:
1026:                            int rangeMax = ANTLRLexer
1027:                                    .tokenTypeForCharLiteral(c2.getText());
1028:                            if (rangeMax < rangeMin) {
1029:                                antlrTool.error("Malformed range line ",
1030:                                        getFilename(), c1.getLine(), c1
1031:                                                .getColumn());
1032:                            }
1033:                            for (int i = rangeMin + 1; i <= rangeMax; i++) {
1034:                                b.add(i);
1035:                            }
1036:
1037:                        }
1038:                        break;
1039:                    }
1040:                    case SEMI:
1041:                    case OR: {
1042:                        break;
1043:                    }
1044:                    default: {
1045:                        throw new NoViableAltException(LT(1), getFilename());
1046:                    }
1047:                    }
1048:                }
1049:                return b;
1050:            }
1051:
1052:            public final void tokensSpec() throws RecognitionException,
1053:                    TokenStreamException {
1054:
1055:                Token t1 = null;
1056:                Token s1 = null;
1057:                Token s3 = null;
1058:
1059:                match(TOKENS);
1060:                {
1061:                    int _cnt43 = 0;
1062:                    _loop43: do {
1063:                        if ((LA(1) == STRING_LITERAL || LA(1) == TOKEN_REF)) {
1064:                            {
1065:                                switch (LA(1)) {
1066:                                case TOKEN_REF: {
1067:                                    if (inputState.guessing == 0) {
1068:                                        s1 = null;
1069:                                    }
1070:                                    t1 = LT(1);
1071:                                    match(TOKEN_REF);
1072:                                    {
1073:                                        switch (LA(1)) {
1074:                                        case ASSIGN: {
1075:                                            match(ASSIGN);
1076:                                            s1 = LT(1);
1077:                                            match(STRING_LITERAL);
1078:                                            break;
1079:                                        }
1080:                                        case SEMI:
1081:                                        case OPEN_ELEMENT_OPTION: {
1082:                                            break;
1083:                                        }
1084:                                        default: {
1085:                                            throw new NoViableAltException(
1086:                                                    LT(1), getFilename());
1087:                                        }
1088:                                        }
1089:                                    }
1090:                                    if (inputState.guessing == 0) {
1091:                                        behavior.defineToken(t1, s1);
1092:                                    }
1093:                                    {
1094:                                        switch (LA(1)) {
1095:                                        case OPEN_ELEMENT_OPTION: {
1096:                                            tokensSpecOptions(t1);
1097:                                            break;
1098:                                        }
1099:                                        case SEMI: {
1100:                                            break;
1101:                                        }
1102:                                        default: {
1103:                                            throw new NoViableAltException(
1104:                                                    LT(1), getFilename());
1105:                                        }
1106:                                        }
1107:                                    }
1108:                                    break;
1109:                                }
1110:                                case STRING_LITERAL: {
1111:                                    s3 = LT(1);
1112:                                    match(STRING_LITERAL);
1113:                                    if (inputState.guessing == 0) {
1114:                                        behavior.defineToken(null, s3);
1115:                                    }
1116:                                    {
1117:                                        switch (LA(1)) {
1118:                                        case OPEN_ELEMENT_OPTION: {
1119:                                            tokensSpecOptions(s3);
1120:                                            break;
1121:                                        }
1122:                                        case SEMI: {
1123:                                            break;
1124:                                        }
1125:                                        default: {
1126:                                            throw new NoViableAltException(
1127:                                                    LT(1), getFilename());
1128:                                        }
1129:                                        }
1130:                                    }
1131:                                    break;
1132:                                }
1133:                                default: {
1134:                                    throw new NoViableAltException(LT(1),
1135:                                            getFilename());
1136:                                }
1137:                                }
1138:                            }
1139:                            match(SEMI);
1140:                        } else {
1141:                            if (_cnt43 >= 1) {
1142:                                break _loop43;
1143:                            } else {
1144:                                throw new NoViableAltException(LT(1),
1145:                                        getFilename());
1146:                            }
1147:                        }
1148:
1149:                        _cnt43++;
1150:                    } while (true);
1151:                }
1152:                match(RCURLY);
1153:            }
1154:
1155:            public final void tokensSpecOptions(Token t)
1156:                    throws RecognitionException, TokenStreamException {
1157:
1158:                Token o = null, v = null;
1159:
1160:                match(OPEN_ELEMENT_OPTION);
1161:                o = id();
1162:                match(ASSIGN);
1163:                v = optionValue();
1164:                if (inputState.guessing == 0) {
1165:                    behavior.refTokensSpecElementOption(t, o, v);
1166:                }
1167:                {
1168:                    _loop46: do {
1169:                        if ((LA(1) == SEMI)) {
1170:                            match(SEMI);
1171:                            o = id();
1172:                            match(ASSIGN);
1173:                            v = optionValue();
1174:                            if (inputState.guessing == 0) {
1175:                                behavior.refTokensSpecElementOption(t, o, v);
1176:                            }
1177:                        } else {
1178:                            break _loop46;
1179:                        }
1180:
1181:                    } while (true);
1182:                }
1183:                match(CLOSE_ELEMENT_OPTION);
1184:            }
1185:
1186:            public final String super Class() throws RecognitionException,
1187:                    TokenStreamException {
1188:                String sup;
1189:
1190:                sup = null;
1191:
1192:                match(LPAREN);
1193:                if (inputState.guessing == 0) {
1194:
1195:                    sup = LT(1).getText();
1196:                    sup = StringUtils.stripFrontBack(sup, "\"", "\"");
1197:
1198:                }
1199:                {
1200:                    match(STRING_LITERAL);
1201:                }
1202:                match(RPAREN);
1203:                return sup;
1204:            }
1205:
1206:            public final void rule() throws RecognitionException,
1207:                    TokenStreamException {
1208:
1209:                Token d = null;
1210:                Token p1 = null;
1211:                Token p2 = null;
1212:                Token p3 = null;
1213:                Token aa = null;
1214:                Token rt = null;
1215:                Token a = null;
1216:
1217:                String access = "public";
1218:                Token idTok;
1219:                String doc = null;
1220:                boolean ruleAutoGen = true;
1221:                blockNesting = -1; // block increments, so -1 to make rule at level 0
1222:
1223:                {
1224:                    switch (LA(1)) {
1225:                    case DOC_COMMENT: {
1226:                        d = LT(1);
1227:                        match(DOC_COMMENT);
1228:                        if (inputState.guessing == 0) {
1229:                            doc = d.getText();
1230:                        }
1231:                        break;
1232:                    }
1233:                    case TOKEN_REF:
1234:                    case LITERAL_protected:
1235:                    case LITERAL_public:
1236:                    case LITERAL_private:
1237:                    case RULE_REF: {
1238:                        break;
1239:                    }
1240:                    default: {
1241:                        throw new NoViableAltException(LT(1), getFilename());
1242:                    }
1243:                    }
1244:                }
1245:                {
1246:                    switch (LA(1)) {
1247:                    case LITERAL_protected: {
1248:                        p1 = LT(1);
1249:                        match(LITERAL_protected);
1250:                        if (inputState.guessing == 0) {
1251:                            access = p1.getText();
1252:                        }
1253:                        break;
1254:                    }
1255:                    case LITERAL_public: {
1256:                        p2 = LT(1);
1257:                        match(LITERAL_public);
1258:                        if (inputState.guessing == 0) {
1259:                            access = p2.getText();
1260:                        }
1261:                        break;
1262:                    }
1263:                    case LITERAL_private: {
1264:                        p3 = LT(1);
1265:                        match(LITERAL_private);
1266:                        if (inputState.guessing == 0) {
1267:                            access = p3.getText();
1268:                        }
1269:                        break;
1270:                    }
1271:                    case TOKEN_REF:
1272:                    case RULE_REF: {
1273:                        break;
1274:                    }
1275:                    default: {
1276:                        throw new NoViableAltException(LT(1), getFilename());
1277:                    }
1278:                    }
1279:                }
1280:                idTok = id();
1281:                {
1282:                    switch (LA(1)) {
1283:                    case BANG: {
1284:                        match(BANG);
1285:                        if (inputState.guessing == 0) {
1286:                            ruleAutoGen = false;
1287:                        }
1288:                        break;
1289:                    }
1290:                    case ACTION:
1291:                    case OPTIONS:
1292:                    case ARG_ACTION:
1293:                    case LITERAL_returns:
1294:                    case COLON:
1295:                    case LITERAL_throws: {
1296:                        break;
1297:                    }
1298:                    default: {
1299:                        throw new NoViableAltException(LT(1), getFilename());
1300:                    }
1301:                    }
1302:                }
1303:                if (inputState.guessing == 0) {
1304:
1305:                    behavior.defineRuleName(idTok, access, ruleAutoGen, doc);
1306:
1307:                }
1308:                {
1309:                    switch (LA(1)) {
1310:                    case ARG_ACTION: {
1311:                        aa = LT(1);
1312:                        match(ARG_ACTION);
1313:                        if (inputState.guessing == 0) {
1314:                            behavior.refArgAction(aa);
1315:                        }
1316:                        break;
1317:                    }
1318:                    case ACTION:
1319:                    case OPTIONS:
1320:                    case LITERAL_returns:
1321:                    case COLON:
1322:                    case LITERAL_throws: {
1323:                        break;
1324:                    }
1325:                    default: {
1326:                        throw new NoViableAltException(LT(1), getFilename());
1327:                    }
1328:                    }
1329:                }
1330:                {
1331:                    switch (LA(1)) {
1332:                    case LITERAL_returns: {
1333:                        match(LITERAL_returns);
1334:                        rt = LT(1);
1335:                        match(ARG_ACTION);
1336:                        if (inputState.guessing == 0) {
1337:                            behavior.refReturnAction(rt);
1338:                        }
1339:                        break;
1340:                    }
1341:                    case ACTION:
1342:                    case OPTIONS:
1343:                    case COLON:
1344:                    case LITERAL_throws: {
1345:                        break;
1346:                    }
1347:                    default: {
1348:                        throw new NoViableAltException(LT(1), getFilename());
1349:                    }
1350:                    }
1351:                }
1352:                {
1353:                    switch (LA(1)) {
1354:                    case LITERAL_throws: {
1355:                        throwsSpec();
1356:                        break;
1357:                    }
1358:                    case ACTION:
1359:                    case OPTIONS:
1360:                    case COLON: {
1361:                        break;
1362:                    }
1363:                    default: {
1364:                        throw new NoViableAltException(LT(1), getFilename());
1365:                    }
1366:                    }
1367:                }
1368:                {
1369:                    switch (LA(1)) {
1370:                    case OPTIONS: {
1371:                        ruleOptionsSpec();
1372:                        break;
1373:                    }
1374:                    case ACTION:
1375:                    case COLON: {
1376:                        break;
1377:                    }
1378:                    default: {
1379:                        throw new NoViableAltException(LT(1), getFilename());
1380:                    }
1381:                    }
1382:                }
1383:                {
1384:                    switch (LA(1)) {
1385:                    case ACTION: {
1386:                        a = LT(1);
1387:                        match(ACTION);
1388:                        if (inputState.guessing == 0) {
1389:                            behavior.refInitAction(a);
1390:                        }
1391:                        break;
1392:                    }
1393:                    case COLON: {
1394:                        break;
1395:                    }
1396:                    default: {
1397:                        throw new NoViableAltException(LT(1), getFilename());
1398:                    }
1399:                    }
1400:                }
1401:                match(COLON);
1402:                block();
1403:                match(SEMI);
1404:                {
1405:                    switch (LA(1)) {
1406:                    case LITERAL_exception: {
1407:                        exceptionGroup();
1408:                        break;
1409:                    }
1410:                    case EOF:
1411:                    case ACTION:
1412:                    case DOC_COMMENT:
1413:                    case LITERAL_lexclass:
1414:                    case LITERAL_class:
1415:                    case TOKEN_REF:
1416:                    case LITERAL_protected:
1417:                    case LITERAL_public:
1418:                    case LITERAL_private:
1419:                    case RULE_REF: {
1420:                        break;
1421:                    }
1422:                    default: {
1423:                        throw new NoViableAltException(LT(1), getFilename());
1424:                    }
1425:                    }
1426:                }
1427:                if (inputState.guessing == 0) {
1428:                    behavior.endRule(idTok.getText());
1429:                }
1430:            }
1431:
1432:            public final void throwsSpec() throws RecognitionException,
1433:                    TokenStreamException {
1434:
1435:                String t = null;
1436:                Token a, b;
1437:
1438:                match(LITERAL_throws);
1439:                a = id();
1440:                if (inputState.guessing == 0) {
1441:                    t = a.getText();
1442:                }
1443:                {
1444:                    _loop84: do {
1445:                        if ((LA(1) == COMMA)) {
1446:                            match(COMMA);
1447:                            b = id();
1448:                            if (inputState.guessing == 0) {
1449:                                t += "," + b.getText();
1450:                            }
1451:                        } else {
1452:                            break _loop84;
1453:                        }
1454:
1455:                    } while (true);
1456:                }
1457:                if (inputState.guessing == 0) {
1458:                    behavior.setUserExceptions(t);
1459:                }
1460:            }
1461:
1462:            public final void ruleOptionsSpec() throws RecognitionException,
1463:                    TokenStreamException {
1464:
1465:                Token idTok;
1466:                Token value;
1467:
1468:                match(OPTIONS);
1469:                {
1470:                    _loop81: do {
1471:                        if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)) {
1472:                            idTok = id();
1473:                            match(ASSIGN);
1474:                            value = optionValue();
1475:                            if (inputState.guessing == 0) {
1476:                                behavior.setRuleOption(idTok, value);
1477:                            }
1478:                            match(SEMI);
1479:                        } else {
1480:                            break _loop81;
1481:                        }
1482:
1483:                    } while (true);
1484:                }
1485:                match(RCURLY);
1486:            }
1487:
1488:            public final void block() throws RecognitionException,
1489:                    TokenStreamException {
1490:
1491:                if (inputState.guessing == 0) {
1492:                    blockNesting++;
1493:                }
1494:                alternative();
1495:                {
1496:                    _loop87: do {
1497:                        if ((LA(1) == OR)) {
1498:                            match(OR);
1499:                            alternative();
1500:                        } else {
1501:                            break _loop87;
1502:                        }
1503:
1504:                    } while (true);
1505:                }
1506:                if (inputState.guessing == 0) {
1507:                    blockNesting--;
1508:                }
1509:            }
1510:
1511:            public final void exceptionGroup() throws RecognitionException,
1512:                    TokenStreamException {
1513:
1514:                if (inputState.guessing == 0) {
1515:                    behavior.beginExceptionGroup();
1516:                }
1517:                {
1518:                    int _cnt95 = 0;
1519:                    _loop95: do {
1520:                        if ((LA(1) == LITERAL_exception)) {
1521:                            exceptionSpec();
1522:                        } else {
1523:                            if (_cnt95 >= 1) {
1524:                                break _loop95;
1525:                            } else {
1526:                                throw new NoViableAltException(LT(1),
1527:                                        getFilename());
1528:                            }
1529:                        }
1530:
1531:                        _cnt95++;
1532:                    } while (true);
1533:                }
1534:                if (inputState.guessing == 0) {
1535:                    behavior.endExceptionGroup();
1536:                }
1537:            }
1538:
1539:            public final void alternative() throws RecognitionException,
1540:                    TokenStreamException {
1541:
1542:                boolean altAutoGen = true;
1543:
1544:                {
1545:                    switch (LA(1)) {
1546:                    case BANG: {
1547:                        match(BANG);
1548:                        if (inputState.guessing == 0) {
1549:                            altAutoGen = false;
1550:                        }
1551:                        break;
1552:                    }
1553:                    case STRING_LITERAL:
1554:                    case ACTION:
1555:                    case SEMI:
1556:                    case CHAR_LITERAL:
1557:                    case OR:
1558:                    case TOKEN_REF:
1559:                    case LPAREN:
1560:                    case RPAREN:
1561:                    case LITERAL_exception:
1562:                    case RULE_REF:
1563:                    case NOT_OP:
1564:                    case SEMPRED:
1565:                    case TREE_BEGIN:
1566:                    case WILDCARD: {
1567:                        break;
1568:                    }
1569:                    default: {
1570:                        throw new NoViableAltException(LT(1), getFilename());
1571:                    }
1572:                    }
1573:                }
1574:                if (inputState.guessing == 0) {
1575:                    behavior.beginAlt(altAutoGen);
1576:                }
1577:                {
1578:                    _loop91: do {
1579:                        if ((_tokenSet_2.member(LA(1)))) {
1580:                            element();
1581:                        } else {
1582:                            break _loop91;
1583:                        }
1584:
1585:                    } while (true);
1586:                }
1587:                {
1588:                    switch (LA(1)) {
1589:                    case LITERAL_exception: {
1590:                        exceptionSpecNoLabel();
1591:                        break;
1592:                    }
1593:                    case SEMI:
1594:                    case OR:
1595:                    case RPAREN: {
1596:                        break;
1597:                    }
1598:                    default: {
1599:                        throw new NoViableAltException(LT(1), getFilename());
1600:                    }
1601:                    }
1602:                }
1603:                if (inputState.guessing == 0) {
1604:                    behavior.endAlt();
1605:                }
1606:            }
1607:
1608:            public final void element() throws RecognitionException,
1609:                    TokenStreamException {
1610:
1611:                elementNoOptionSpec();
1612:                {
1613:                    switch (LA(1)) {
1614:                    case OPEN_ELEMENT_OPTION: {
1615:                        elementOptionSpec();
1616:                        break;
1617:                    }
1618:                    case STRING_LITERAL:
1619:                    case ACTION:
1620:                    case SEMI:
1621:                    case CHAR_LITERAL:
1622:                    case OR:
1623:                    case TOKEN_REF:
1624:                    case LPAREN:
1625:                    case RPAREN:
1626:                    case LITERAL_exception:
1627:                    case RULE_REF:
1628:                    case NOT_OP:
1629:                    case SEMPRED:
1630:                    case TREE_BEGIN:
1631:                    case WILDCARD: {
1632:                        break;
1633:                    }
1634:                    default: {
1635:                        throw new NoViableAltException(LT(1), getFilename());
1636:                    }
1637:                    }
1638:                }
1639:            }
1640:
1641:            public final void exceptionSpecNoLabel()
1642:                    throws RecognitionException, TokenStreamException {
1643:
1644:                match(LITERAL_exception);
1645:                if (inputState.guessing == 0) {
1646:                    behavior.beginExceptionSpec(null);
1647:                }
1648:                {
1649:                    _loop102: do {
1650:                        if ((LA(1) == LITERAL_catch)) {
1651:                            exceptionHandler();
1652:                        } else {
1653:                            break _loop102;
1654:                        }
1655:
1656:                    } while (true);
1657:                }
1658:                if (inputState.guessing == 0) {
1659:                    behavior.endExceptionSpec();
1660:                }
1661:            }
1662:
1663:            public final void exceptionSpec() throws RecognitionException,
1664:                    TokenStreamException {
1665:
1666:                Token aa = null;
1667:                Token labelAction = null;
1668:
1669:                match(LITERAL_exception);
1670:                {
1671:                    switch (LA(1)) {
1672:                    case ARG_ACTION: {
1673:                        aa = LT(1);
1674:                        match(ARG_ACTION);
1675:                        if (inputState.guessing == 0) {
1676:                            labelAction = aa;
1677:                        }
1678:                        break;
1679:                    }
1680:                    case EOF:
1681:                    case ACTION:
1682:                    case DOC_COMMENT:
1683:                    case LITERAL_lexclass:
1684:                    case LITERAL_class:
1685:                    case TOKEN_REF:
1686:                    case LITERAL_protected:
1687:                    case LITERAL_public:
1688:                    case LITERAL_private:
1689:                    case LITERAL_exception:
1690:                    case LITERAL_catch:
1691:                    case RULE_REF: {
1692:                        break;
1693:                    }
1694:                    default: {
1695:                        throw new NoViableAltException(LT(1), getFilename());
1696:                    }
1697:                    }
1698:                }
1699:                if (inputState.guessing == 0) {
1700:                    behavior.beginExceptionSpec(labelAction);
1701:                }
1702:                {
1703:                    _loop99: do {
1704:                        if ((LA(1) == LITERAL_catch)) {
1705:                            exceptionHandler();
1706:                        } else {
1707:                            break _loop99;
1708:                        }
1709:
1710:                    } while (true);
1711:                }
1712:                if (inputState.guessing == 0) {
1713:                    behavior.endExceptionSpec();
1714:                }
1715:            }
1716:
1717:            public final void exceptionHandler() throws RecognitionException,
1718:                    TokenStreamException {
1719:
1720:                Token a1 = null;
1721:                Token a2 = null;
1722:                Token exType;
1723:                Token exName;
1724:
1725:                match(LITERAL_catch);
1726:                a1 = LT(1);
1727:                match(ARG_ACTION);
1728:                a2 = LT(1);
1729:                match(ACTION);
1730:                if (inputState.guessing == 0) {
1731:                    behavior.refExceptionHandler(a1, a2);
1732:                }
1733:            }
1734:
1735:            public final void elementNoOptionSpec()
1736:                    throws RecognitionException, TokenStreamException {
1737:
1738:                Token rr = null;
1739:                Token aa = null;
1740:                Token tr = null;
1741:                Token aa2 = null;
1742:                Token r2 = null;
1743:                Token aa3 = null;
1744:                Token a = null;
1745:                Token p = null;
1746:
1747:                Token label = null;
1748:                Token assignId = null;
1749:                Token args = null;
1750:                int autoGen = GrammarElement.AUTO_GEN_NONE;
1751:
1752:                switch (LA(1)) {
1753:                case ACTION: {
1754:                    a = LT(1);
1755:                    match(ACTION);
1756:                    if (inputState.guessing == 0) {
1757:                        behavior.refAction(a);
1758:                    }
1759:                    break;
1760:                }
1761:                case SEMPRED: {
1762:                    p = LT(1);
1763:                    match(SEMPRED);
1764:                    if (inputState.guessing == 0) {
1765:                        behavior.refSemPred(p);
1766:                    }
1767:                    break;
1768:                }
1769:                case TREE_BEGIN: {
1770:                    tree();
1771:                    break;
1772:                }
1773:                default:
1774:                    if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)
1775:                            && (LA(2) == ASSIGN)) {
1776:                        assignId = id();
1777:                        match(ASSIGN);
1778:                        {
1779:                            if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)
1780:                                    && (LA(2) == COLON)) {
1781:                                label = id();
1782:                                match(COLON);
1783:                                if (inputState.guessing == 0) {
1784:                                    checkForMissingEndRule(label);
1785:                                }
1786:                            } else if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)
1787:                                    && (_tokenSet_3.member(LA(2)))) {
1788:                            } else {
1789:                                throw new NoViableAltException(LT(1),
1790:                                        getFilename());
1791:                            }
1792:
1793:                        }
1794:                        {
1795:                            switch (LA(1)) {
1796:                            case RULE_REF: {
1797:                                rr = LT(1);
1798:                                match(RULE_REF);
1799:                                {
1800:                                    switch (LA(1)) {
1801:                                    case ARG_ACTION: {
1802:                                        aa = LT(1);
1803:                                        match(ARG_ACTION);
1804:                                        if (inputState.guessing == 0) {
1805:                                            args = aa;
1806:                                        }
1807:                                        break;
1808:                                    }
1809:                                    case STRING_LITERAL:
1810:                                    case ACTION:
1811:                                    case SEMI:
1812:                                    case CHAR_LITERAL:
1813:                                    case OR:
1814:                                    case TOKEN_REF:
1815:                                    case OPEN_ELEMENT_OPTION:
1816:                                    case LPAREN:
1817:                                    case RPAREN:
1818:                                    case BANG:
1819:                                    case LITERAL_exception:
1820:                                    case RULE_REF:
1821:                                    case NOT_OP:
1822:                                    case SEMPRED:
1823:                                    case TREE_BEGIN:
1824:                                    case WILDCARD: {
1825:                                        break;
1826:                                    }
1827:                                    default: {
1828:                                        throw new NoViableAltException(LT(1),
1829:                                                getFilename());
1830:                                    }
1831:                                    }
1832:                                }
1833:                                {
1834:                                    switch (LA(1)) {
1835:                                    case BANG: {
1836:                                        match(BANG);
1837:                                        if (inputState.guessing == 0) {
1838:                                            autoGen = GrammarElement.AUTO_GEN_BANG;
1839:                                        }
1840:                                        break;
1841:                                    }
1842:                                    case STRING_LITERAL:
1843:                                    case ACTION:
1844:                                    case SEMI:
1845:                                    case CHAR_LITERAL:
1846:                                    case OR:
1847:                                    case TOKEN_REF:
1848:                                    case OPEN_ELEMENT_OPTION:
1849:                                    case LPAREN:
1850:                                    case RPAREN:
1851:                                    case LITERAL_exception:
1852:                                    case RULE_REF:
1853:                                    case NOT_OP:
1854:                                    case SEMPRED:
1855:                                    case TREE_BEGIN:
1856:                                    case WILDCARD: {
1857:                                        break;
1858:                                    }
1859:                                    default: {
1860:                                        throw new NoViableAltException(LT(1),
1861:                                                getFilename());
1862:                                    }
1863:                                    }
1864:                                }
1865:                                if (inputState.guessing == 0) {
1866:                                    behavior.refRule(assignId, rr, label, args,
1867:                                            autoGen);
1868:                                }
1869:                                break;
1870:                            }
1871:                            case TOKEN_REF: {
1872:                                tr = LT(1);
1873:                                match(TOKEN_REF);
1874:                                {
1875:                                    switch (LA(1)) {
1876:                                    case ARG_ACTION: {
1877:                                        aa2 = LT(1);
1878:                                        match(ARG_ACTION);
1879:                                        if (inputState.guessing == 0) {
1880:                                            args = aa2;
1881:                                        }
1882:                                        break;
1883:                                    }
1884:                                    case STRING_LITERAL:
1885:                                    case ACTION:
1886:                                    case SEMI:
1887:                                    case CHAR_LITERAL:
1888:                                    case OR:
1889:                                    case TOKEN_REF:
1890:                                    case OPEN_ELEMENT_OPTION:
1891:                                    case LPAREN:
1892:                                    case RPAREN:
1893:                                    case LITERAL_exception:
1894:                                    case RULE_REF:
1895:                                    case NOT_OP:
1896:                                    case SEMPRED:
1897:                                    case TREE_BEGIN:
1898:                                    case WILDCARD: {
1899:                                        break;
1900:                                    }
1901:                                    default: {
1902:                                        throw new NoViableAltException(LT(1),
1903:                                                getFilename());
1904:                                    }
1905:                                    }
1906:                                }
1907:                                if (inputState.guessing == 0) {
1908:                                    behavior.refToken(assignId, tr, label,
1909:                                            args, false, autoGen, lastInRule());
1910:                                }
1911:                                break;
1912:                            }
1913:                            default: {
1914:                                throw new NoViableAltException(LT(1),
1915:                                        getFilename());
1916:                            }
1917:                            }
1918:                        }
1919:                    } else if ((_tokenSet_4.member(LA(1)))
1920:                            && (_tokenSet_5.member(LA(2)))) {
1921:                        {
1922:                            if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)
1923:                                    && (LA(2) == COLON)) {
1924:                                label = id();
1925:                                match(COLON);
1926:                                if (inputState.guessing == 0) {
1927:                                    checkForMissingEndRule(label);
1928:                                }
1929:                            } else if ((_tokenSet_4.member(LA(1)))
1930:                                    && (_tokenSet_6.member(LA(2)))) {
1931:                            } else {
1932:                                throw new NoViableAltException(LT(1),
1933:                                        getFilename());
1934:                            }
1935:
1936:                        }
1937:                        {
1938:                            switch (LA(1)) {
1939:                            case RULE_REF: {
1940:                                r2 = LT(1);
1941:                                match(RULE_REF);
1942:                                {
1943:                                    switch (LA(1)) {
1944:                                    case ARG_ACTION: {
1945:                                        aa3 = LT(1);
1946:                                        match(ARG_ACTION);
1947:                                        if (inputState.guessing == 0) {
1948:                                            args = aa3;
1949:                                        }
1950:                                        break;
1951:                                    }
1952:                                    case STRING_LITERAL:
1953:                                    case ACTION:
1954:                                    case SEMI:
1955:                                    case CHAR_LITERAL:
1956:                                    case OR:
1957:                                    case TOKEN_REF:
1958:                                    case OPEN_ELEMENT_OPTION:
1959:                                    case LPAREN:
1960:                                    case RPAREN:
1961:                                    case BANG:
1962:                                    case LITERAL_exception:
1963:                                    case RULE_REF:
1964:                                    case NOT_OP:
1965:                                    case SEMPRED:
1966:                                    case TREE_BEGIN:
1967:                                    case WILDCARD: {
1968:                                        break;
1969:                                    }
1970:                                    default: {
1971:                                        throw new NoViableAltException(LT(1),
1972:                                                getFilename());
1973:                                    }
1974:                                    }
1975:                                }
1976:                                {
1977:                                    switch (LA(1)) {
1978:                                    case BANG: {
1979:                                        match(BANG);
1980:                                        if (inputState.guessing == 0) {
1981:                                            autoGen = GrammarElement.AUTO_GEN_BANG;
1982:                                        }
1983:                                        break;
1984:                                    }
1985:                                    case STRING_LITERAL:
1986:                                    case ACTION:
1987:                                    case SEMI:
1988:                                    case CHAR_LITERAL:
1989:                                    case OR:
1990:                                    case TOKEN_REF:
1991:                                    case OPEN_ELEMENT_OPTION:
1992:                                    case LPAREN:
1993:                                    case RPAREN:
1994:                                    case LITERAL_exception:
1995:                                    case RULE_REF:
1996:                                    case NOT_OP:
1997:                                    case SEMPRED:
1998:                                    case TREE_BEGIN:
1999:                                    case WILDCARD: {
2000:                                        break;
2001:                                    }
2002:                                    default: {
2003:                                        throw new NoViableAltException(LT(1),
2004:                                                getFilename());
2005:                                    }
2006:                                    }
2007:                                }
2008:                                if (inputState.guessing == 0) {
2009:                                    behavior.refRule(assignId, r2, label, args,
2010:                                            autoGen);
2011:                                }
2012:                                break;
2013:                            }
2014:                            case NOT_OP: {
2015:                                match(NOT_OP);
2016:                                {
2017:                                    switch (LA(1)) {
2018:                                    case CHAR_LITERAL:
2019:                                    case TOKEN_REF: {
2020:                                        notTerminal(label);
2021:                                        break;
2022:                                    }
2023:                                    case LPAREN: {
2024:                                        ebnf(label, true);
2025:                                        break;
2026:                                    }
2027:                                    default: {
2028:                                        throw new NoViableAltException(LT(1),
2029:                                                getFilename());
2030:                                    }
2031:                                    }
2032:                                }
2033:                                break;
2034:                            }
2035:                            case LPAREN: {
2036:                                ebnf(label, false);
2037:                                break;
2038:                            }
2039:                            default:
2040:                                if ((LA(1) == STRING_LITERAL
2041:                                        || LA(1) == CHAR_LITERAL || LA(1) == TOKEN_REF)
2042:                                        && (LA(2) == RANGE)) {
2043:                                    range(label);
2044:                                } else if ((_tokenSet_7.member(LA(1)))
2045:                                        && (_tokenSet_8.member(LA(2)))) {
2046:                                    terminal(label);
2047:                                } else {
2048:                                    throw new NoViableAltException(LT(1),
2049:                                            getFilename());
2050:                                }
2051:                            }
2052:                        }
2053:                    } else {
2054:                        throw new NoViableAltException(LT(1), getFilename());
2055:                    }
2056:                }
2057:            }
2058:
2059:            public final void elementOptionSpec() throws RecognitionException,
2060:                    TokenStreamException {
2061:
2062:                Token o = null, v = null;
2063:
2064:                match(OPEN_ELEMENT_OPTION);
2065:                o = id();
2066:                match(ASSIGN);
2067:                v = optionValue();
2068:                if (inputState.guessing == 0) {
2069:                    behavior.refElementOption(o, v);
2070:                }
2071:                {
2072:                    _loop108: do {
2073:                        if ((LA(1) == SEMI)) {
2074:                            match(SEMI);
2075:                            o = id();
2076:                            match(ASSIGN);
2077:                            v = optionValue();
2078:                            if (inputState.guessing == 0) {
2079:                                behavior.refElementOption(o, v);
2080:                            }
2081:                        } else {
2082:                            break _loop108;
2083:                        }
2084:
2085:                    } while (true);
2086:                }
2087:                match(CLOSE_ELEMENT_OPTION);
2088:            }
2089:
2090:            public final void range(Token label) throws RecognitionException,
2091:                    TokenStreamException {
2092:
2093:                Token crLeft = null;
2094:                Token crRight = null;
2095:                Token t = null;
2096:                Token u = null;
2097:                Token v = null;
2098:                Token w = null;
2099:
2100:                Token trLeft = null;
2101:                Token trRight = null;
2102:                int autoGen = GrammarElement.AUTO_GEN_NONE;
2103:
2104:                switch (LA(1)) {
2105:                case CHAR_LITERAL: {
2106:                    crLeft = LT(1);
2107:                    match(CHAR_LITERAL);
2108:                    match(RANGE);
2109:                    crRight = LT(1);
2110:                    match(CHAR_LITERAL);
2111:                    {
2112:                        switch (LA(1)) {
2113:                        case BANG: {
2114:                            match(BANG);
2115:                            if (inputState.guessing == 0) {
2116:                                autoGen = GrammarElement.AUTO_GEN_BANG;
2117:                            }
2118:                            break;
2119:                        }
2120:                        case STRING_LITERAL:
2121:                        case ACTION:
2122:                        case SEMI:
2123:                        case CHAR_LITERAL:
2124:                        case OR:
2125:                        case TOKEN_REF:
2126:                        case OPEN_ELEMENT_OPTION:
2127:                        case LPAREN:
2128:                        case RPAREN:
2129:                        case LITERAL_exception:
2130:                        case RULE_REF:
2131:                        case NOT_OP:
2132:                        case SEMPRED:
2133:                        case TREE_BEGIN:
2134:                        case WILDCARD: {
2135:                            break;
2136:                        }
2137:                        default: {
2138:                            throw new NoViableAltException(LT(1), getFilename());
2139:                        }
2140:                        }
2141:                    }
2142:                    if (inputState.guessing == 0) {
2143:                        behavior.refCharRange(crLeft, crRight, label, autoGen,
2144:                                lastInRule());
2145:                    }
2146:                    break;
2147:                }
2148:                case STRING_LITERAL:
2149:                case TOKEN_REF: {
2150:                    {
2151:                        switch (LA(1)) {
2152:                        case TOKEN_REF: {
2153:                            t = LT(1);
2154:                            match(TOKEN_REF);
2155:                            if (inputState.guessing == 0) {
2156:                                trLeft = t;
2157:                            }
2158:                            break;
2159:                        }
2160:                        case STRING_LITERAL: {
2161:                            u = LT(1);
2162:                            match(STRING_LITERAL);
2163:                            if (inputState.guessing == 0) {
2164:                                trLeft = u;
2165:                            }
2166:                            break;
2167:                        }
2168:                        default: {
2169:                            throw new NoViableAltException(LT(1), getFilename());
2170:                        }
2171:                        }
2172:                    }
2173:                    match(RANGE);
2174:                    {
2175:                        switch (LA(1)) {
2176:                        case TOKEN_REF: {
2177:                            v = LT(1);
2178:                            match(TOKEN_REF);
2179:                            if (inputState.guessing == 0) {
2180:                                trRight = v;
2181:                            }
2182:                            break;
2183:                        }
2184:                        case STRING_LITERAL: {
2185:                            w = LT(1);
2186:                            match(STRING_LITERAL);
2187:                            if (inputState.guessing == 0) {
2188:                                trRight = w;
2189:                            }
2190:                            break;
2191:                        }
2192:                        default: {
2193:                            throw new NoViableAltException(LT(1), getFilename());
2194:                        }
2195:                        }
2196:                    }
2197:                    autoGen = ast_type_spec();
2198:                    if (inputState.guessing == 0) {
2199:                        behavior.refTokenRange(trLeft, trRight, label, autoGen,
2200:                                lastInRule());
2201:                    }
2202:                    break;
2203:                }
2204:                default: {
2205:                    throw new NoViableAltException(LT(1), getFilename());
2206:                }
2207:                }
2208:            }
2209:
2210:            public final void terminal(Token label)
2211:                    throws RecognitionException, TokenStreamException {
2212:
2213:                Token cl = null;
2214:                Token tr = null;
2215:                Token aa = null;
2216:                Token sl = null;
2217:                Token wi = null;
2218:
2219:                int autoGen = GrammarElement.AUTO_GEN_NONE;
2220:                Token args = null;
2221:
2222:                switch (LA(1)) {
2223:                case CHAR_LITERAL: {
2224:                    cl = LT(1);
2225:                    match(CHAR_LITERAL);
2226:                    {
2227:                        switch (LA(1)) {
2228:                        case BANG: {
2229:                            match(BANG);
2230:                            if (inputState.guessing == 0) {
2231:                                autoGen = GrammarElement.AUTO_GEN_BANG;
2232:                            }
2233:                            break;
2234:                        }
2235:                        case STRING_LITERAL:
2236:                        case ACTION:
2237:                        case SEMI:
2238:                        case CHAR_LITERAL:
2239:                        case OR:
2240:                        case TOKEN_REF:
2241:                        case OPEN_ELEMENT_OPTION:
2242:                        case LPAREN:
2243:                        case RPAREN:
2244:                        case LITERAL_exception:
2245:                        case RULE_REF:
2246:                        case NOT_OP:
2247:                        case SEMPRED:
2248:                        case TREE_BEGIN:
2249:                        case WILDCARD: {
2250:                            break;
2251:                        }
2252:                        default: {
2253:                            throw new NoViableAltException(LT(1), getFilename());
2254:                        }
2255:                        }
2256:                    }
2257:                    if (inputState.guessing == 0) {
2258:                        behavior.refCharLiteral(cl, label, false, autoGen,
2259:                                lastInRule());
2260:                    }
2261:                    break;
2262:                }
2263:                case TOKEN_REF: {
2264:                    tr = LT(1);
2265:                    match(TOKEN_REF);
2266:                    autoGen = ast_type_spec();
2267:                    {
2268:                        switch (LA(1)) {
2269:                        case ARG_ACTION: {
2270:                            aa = LT(1);
2271:                            match(ARG_ACTION);
2272:                            if (inputState.guessing == 0) {
2273:                                args = aa;
2274:                            }
2275:                            break;
2276:                        }
2277:                        case STRING_LITERAL:
2278:                        case ACTION:
2279:                        case SEMI:
2280:                        case CHAR_LITERAL:
2281:                        case OR:
2282:                        case TOKEN_REF:
2283:                        case OPEN_ELEMENT_OPTION:
2284:                        case LPAREN:
2285:                        case RPAREN:
2286:                        case LITERAL_exception:
2287:                        case RULE_REF:
2288:                        case NOT_OP:
2289:                        case SEMPRED:
2290:                        case TREE_BEGIN:
2291:                        case WILDCARD: {
2292:                            break;
2293:                        }
2294:                        default: {
2295:                            throw new NoViableAltException(LT(1), getFilename());
2296:                        }
2297:                        }
2298:                    }
2299:                    if (inputState.guessing == 0) {
2300:                        behavior.refToken(null, tr, label, args, false,
2301:                                autoGen, lastInRule());
2302:                    }
2303:                    break;
2304:                }
2305:                case STRING_LITERAL: {
2306:                    sl = LT(1);
2307:                    match(STRING_LITERAL);
2308:                    autoGen = ast_type_spec();
2309:                    if (inputState.guessing == 0) {
2310:                        behavior.refStringLiteral(sl, label, autoGen,
2311:                                lastInRule());
2312:                    }
2313:                    break;
2314:                }
2315:                case WILDCARD: {
2316:                    wi = LT(1);
2317:                    match(WILDCARD);
2318:                    autoGen = ast_type_spec();
2319:                    if (inputState.guessing == 0) {
2320:                        behavior.refWildcard(wi, label, autoGen);
2321:                    }
2322:                    break;
2323:                }
2324:                default: {
2325:                    throw new NoViableAltException(LT(1), getFilename());
2326:                }
2327:                }
2328:            }
2329:
2330:            public final void notTerminal(Token label)
2331:                    throws RecognitionException, TokenStreamException {
2332:
2333:                Token cl = null;
2334:                Token tr = null;
2335:                int autoGen = GrammarElement.AUTO_GEN_NONE;
2336:
2337:                switch (LA(1)) {
2338:                case CHAR_LITERAL: {
2339:                    cl = LT(1);
2340:                    match(CHAR_LITERAL);
2341:                    {
2342:                        switch (LA(1)) {
2343:                        case BANG: {
2344:                            match(BANG);
2345:                            if (inputState.guessing == 0) {
2346:                                autoGen = GrammarElement.AUTO_GEN_BANG;
2347:                            }
2348:                            break;
2349:                        }
2350:                        case STRING_LITERAL:
2351:                        case ACTION:
2352:                        case SEMI:
2353:                        case CHAR_LITERAL:
2354:                        case OR:
2355:                        case TOKEN_REF:
2356:                        case OPEN_ELEMENT_OPTION:
2357:                        case LPAREN:
2358:                        case RPAREN:
2359:                        case LITERAL_exception:
2360:                        case RULE_REF:
2361:                        case NOT_OP:
2362:                        case SEMPRED:
2363:                        case TREE_BEGIN:
2364:                        case WILDCARD: {
2365:                            break;
2366:                        }
2367:                        default: {
2368:                            throw new NoViableAltException(LT(1), getFilename());
2369:                        }
2370:                        }
2371:                    }
2372:                    if (inputState.guessing == 0) {
2373:                        behavior.refCharLiteral(cl, label, true, autoGen,
2374:                                lastInRule());
2375:                    }
2376:                    break;
2377:                }
2378:                case TOKEN_REF: {
2379:                    tr = LT(1);
2380:                    match(TOKEN_REF);
2381:                    autoGen = ast_type_spec();
2382:                    if (inputState.guessing == 0) {
2383:                        behavior.refToken(null, tr, label, null, true, autoGen,
2384:                                lastInRule());
2385:                    }
2386:                    break;
2387:                }
2388:                default: {
2389:                    throw new NoViableAltException(LT(1), getFilename());
2390:                }
2391:                }
2392:            }
2393:
2394:            public final void ebnf(Token label, boolean not)
2395:                    throws RecognitionException, TokenStreamException {
2396:
2397:                Token lp = null;
2398:                Token aa = null;
2399:                Token ab = null;
2400:
2401:                lp = LT(1);
2402:                match(LPAREN);
2403:                if (inputState.guessing == 0) {
2404:                    behavior.beginSubRule(label, lp, not);
2405:                }
2406:                {
2407:                    if ((LA(1) == OPTIONS)) {
2408:                        subruleOptionsSpec();
2409:                        {
2410:                            switch (LA(1)) {
2411:                            case ACTION: {
2412:                                aa = LT(1);
2413:                                match(ACTION);
2414:                                if (inputState.guessing == 0) {
2415:                                    behavior.refInitAction(aa);
2416:                                }
2417:                                break;
2418:                            }
2419:                            case COLON: {
2420:                                break;
2421:                            }
2422:                            default: {
2423:                                throw new NoViableAltException(LT(1),
2424:                                        getFilename());
2425:                            }
2426:                            }
2427:                        }
2428:                        match(COLON);
2429:                    } else if ((LA(1) == ACTION) && (LA(2) == COLON)) {
2430:                        ab = LT(1);
2431:                        match(ACTION);
2432:                        if (inputState.guessing == 0) {
2433:                            behavior.refInitAction(ab);
2434:                        }
2435:                        match(COLON);
2436:                    } else if ((_tokenSet_9.member(LA(1)))
2437:                            && (_tokenSet_10.member(LA(2)))) {
2438:                    } else {
2439:                        throw new NoViableAltException(LT(1), getFilename());
2440:                    }
2441:
2442:                }
2443:                block();
2444:                match(RPAREN);
2445:                {
2446:                    switch (LA(1)) {
2447:                    case STRING_LITERAL:
2448:                    case ACTION:
2449:                    case SEMI:
2450:                    case CHAR_LITERAL:
2451:                    case OR:
2452:                    case TOKEN_REF:
2453:                    case OPEN_ELEMENT_OPTION:
2454:                    case LPAREN:
2455:                    case RPAREN:
2456:                    case BANG:
2457:                    case LITERAL_exception:
2458:                    case RULE_REF:
2459:                    case NOT_OP:
2460:                    case SEMPRED:
2461:                    case TREE_BEGIN:
2462:                    case QUESTION:
2463:                    case STAR:
2464:                    case PLUS:
2465:                    case WILDCARD: {
2466:                        {
2467:                            switch (LA(1)) {
2468:                            case QUESTION: {
2469:                                match(QUESTION);
2470:                                if (inputState.guessing == 0) {
2471:                                    behavior.optionalSubRule();
2472:                                }
2473:                                break;
2474:                            }
2475:                            case STAR: {
2476:                                match(STAR);
2477:                                if (inputState.guessing == 0) {
2478:                                    behavior.zeroOrMoreSubRule();
2479:                                }
2480:                                break;
2481:                            }
2482:                            case PLUS: {
2483:                                match(PLUS);
2484:                                if (inputState.guessing == 0) {
2485:                                    behavior.oneOrMoreSubRule();
2486:                                }
2487:                                break;
2488:                            }
2489:                            case STRING_LITERAL:
2490:                            case ACTION:
2491:                            case SEMI:
2492:                            case CHAR_LITERAL:
2493:                            case OR:
2494:                            case TOKEN_REF:
2495:                            case OPEN_ELEMENT_OPTION:
2496:                            case LPAREN:
2497:                            case RPAREN:
2498:                            case BANG:
2499:                            case LITERAL_exception:
2500:                            case RULE_REF:
2501:                            case NOT_OP:
2502:                            case SEMPRED:
2503:                            case TREE_BEGIN:
2504:                            case WILDCARD: {
2505:                                break;
2506:                            }
2507:                            default: {
2508:                                throw new NoViableAltException(LT(1),
2509:                                        getFilename());
2510:                            }
2511:                            }
2512:                        }
2513:                        {
2514:                            switch (LA(1)) {
2515:                            case BANG: {
2516:                                match(BANG);
2517:                                if (inputState.guessing == 0) {
2518:                                    behavior.noASTSubRule();
2519:                                }
2520:                                break;
2521:                            }
2522:                            case STRING_LITERAL:
2523:                            case ACTION:
2524:                            case SEMI:
2525:                            case CHAR_LITERAL:
2526:                            case OR:
2527:                            case TOKEN_REF:
2528:                            case OPEN_ELEMENT_OPTION:
2529:                            case LPAREN:
2530:                            case RPAREN:
2531:                            case LITERAL_exception:
2532:                            case RULE_REF:
2533:                            case NOT_OP:
2534:                            case SEMPRED:
2535:                            case TREE_BEGIN:
2536:                            case WILDCARD: {
2537:                                break;
2538:                            }
2539:                            default: {
2540:                                throw new NoViableAltException(LT(1),
2541:                                        getFilename());
2542:                            }
2543:                            }
2544:                        }
2545:                        break;
2546:                    }
2547:                    case IMPLIES: {
2548:                        match(IMPLIES);
2549:                        if (inputState.guessing == 0) {
2550:                            behavior.synPred();
2551:                        }
2552:                        break;
2553:                    }
2554:                    default: {
2555:                        throw new NoViableAltException(LT(1), getFilename());
2556:                    }
2557:                    }
2558:                }
2559:                if (inputState.guessing == 0) {
2560:                    behavior.endSubRule();
2561:                }
2562:            }
2563:
2564:            public final void tree() throws RecognitionException,
2565:                    TokenStreamException {
2566:
2567:                Token lp = null;
2568:
2569:                lp = LT(1);
2570:                match(TREE_BEGIN);
2571:                if (inputState.guessing == 0) {
2572:                    behavior.beginTree(lp);
2573:                }
2574:                rootNode();
2575:                if (inputState.guessing == 0) {
2576:                    behavior.beginChildList();
2577:                }
2578:                {
2579:                    int _cnt122 = 0;
2580:                    _loop122: do {
2581:                        if ((_tokenSet_2.member(LA(1)))) {
2582:                            element();
2583:                        } else {
2584:                            if (_cnt122 >= 1) {
2585:                                break _loop122;
2586:                            } else {
2587:                                throw new NoViableAltException(LT(1),
2588:                                        getFilename());
2589:                            }
2590:                        }
2591:
2592:                        _cnt122++;
2593:                    } while (true);
2594:                }
2595:                if (inputState.guessing == 0) {
2596:                    behavior.endChildList();
2597:                }
2598:                match(RPAREN);
2599:                if (inputState.guessing == 0) {
2600:                    behavior.endTree();
2601:                }
2602:            }
2603:
2604:            public final void rootNode() throws RecognitionException,
2605:                    TokenStreamException {
2606:
2607:                Token label = null;
2608:
2609:                {
2610:                    if ((LA(1) == TOKEN_REF || LA(1) == RULE_REF)
2611:                            && (LA(2) == COLON)) {
2612:                        label = id();
2613:                        match(COLON);
2614:                        if (inputState.guessing == 0) {
2615:                            checkForMissingEndRule(label);
2616:                        }
2617:                    } else if ((_tokenSet_7.member(LA(1)))
2618:                            && (_tokenSet_11.member(LA(2)))) {
2619:                    } else {
2620:                        throw new NoViableAltException(LT(1), getFilename());
2621:                    }
2622:
2623:                }
2624:                terminal(label);
2625:            }
2626:
2627:            public final int ast_type_spec() throws RecognitionException,
2628:                    TokenStreamException {
2629:                int autoGen;
2630:
2631:                autoGen = GrammarElement.AUTO_GEN_NONE;
2632:
2633:                {
2634:                    switch (LA(1)) {
2635:                    case CARET: {
2636:                        match(CARET);
2637:                        if (inputState.guessing == 0) {
2638:                            autoGen = GrammarElement.AUTO_GEN_CARET;
2639:                        }
2640:                        break;
2641:                    }
2642:                    case BANG: {
2643:                        match(BANG);
2644:                        if (inputState.guessing == 0) {
2645:                            autoGen = GrammarElement.AUTO_GEN_BANG;
2646:                        }
2647:                        break;
2648:                    }
2649:                    case STRING_LITERAL:
2650:                    case ACTION:
2651:                    case SEMI:
2652:                    case CHAR_LITERAL:
2653:                    case OR:
2654:                    case TOKEN_REF:
2655:                    case OPEN_ELEMENT_OPTION:
2656:                    case LPAREN:
2657:                    case RPAREN:
2658:                    case ARG_ACTION:
2659:                    case LITERAL_exception:
2660:                    case RULE_REF:
2661:                    case NOT_OP:
2662:                    case SEMPRED:
2663:                    case TREE_BEGIN:
2664:                    case WILDCARD: {
2665:                        break;
2666:                    }
2667:                    default: {
2668:                        throw new NoViableAltException(LT(1), getFilename());
2669:                    }
2670:                    }
2671:                }
2672:                return autoGen;
2673:            }
2674:
2675:            public static final String[] _tokenNames = { "<0>", "EOF", "<2>",
2676:                    "NULL_TREE_LOOKAHEAD", "\"tokens\"", "\"header\"",
2677:                    "STRING_LITERAL", "ACTION", "DOC_COMMENT", "\"lexclass\"",
2678:                    "\"class\"", "\"extends\"", "\"Lexer\"", "\"TreeParser\"",
2679:                    "OPTIONS", "ASSIGN", "SEMI", "RCURLY",
2680:                    "\"charVocabulary\"", "CHAR_LITERAL", "INT", "OR", "RANGE",
2681:                    "TOKENS", "TOKEN_REF", "OPEN_ELEMENT_OPTION",
2682:                    "CLOSE_ELEMENT_OPTION", "LPAREN", "RPAREN", "\"Parser\"",
2683:                    "\"protected\"", "\"public\"", "\"private\"", "BANG",
2684:                    "ARG_ACTION", "\"returns\"", "COLON", "\"throws\"",
2685:                    "COMMA", "\"exception\"", "\"catch\"", "RULE_REF",
2686:                    "NOT_OP", "SEMPRED", "TREE_BEGIN", "QUESTION", "STAR",
2687:                    "PLUS", "IMPLIES", "CARET", "WILDCARD", "\"options\"",
2688:                    "WS", "COMMENT", "SL_COMMENT", "ML_COMMENT", "ESC",
2689:                    "DIGIT", "XDIGIT", "NESTED_ARG_ACTION", "NESTED_ACTION",
2690:                    "WS_LOOP", "INTERNAL_RULE_REF", "WS_OPT" };
2691:
2692:            private static final long[] mk_tokenSet_0() {
2693:                long[] data = { 2206556225792L, 0L };
2694:                return data;
2695:            }
2696:
2697:            public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
2698:
2699:            private static final long[] mk_tokenSet_1() {
2700:                long[] data = { 2472844214400L, 0L };
2701:                return data;
2702:            }
2703:
2704:            public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
2705:
2706:            private static final long[] mk_tokenSet_2() {
2707:                long[] data = { 1158885407195328L, 0L };
2708:                return data;
2709:            }
2710:
2711:            public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
2712:
2713:            private static final long[] mk_tokenSet_3() {
2714:                long[] data = { 1159461236965568L, 0L };
2715:                return data;
2716:            }
2717:
2718:            public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
2719:
2720:            private static final long[] mk_tokenSet_4() {
2721:                long[] data = { 1132497128128576L, 0L };
2722:                return data;
2723:            }
2724:
2725:            public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
2726:
2727:            private static final long[] mk_tokenSet_5() {
2728:                long[] data = { 1722479914074304L, 0L };
2729:                return data;
2730:            }
2731:
2732:            public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
2733:
2734:            private static final long[] mk_tokenSet_6() {
2735:                long[] data = { 1722411194597568L, 0L };
2736:                return data;
2737:            }
2738:
2739:            public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
2740:
2741:            private static final long[] mk_tokenSet_7() {
2742:                long[] data = { 1125899924144192L, 0L };
2743:                return data;
2744:            }
2745:
2746:            public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
2747:
2748:            private static final long[] mk_tokenSet_8() {
2749:                long[] data = { 1722411190386880L, 0L };
2750:                return data;
2751:            }
2752:
2753:            public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
2754:
2755:            private static final long[] mk_tokenSet_9() {
2756:                long[] data = { 1159444023476416L, 0L };
2757:                return data;
2758:            }
2759:
2760:            public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
2761:
2762:            private static final long[] mk_tokenSet_10() {
2763:                long[] data = { 2251345007067328L, 0L };
2764:                return data;
2765:            }
2766:
2767:            public static final BitSet _tokenSet_10 = new BitSet(
2768:                    mk_tokenSet_10());
2769:
2770:            private static final long[] mk_tokenSet_11() {
2771:                long[] data = { 1721861130420416L, 0L };
2772:                return data;
2773:            }
2774:
2775:            public static final BitSet _tokenSet_11 = new BitSet(
2776:                    mk_tokenSet_11());
2777:
2778:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.