KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejen > util > arl > ArlParser


1 /* Generated By:JJTree&JavaCC: Do not edit this line. ArlParser.java */
2 package org.ejen.util.arl;
3
4 public class ArlParser/* @bgen(jjtree)*/implements ArlParserTreeConstants, ArlParserConstants {/* @bgen(jjtree)*/
5     protected static JJTArlParserState jjtree = new JJTArlParserState();
6     static final public SimpleNode ArlSequence() throws ParseException {
7
8         /* @bgen(jjtree) ArlSequence */
9         SimpleNode jjtn000 = new SimpleNode(JJTARLSEQUENCE);
10         boolean jjtc000 = true;
11
12         jjtree.openNodeScope(jjtn000);
13         try {
14             switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
15             case ACCEPT:
16             case REMOVE:
17             case CROSS:
18             case INTEGER:
19             case 11:
20                 ArlExp();
21                 label_1:
22                 while (true) {
23                     switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
24                     case 10:
25                         ;
26                         break;
27
28                     default:
29                         jj_la1[0] = jj_gen;
30                         break label_1;
31                     }
32                     jj_consume_token(10);
33                     ArlExp();
34                 }
35                 break;
36
37             default:
38                 jj_la1[1] = jj_gen;
39                 ;
40             }
41             jj_consume_token(0);
42             jjtree.closeNodeScope(jjtn000, true);
43             jjtc000 = false; {
44                 if (true) {
45                     return jjtn000;
46                 }
47             }
48         } catch (Throwable JavaDoc jjte000) {
49             if (jjtc000) {
50                 jjtree.clearNodeScope(jjtn000);
51                 jjtc000 = false;
52             } else {
53                 jjtree.popNode();
54             }
55             if (jjte000 instanceof RuntimeException JavaDoc) { {
56                     if (true) {
57                         throw (RuntimeException JavaDoc) jjte000;
58                     }
59                 }
60             }
61             if (jjte000 instanceof ParseException) { {
62                     if (true) {
63                         throw (ParseException) jjte000;
64                     }
65                 }
66             } {
67                 if (true) {
68                     throw (Error JavaDoc) jjte000;
69                 }
70             }
71         }
72         finally {
73             if (jjtc000) {
74                 jjtree.closeNodeScope(jjtn000, true);
75             }
76         }
77         throw new Error JavaDoc("Missing return statement in function");
78     }
79
80     static final public void ArlExp() throws ParseException {
81
82         /* @bgen(jjtree) ArlExp */
83         SimpleNode jjtn000 = new SimpleNode(JJTARLEXP);
84         boolean jjtc000 = true;
85
86         jjtree.openNodeScope(jjtn000);
87         try {
88             switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
89             case ACCEPT:
90             case REMOVE:
91             case CROSS:
92                 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
93                 case ACCEPT:
94                     jj_consume_token(ACCEPT);
95                     break;
96
97                 case REMOVE:
98                     jj_consume_token(REMOVE);
99                     break;
100
101                 case CROSS:
102                     jj_consume_token(CROSS);
103                     break;
104
105                 default:
106                     jj_la1[2] = jj_gen;
107                     jj_consume_token(-1);
108                     throw new ParseException();
109                 }
110                 break;
111
112             default:
113                 jj_la1[3] = jj_gen;
114                 ;
115             }
116             switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
117             case INTEGER:
118                 jj_consume_token(INTEGER);
119                 break;
120
121             case 11:
122                 Interval();
123                 break;
124
125             default:
126                 jj_la1[4] = jj_gen;
127                 jj_consume_token(-1);
128                 throw new ParseException();
129             }
130         } catch (Throwable JavaDoc jjte000) {
131             if (jjtc000) {
132                 jjtree.clearNodeScope(jjtn000);
133                 jjtc000 = false;
134             } else {
135                 jjtree.popNode();
136             }
137             if (jjte000 instanceof RuntimeException JavaDoc) { {
138                     if (true) {
139                         throw (RuntimeException JavaDoc) jjte000;
140                     }
141                 }
142             }
143             if (jjte000 instanceof ParseException) { {
144                     if (true) {
145                         throw (ParseException) jjte000;
146                     }
147                 }
148             } {
149                 if (true) {
150                     throw (Error JavaDoc) jjte000;
151                 }
152             }
153         }
154         finally {
155             if (jjtc000) {
156                 jjtree.closeNodeScope(jjtn000, true);
157             }
158         }
159     }
160
161     static final public void Interval() throws ParseException {
162
163         /* @bgen(jjtree) Interval */
164         SimpleNode jjtn000 = new SimpleNode(JJTINTERVAL);
165         boolean jjtc000 = true;
166
167         jjtree.openNodeScope(jjtn000);
168         try {
169             jj_consume_token(11);
170             jj_consume_token(INTEGER);
171             jj_consume_token(12);
172             jj_consume_token(INTEGER);
173             jj_consume_token(13);
174         }
175         finally {
176             if (jjtc000) {
177                 jjtree.closeNodeScope(jjtn000, true);
178             }
179         }
180     }
181     static private boolean jj_initialized_once = false;
182     static public ArlParserTokenManager token_source;
183     static SimpleCharStream jj_input_stream;
184     static public Token token, jj_nt;
185     static private int jj_ntk;
186     static private int jj_gen;
187     static final private int[] jj_la1 = new int[5];
188     static final private int[] jj_la1_0 = {0x400, 0xbc0, 0x1c0, 0x1c0, 0xa00, };
189     public ArlParser(java.io.InputStream JavaDoc stream) {
190         if (jj_initialized_once) {
191             System.out.println("ERROR: Second call to constructor of static parser. You must");
192             System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
193             System.out.println(" during parser generation.");
194             throw new Error JavaDoc();
195         }
196         jj_initialized_once = true;
197         jj_input_stream = new SimpleCharStream(stream, 1, 1);
198         token_source = new ArlParserTokenManager(jj_input_stream);
199         token = new Token();
200         jj_ntk = -1;
201         jj_gen = 0;
202         for (int i = 0; i < 5; i++) {
203             jj_la1[i] = -1;
204         }
205     }
206
207     static public void ReInit(java.io.InputStream JavaDoc stream) {
208         jj_input_stream.ReInit(stream, 1, 1);
209         token_source.ReInit(jj_input_stream);
210         token = new Token();
211         jj_ntk = -1;
212         jjtree.reset();
213         jj_gen = 0;
214         for (int i = 0; i < 5; i++) {
215             jj_la1[i] = -1;
216         }
217     }
218
219     public ArlParser(java.io.Reader JavaDoc stream) {
220         if (jj_initialized_once) {
221             System.out.println("ERROR: Second call to constructor of static parser. You must");
222             System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
223             System.out.println(" during parser generation.");
224             throw new Error JavaDoc();
225         }
226         jj_initialized_once = true;
227         jj_input_stream = new SimpleCharStream(stream, 1, 1);
228         token_source = new ArlParserTokenManager(jj_input_stream);
229         token = new Token();
230         jj_ntk = -1;
231         jj_gen = 0;
232         for (int i = 0; i < 5; i++) {
233             jj_la1[i] = -1;
234         }
235     }
236
237     static public void ReInit(java.io.Reader JavaDoc stream) {
238         jj_input_stream.ReInit(stream, 1, 1);
239         token_source.ReInit(jj_input_stream);
240         token = new Token();
241         jj_ntk = -1;
242         jjtree.reset();
243         jj_gen = 0;
244         for (int i = 0; i < 5; i++) {
245             jj_la1[i] = -1;
246         }
247     }
248
249     public ArlParser(ArlParserTokenManager tm) {
250         if (jj_initialized_once) {
251             System.out.println("ERROR: Second call to constructor of static parser. You must");
252             System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
253             System.out.println(" during parser generation.");
254             throw new Error JavaDoc();
255         }
256         jj_initialized_once = true;
257         token_source = tm;
258         token = new Token();
259         jj_ntk = -1;
260         jj_gen = 0;
261         for (int i = 0; i < 5; i++) {
262             jj_la1[i] = -1;
263         }
264     }
265
266     public void ReInit(ArlParserTokenManager tm) {
267         token_source = tm;
268         token = new Token();
269         jj_ntk = -1;
270         jjtree.reset();
271         jj_gen = 0;
272         for (int i = 0; i < 5; i++) {
273             jj_la1[i] = -1;
274         }
275     }
276
277     static final private Token jj_consume_token(int kind) throws ParseException {
278         Token oldToken;
279
280         if ((oldToken = token).next != null) {
281             token = token.next;
282         } else {
283             token = token.next = token_source.getNextToken();
284         }
285         jj_ntk = -1;
286         if (token.kind == kind) {
287             jj_gen++;
288             return token;
289         }
290         token = oldToken;
291         jj_kind = kind;
292         throw generateParseException();
293     }
294
295     static final public Token getNextToken() {
296         if (token.next != null) {
297             token = token.next;
298         } else {
299             token = token.next = token_source.getNextToken();
300         }
301         jj_ntk = -1;
302         jj_gen++;
303         return token;
304     }
305
306     static final public Token getToken(int index) {
307         Token t = token;
308
309         for (int i = 0; i < index; i++) {
310             if (t.next != null) {
311                 t = t.next;
312             } else {
313                 t = t.next = token_source.getNextToken();
314             }
315         }
316         return t;
317     }
318
319     static final private int jj_ntk() {
320         if ((jj_nt = token.next) == null) {
321             return (jj_ntk = (token.next = token_source.getNextToken()).kind);
322         } else {
323             return (jj_ntk = jj_nt.kind);
324         }
325     }
326     static private java.util.Vector JavaDoc jj_expentries = new java.util.Vector JavaDoc();
327     static private int[] jj_expentry;
328     static private int jj_kind = -1;
329     static final public ParseException generateParseException() {
330         jj_expentries.removeAllElements();
331         boolean[] la1tokens = new boolean[14];
332
333         for (int i = 0; i < 14; i++) {
334             la1tokens[i] = false;
335         }
336         if (jj_kind >= 0) {
337             la1tokens[jj_kind] = true;
338             jj_kind = -1;
339         }
340         for (int i = 0; i < 5; i++) {
341             if (jj_la1[i] == jj_gen) {
342                 for (int j = 0; j < 32; j++) {
343                     if ((jj_la1_0[i] & (1 << j)) != 0) {
344                         la1tokens[j] = true;
345                     }
346                 }
347             }
348         }
349         for (int i = 0; i < 14; i++) {
350             if (la1tokens[i]) {
351                 jj_expentry = new int[1];
352                 jj_expentry[0] = i;
353                 jj_expentries.addElement(jj_expentry);
354             }
355         }
356         int[][] exptokseq = new int[jj_expentries.size()][];
357
358         for (int i = 0; i < jj_expentries.size(); i++) {
359             exptokseq[i] = (int[]) jj_expentries.elementAt(i);
360         }
361         return new ParseException(token, exptokseq, tokenImage);
362     }
363
364     static final public void enable_tracing() {}
365
366     static final public void disable_tracing() {}
367 }
368
Popular Tags