Source Code Cross Referenced for SQL.java in  » Rule-Engine » Mandarax » org » mandarax » jdbc » server » parser » 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 » Rule Engine » Mandarax » org.mandarax.jdbc.server.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Generated By:JavaCC: Do not edit this line. SQL.java */
002:        package org.mandarax.jdbc.server.parser;
003:
004:        import org.mandarax.jdbc.server.sql.*;
005:
006:        public class SQL implements  SQLConstants {
007:            SelectStatement select = new SelectStatement();
008:
009:            public static void main(String[] args) throws ParseException,
010:                    TokenMgrError {
011:                SQL parser = new SQL(System.in);
012:                parser.Select(new SelectStatement());
013:            }
014:
015:            final public void Select(SelectStatement select)
016:                    throws ParseException {
017:                jj_consume_token(SELECT);
018:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
019:                case DISTINCT:
020:                    Distinct(select);
021:                    break;
022:                default:
023:                    jj_la1[0] = jj_gen;
024:                    ;
025:                }
026:                SelectClause(select);
027:                jj_consume_token(FROM);
028:                Table(select);
029:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
030:                case WHERE:
031:                    Where(select);
032:                    break;
033:                default:
034:                    jj_la1[1] = jj_gen;
035:                    ;
036:                }
037:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
038:                case GROUP_BY:
039:                    GroupBy(select);
040:                    break;
041:                default:
042:                    jj_la1[2] = jj_gen;
043:                    ;
044:                }
045:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
046:                case ORDER_BY:
047:                    OrderBy(select);
048:                    break;
049:                default:
050:                    jj_la1[3] = jj_gen;
051:                    ;
052:                }
053:            }
054:
055:            final public void Distinct(SelectStatement select)
056:                    throws ParseException {
057:                jj_consume_token(DISTINCT);
058:                select.setDistinct(true);
059:            }
060:
061:            final public void Where(SelectStatement select)
062:                    throws ParseException {
063:                jj_consume_token(WHERE);
064:                WhereClause where = new WhereClause();
065:                select.setWhereClause(where);
066:                Condition(where);
067:            }
068:
069:            final public void Condition(ConditionContext context)
070:                    throws ParseException {
071:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
072:                case NOT:
073:                    Not(context);
074:                    break;
075:                default:
076:                    jj_la1[4] = jj_gen;
077:                    ;
078:                }
079:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
080:                case HOST_VARIABLE:
081:                case SUM:
082:                case COUNT:
083:                case AVG:
084:                case MIN:
085:                case MAX:
086:                case INTEGER_NUMBER:
087:                case DECIMAL_NUMBER:
088:                case NAME:
089:                case STRING:
090:                    SimpleCondition(context);
091:                    break;
092:                case OPEN_BRACKET:
093:                    SubCondition(context);
094:                    break;
095:                default:
096:                    jj_la1[5] = jj_gen;
097:                    jj_consume_token(-1);
098:                    throw new ParseException();
099:                }
100:                label_1: while (true) {
101:                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
102:                    case AND:
103:                    case OR:
104:                        ;
105:                        break;
106:                    default:
107:                        jj_la1[6] = jj_gen;
108:                        break label_1;
109:                    }
110:                    BinaryConnective(context);
111:                    Condition(context);
112:                }
113:            }
114:
115:            final public void SubCondition(ConditionContext context)
116:                    throws ParseException {
117:                jj_consume_token(OPEN_BRACKET);
118:                CompoundCondition condition = new CompoundCondition();
119:                context.add(condition);
120:                Condition(condition);
121:                jj_consume_token(CLOSE_BRACKET);
122:            }
123:
124:            final public void BinaryConnective(ConditionContext context)
125:                    throws ParseException {
126:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
127:                case AND:
128:                    And(context);
129:                    break;
130:                case OR:
131:                    Or(context);
132:                    break;
133:                default:
134:                    jj_la1[7] = jj_gen;
135:                    jj_consume_token(-1);
136:                    throw new ParseException();
137:                }
138:            }
139:
140:            final public void Not(ConditionContext context)
141:                    throws ParseException {
142:                jj_consume_token(NOT);
143:                context.negateNext();
144:            }
145:
146:            final public void And(ConditionContext context)
147:                    throws ParseException {
148:                jj_consume_token(AND);
149:                context.add(CompoundCondition.AND);
150:            }
151:
152:            final public void Or(ConditionContext context)
153:                    throws ParseException {
154:                jj_consume_token(OR);
155:                context.add(CompoundCondition.OR);
156:            }
157:
158:            final public void SimpleCondition(ConditionContext context)
159:                    throws ParseException {
160:                SimpleCondition condition = new SimpleCondition();
161:                ColumnTerm(condition);
162:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
163:                case LIKE:
164:                    LikeCondition(condition);
165:                    break;
166:                case EQUALS:
167:                    EqualsCondition(condition);
168:                    break;
169:                case NOT_EQUALS:
170:                    NotEqualsCondition(condition);
171:                    break;
172:                case LESS_THAN_OR_EQUALS:
173:                    LessThanOrEqualsCondition(condition);
174:                    break;
175:                case LESS_THAN:
176:                    LessThanCondition(condition);
177:                    break;
178:                case GREATER_THAN_OR_EQUALS:
179:                    GreaterThanOrEqualsCondition(condition);
180:                    break;
181:                case GREATER_THAN:
182:                    GreaterThanCondition(condition);
183:                    break;
184:                default:
185:                    jj_la1[8] = jj_gen;
186:                    jj_consume_token(-1);
187:                    throw new ParseException();
188:                }
189:                ColumnTerm(condition);
190:                context.add(condition);
191:            }
192:
193:            final public void EqualsCondition(SimpleCondition condition)
194:                    throws ParseException {
195:                jj_consume_token(EQUALS);
196:                condition.setConnective(SimpleCondition.EQUALS);
197:            }
198:
199:            final public void NotEqualsCondition(SimpleCondition condition)
200:                    throws ParseException {
201:                jj_consume_token(NOT_EQUALS);
202:                condition.setConnective(SimpleCondition.NOT_EQUALS);
203:            }
204:
205:            final public void LikeCondition(SimpleCondition condition)
206:                    throws ParseException {
207:                jj_consume_token(LIKE);
208:                condition.setConnective(SimpleCondition.LIKE);
209:            }
210:
211:            final public void LessThanCondition(SimpleCondition condition)
212:                    throws ParseException {
213:                jj_consume_token(LESS_THAN);
214:                condition.setConnective(SimpleCondition.LESS_THAN);
215:            }
216:
217:            final public void LessThanOrEqualsCondition(
218:                    SimpleCondition condition) throws ParseException {
219:                jj_consume_token(LESS_THAN_OR_EQUALS);
220:                condition.setConnective(SimpleCondition.LESS_THAN_OR_EQUALS);
221:            }
222:
223:            final public void GreaterThanCondition(SimpleCondition condition)
224:                    throws ParseException {
225:                jj_consume_token(GREATER_THAN);
226:                condition.setConnective(SimpleCondition.GREATER_THAN);
227:            }
228:
229:            final public void GreaterThanOrEqualsCondition(
230:                    SimpleCondition condition) throws ParseException {
231:                jj_consume_token(GREATER_THAN_OR_EQUALS);
232:                condition.setConnective(SimpleCondition.GREATER_THAN_OR_EQUALS);
233:            }
234:
235:            final public void ColumnTerm(ColumnTermContext context)
236:                    throws ParseException {
237:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
238:                case SUM:
239:                case COUNT:
240:                case AVG:
241:                case MIN:
242:                case MAX:
243:                    ComplexTerm1(context);
244:                    break;
245:                case INTEGER_NUMBER:
246:                case DECIMAL_NUMBER:
247:                case STRING:
248:                    Value(context);
249:                    break;
250:                case HOST_VARIABLE:
251:                    HostVariable(context);
252:                    break;
253:                case NAME:
254:                    ColumnName(context);
255:                    break;
256:                default:
257:                    jj_la1[9] = jj_gen;
258:                    jj_consume_token(-1);
259:                    throw new ParseException();
260:                }
261:            }
262:
263:            final public void HostVariable(ColumnTermContext context)
264:                    throws ParseException {
265:                jj_consume_token(HOST_VARIABLE);
266:                context.add(new HostVariable());
267:            }
268:
269:            final public void Value(ColumnTermContext context)
270:                    throws ParseException {
271:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
272:                case INTEGER_NUMBER:
273:                    IntegerNumberValue(context);
274:                    break;
275:                case DECIMAL_NUMBER:
276:                    DecimalNumberValue(context);
277:                    break;
278:                case STRING:
279:                    StringValue(context);
280:                    break;
281:                default:
282:                    jj_la1[10] = jj_gen;
283:                    jj_consume_token(-1);
284:                    throw new ParseException();
285:                }
286:            }
287:
288:            final public void IntegerNumberValue(ColumnTermContext context)
289:                    throws ParseException {
290:                Token t;
291:                t = jj_consume_token(INTEGER_NUMBER);
292:                Value value = new Value(t.image, java.sql.Types.INTEGER);
293:                context.add(value);
294:            }
295:
296:            final public void DecimalNumberValue(ColumnTermContext context)
297:                    throws ParseException {
298:                Token t;
299:                t = jj_consume_token(DECIMAL_NUMBER);
300:                Value value = new Value(t.image, java.sql.Types.DECIMAL);
301:                context.add(value);
302:            }
303:
304:            final public void StringValue(ColumnTermContext context)
305:                    throws ParseException {
306:                Token t;
307:                t = jj_consume_token(STRING);
308:                String txt = t.image;
309:                txt = txt.substring(1, txt.length() - 1);
310:                Value value = new Value(txt, java.sql.Types.VARCHAR);
311:                context.add(value);
312:            }
313:
314:            final public void ColumnName(ColumnTermContext context)
315:                    throws ParseException {
316:                Token t;
317:                t = jj_consume_token(NAME);
318:                ColumnName colName = new ColumnName(t.image);
319:                context.add(colName);
320:            }
321:
322:            final public void Name() throws ParseException {
323:                jj_consume_token(NAME);
324:            }
325:
326:            final public void ColumnList(SelectStatement select)
327:                    throws ParseException {
328:                select.setSelectClause(new SelectClauseColumnList());
329:                ColumnTerm((SelectClauseColumnList) select.getSelectClause());
330:                label_2: while (true) {
331:                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
332:                    case SEPARATOR:
333:                        ;
334:                        break;
335:                    default:
336:                        jj_la1[11] = jj_gen;
337:                        break label_2;
338:                    }
339:                    jj_consume_token(SEPARATOR);
340:                    ColumnTerm((SelectClauseColumnList) select
341:                            .getSelectClause());
342:                }
343:            }
344:
345:            final public void SelectClause(SelectStatement select)
346:                    throws ParseException {
347:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
348:                case STAR:
349:                    Star(select);
350:                    break;
351:                case HOST_VARIABLE:
352:                case SUM:
353:                case COUNT:
354:                case AVG:
355:                case MIN:
356:                case MAX:
357:                case INTEGER_NUMBER:
358:                case DECIMAL_NUMBER:
359:                case NAME:
360:                case STRING:
361:                    ColumnList(select);
362:                    break;
363:                default:
364:                    jj_la1[12] = jj_gen;
365:                    jj_consume_token(-1);
366:                    throw new ParseException();
367:                }
368:            }
369:
370:            final public void Star(SelectStatement select)
371:                    throws ParseException {
372:                jj_consume_token(STAR);
373:                select.setSelect2Star();
374:            }
375:
376:            final public void Table(SelectStatement select)
377:                    throws ParseException {
378:                Token t;
379:                t = jj_consume_token(NAME);
380:                select.setTableName(t.image);
381:            }
382:
383:            final public void OrderBy(SelectStatement select)
384:                    throws ParseException {
385:                jj_consume_token(ORDER_BY);
386:                OrderByColumnList(select);
387:            }
388:
389:            final public void OrderByColumnList(SelectStatement select)
390:                    throws ParseException {
391:                select.setOrderByClause(new OrderByClause());
392:                OrderByColumn(select.getOrderByClause());
393:                label_3: while (true) {
394:                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
395:                    case SEPARATOR:
396:                        ;
397:                        break;
398:                    default:
399:                        jj_la1[13] = jj_gen;
400:                        break label_3;
401:                    }
402:                    jj_consume_token(SEPARATOR);
403:                    OrderByColumn(select.getOrderByClause());
404:                }
405:            }
406:
407:            final public void OrderByColumn(OrderByClause orderByClause)
408:                    throws ParseException {
409:                Token t;
410:                ColumnTerm(orderByClause);
411:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
412:                case ASC:
413:                case DESC:
414:                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
415:                    case ASC:
416:                        ASC(orderByClause);
417:                        break;
418:                    case DESC:
419:                        DESC(orderByClause);
420:                        break;
421:                    default:
422:                        jj_la1[14] = jj_gen;
423:                        jj_consume_token(-1);
424:                        throw new ParseException();
425:                    }
426:                    break;
427:                default:
428:                    jj_la1[15] = jj_gen;
429:                    ;
430:                }
431:            }
432:
433:            final public void ASC(OrderByClause orderByClause)
434:                    throws ParseException {
435:                jj_consume_token(ASC);
436:                orderByClause.setSortDirection(OrderByClause.ASC);
437:            }
438:
439:            final public void DESC(OrderByClause orderByClause)
440:                    throws ParseException {
441:                jj_consume_token(DESC);
442:                orderByClause.setSortDirection(OrderByClause.DESC);
443:            }
444:
445:            final public void GroupBy(SelectStatement select)
446:                    throws ParseException {
447:                jj_consume_token(GROUP_BY);
448:                GroupByColumnList(select);
449:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
450:                case HAVING:
451:                    Having(select);
452:                    break;
453:                default:
454:                    jj_la1[16] = jj_gen;
455:                    ;
456:                }
457:            }
458:
459:            final public void Having(SelectStatement select)
460:                    throws ParseException {
461:                jj_consume_token(HAVING);
462:                HavingClause having = new HavingClause();
463:                select.setHavingClause(having);
464:                Condition(having);
465:            }
466:
467:            final public void GroupByColumnList(SelectStatement select)
468:                    throws ParseException {
469:                select.setGroupByClause(new GroupByClause());
470:                ColumnTerm(select.getGroupByClause());
471:                label_4: while (true) {
472:                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
473:                    case SEPARATOR:
474:                        ;
475:                        break;
476:                    default:
477:                        jj_la1[17] = jj_gen;
478:                        break label_4;
479:                    }
480:                    jj_consume_token(SEPARATOR);
481:                    ColumnTerm(select.getGroupByClause());
482:                }
483:            }
484:
485:            final public void ComplexTerm1(ColumnTermContext context)
486:                    throws ParseException {
487:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
488:                case AVG:
489:                    AVG(context);
490:                    break;
491:                case SUM:
492:                    SUM(context);
493:                    break;
494:                case MAX:
495:                    MAX(context);
496:                    break;
497:                case MIN:
498:                    MIN(context);
499:                    break;
500:                case COUNT:
501:                    COUNT(context);
502:                    break;
503:                default:
504:                    jj_la1[18] = jj_gen;
505:                    jj_consume_token(-1);
506:                    throw new ParseException();
507:                }
508:            }
509:
510:            final public void AVG(ColumnTermContext context)
511:                    throws ParseException {
512:                jj_consume_token(AVG);
513:                jj_consume_token(OPEN_BRACKET);
514:                ComplexTerm1 ct = new ComplexTerm1();
515:                ct.setFunction(Functions.AVG);
516:                context.add(ct);
517:                ColumnTerm(ct);
518:                jj_consume_token(CLOSE_BRACKET);
519:            }
520:
521:            final public void SUM(ColumnTermContext context)
522:                    throws ParseException {
523:                jj_consume_token(SUM);
524:                jj_consume_token(OPEN_BRACKET);
525:                ComplexTerm1 ct = new ComplexTerm1();
526:                ct.setFunction(Functions.SUM);
527:                context.add(ct);
528:                ColumnTerm(ct);
529:                jj_consume_token(CLOSE_BRACKET);
530:            }
531:
532:            final public void MAX(ColumnTermContext context)
533:                    throws ParseException {
534:                jj_consume_token(MAX);
535:                jj_consume_token(OPEN_BRACKET);
536:                ComplexTerm1 ct = new ComplexTerm1();
537:                ct.setFunction(Functions.MAX);
538:                context.add(ct);
539:                ColumnTerm(ct);
540:                jj_consume_token(CLOSE_BRACKET);
541:            }
542:
543:            final public void MIN(ColumnTermContext context)
544:                    throws ParseException {
545:                jj_consume_token(MIN);
546:                jj_consume_token(OPEN_BRACKET);
547:                ComplexTerm1 ct = new ComplexTerm1();
548:                ct.setFunction(Functions.MIN);
549:                context.add(ct);
550:                ColumnTerm(ct);
551:                jj_consume_token(CLOSE_BRACKET);
552:            }
553:
554:            final public void COUNT(ColumnTermContext context)
555:                    throws ParseException {
556:                jj_consume_token(COUNT);
557:                ComplexTerm1 ct = new ComplexTerm1();
558:                ct.setFunction(Functions.COUNT);
559:                context.add(ct);
560:            }
561:
562:            public SQLTokenManager token_source;
563:            SimpleCharStream jj_input_stream;
564:            public Token token, jj_nt;
565:            private int jj_ntk;
566:            private int jj_gen;
567:            final private int[] jj_la1 = new int[19];
568:            static private int[] jj_la1_0;
569:            static private int[] jj_la1_1;
570:            static {
571:                jj_la1_0();
572:                jj_la1_1();
573:            }
574:
575:            private static void jj_la1_0() {
576:                jj_la1_0 = new int[] { 0x40, 0x2000, 0x8000000, 0x4000000,
577:                        0x1000, 0x82010000, 0xc00, 0xc00, 0x1f80080,
578:                        0x82000000, 0x0, 0x8000, 0x82000100, 0x8000,
579:                        0x60000000, 0x60000000, 0x10000000, 0x8000, 0x80000000, };
580:            }
581:
582:            private static void jj_la1_1() {
583:                jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0,
584:                        0x0, 0xff, 0xb0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0,
585:                        0xf, };
586:            }
587:
588:            public SQL(java.io.InputStream stream) {
589:                jj_input_stream = new SimpleCharStream(stream, 1, 1);
590:                token_source = new SQLTokenManager(jj_input_stream);
591:                token = new Token();
592:                jj_ntk = -1;
593:                jj_gen = 0;
594:                for (int i = 0; i < 19; i++)
595:                    jj_la1[i] = -1;
596:            }
597:
598:            public void ReInit(java.io.InputStream stream) {
599:                jj_input_stream.ReInit(stream, 1, 1);
600:                token_source.ReInit(jj_input_stream);
601:                token = new Token();
602:                jj_ntk = -1;
603:                jj_gen = 0;
604:                for (int i = 0; i < 19; i++)
605:                    jj_la1[i] = -1;
606:            }
607:
608:            public SQL(java.io.Reader stream) {
609:                jj_input_stream = new SimpleCharStream(stream, 1, 1);
610:                token_source = new SQLTokenManager(jj_input_stream);
611:                token = new Token();
612:                jj_ntk = -1;
613:                jj_gen = 0;
614:                for (int i = 0; i < 19; i++)
615:                    jj_la1[i] = -1;
616:            }
617:
618:            public void ReInit(java.io.Reader stream) {
619:                jj_input_stream.ReInit(stream, 1, 1);
620:                token_source.ReInit(jj_input_stream);
621:                token = new Token();
622:                jj_ntk = -1;
623:                jj_gen = 0;
624:                for (int i = 0; i < 19; i++)
625:                    jj_la1[i] = -1;
626:            }
627:
628:            public SQL(SQLTokenManager tm) {
629:                token_source = tm;
630:                token = new Token();
631:                jj_ntk = -1;
632:                jj_gen = 0;
633:                for (int i = 0; i < 19; i++)
634:                    jj_la1[i] = -1;
635:            }
636:
637:            public void ReInit(SQLTokenManager tm) {
638:                token_source = tm;
639:                token = new Token();
640:                jj_ntk = -1;
641:                jj_gen = 0;
642:                for (int i = 0; i < 19; i++)
643:                    jj_la1[i] = -1;
644:            }
645:
646:            final private Token jj_consume_token(int kind)
647:                    throws ParseException {
648:                Token oldToken;
649:                if ((oldToken = token).next != null)
650:                    token = token.next;
651:                else
652:                    token = token.next = token_source.getNextToken();
653:                jj_ntk = -1;
654:                if (token.kind == kind) {
655:                    jj_gen++;
656:                    return token;
657:                }
658:                token = oldToken;
659:                jj_kind = kind;
660:                throw generateParseException();
661:            }
662:
663:            final public Token getNextToken() {
664:                if (token.next != null)
665:                    token = token.next;
666:                else
667:                    token = token.next = token_source.getNextToken();
668:                jj_ntk = -1;
669:                jj_gen++;
670:                return token;
671:            }
672:
673:            final public Token getToken(int index) {
674:                Token t = token;
675:                for (int i = 0; i < index; i++) {
676:                    if (t.next != null)
677:                        t = t.next;
678:                    else
679:                        t = t.next = token_source.getNextToken();
680:                }
681:                return t;
682:            }
683:
684:            final private int jj_ntk() {
685:                if ((jj_nt = token.next) == null)
686:                    return (jj_ntk = (token.next = token_source.getNextToken()).kind);
687:                else
688:                    return (jj_ntk = jj_nt.kind);
689:            }
690:
691:            private java.util.Vector jj_expentries = new java.util.Vector();
692:            private int[] jj_expentry;
693:            private int jj_kind = -1;
694:
695:            public ParseException generateParseException() {
696:                jj_expentries.removeAllElements();
697:                boolean[] la1tokens = new boolean[40];
698:                for (int i = 0; i < 40; i++) {
699:                    la1tokens[i] = false;
700:                }
701:                if (jj_kind >= 0) {
702:                    la1tokens[jj_kind] = true;
703:                    jj_kind = -1;
704:                }
705:                for (int i = 0; i < 19; i++) {
706:                    if (jj_la1[i] == jj_gen) {
707:                        for (int j = 0; j < 32; j++) {
708:                            if ((jj_la1_0[i] & (1 << j)) != 0) {
709:                                la1tokens[j] = true;
710:                            }
711:                            if ((jj_la1_1[i] & (1 << j)) != 0) {
712:                                la1tokens[32 + j] = true;
713:                            }
714:                        }
715:                    }
716:                }
717:                for (int i = 0; i < 40; i++) {
718:                    if (la1tokens[i]) {
719:                        jj_expentry = new int[1];
720:                        jj_expentry[0] = i;
721:                        jj_expentries.addElement(jj_expentry);
722:                    }
723:                }
724:                int[][] exptokseq = new int[jj_expentries.size()][];
725:                for (int i = 0; i < jj_expentries.size(); i++) {
726:                    exptokseq[i] = (int[]) jj_expentries.elementAt(i);
727:                }
728:                return new ParseException(token, exptokseq, tokenImage);
729:            }
730:
731:            final public void enable_tracing() {
732:            }
733:
734:            final public void disable_tracing() {
735:            }
736:
737:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.