001: /* Generated By:JavaCC: Do not edit this line. FormSpecParser.java */
002: package com.jeta.forms.gui.common.parsers;
003:
004: public class FormSpecParser implements FormSpecParserConstants {
005: public String m_alignment;
006: public String m_size_type;
007: public String m_constant_size = "10.0";
008: public String m_constant_units = "PX";
009: public String m_component_size;
010: public String m_bounded_size;
011: public String m_resize;
012: public String m_resize_weight = "1.0";
013:
014: /**
015: * Invoke parse to start the parse operation
016: */
017: final public void parse() throws ParseException {
018: Token x = null;
019: alignment();
020: jj_consume_token(COLON);
021: size();
022: jj_consume_token(COLON);
023: resize();
024: }
025:
026: final public void alignment() throws ParseException {
027: Token x = null;
028: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
029: case 13:
030: case 14:
031: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
032: case 13:
033: jj_consume_token(13);
034: break;
035: case 14:
036: jj_consume_token(14);
037: break;
038: default:
039: jj_la1[0] = jj_gen;
040: jj_consume_token(-1);
041: throw new ParseException();
042: }
043: m_alignment = "LEFT";
044: break;
045: case 15:
046: case 16:
047: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
048: case 15:
049: jj_consume_token(15);
050: break;
051: case 16:
052: jj_consume_token(16);
053: break;
054: default:
055: jj_la1[1] = jj_gen;
056: jj_consume_token(-1);
057: throw new ParseException();
058: }
059: m_alignment = "CENTER";
060: break;
061: case 17:
062: case 18:
063: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
064: case 17:
065: jj_consume_token(17);
066: break;
067: case 18:
068: jj_consume_token(18);
069: break;
070: default:
071: jj_la1[2] = jj_gen;
072: jj_consume_token(-1);
073: throw new ParseException();
074: }
075: m_alignment = "RIGHT";
076: break;
077: case 19:
078: case 20:
079: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
080: case 19:
081: jj_consume_token(19);
082: break;
083: case 20:
084: jj_consume_token(20);
085: break;
086: default:
087: jj_la1[3] = jj_gen;
088: jj_consume_token(-1);
089: throw new ParseException();
090: }
091: m_alignment = "FILL";
092: break;
093: case 21:
094: case 22:
095: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
096: case 21:
097: jj_consume_token(21);
098: break;
099: case 22:
100: jj_consume_token(22);
101: break;
102: default:
103: jj_la1[4] = jj_gen;
104: jj_consume_token(-1);
105: throw new ParseException();
106: }
107: m_alignment = "TOP";
108: break;
109: case 23:
110: case 24:
111: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
112: case 23:
113: jj_consume_token(23);
114: break;
115: case 24:
116: jj_consume_token(24);
117: break;
118: default:
119: jj_la1[5] = jj_gen;
120: jj_consume_token(-1);
121: throw new ParseException();
122: }
123: m_alignment = "BOTTOM";
124: break;
125: default:
126: jj_la1[6] = jj_gen;
127: jj_consume_token(-1);
128: throw new ParseException();
129: }
130: }
131:
132: final public String units() throws ParseException {
133: Token x = null;
134: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
135: case 25:
136: jj_consume_token(25);
137: {
138: if (true)
139: return "PX";
140: }
141: break;
142: case 26:
143: jj_consume_token(26);
144: {
145: if (true)
146: return "PT";
147: }
148: break;
149: case 27:
150: jj_consume_token(27);
151: {
152: if (true)
153: return "DLU";
154: }
155: break;
156: case 28:
157: jj_consume_token(28);
158: {
159: if (true)
160: return "DLU";
161: }
162: break;
163: case 29:
164: jj_consume_token(29);
165: {
166: if (true)
167: return "DLU";
168: }
169: break;
170: case 30:
171: jj_consume_token(30);
172: {
173: if (true)
174: return "IN";
175: }
176: break;
177: case 31:
178: jj_consume_token(31);
179: {
180: if (true)
181: return "MM";
182: }
183: break;
184: case 32:
185: jj_consume_token(32);
186: {
187: if (true)
188: return "CM";
189: }
190: break;
191: default:
192: jj_la1[7] = jj_gen;
193: jj_consume_token(-1);
194: throw new ParseException();
195: }
196: throw new Error("Missing return statement in function");
197: }
198:
199: final public void size() throws ParseException {
200: Token x = null;
201: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
202: case INTEGER_LITERAL:
203: case FLOATING_POINT_LITERAL:
204: constantSize();
205: m_size_type = "CONSTANT";
206: break;
207: case 33:
208: case 34:
209: case 35:
210: case 36:
211: case 37:
212: case 38:
213: componentSize();
214: m_size_type = "COMPONENT";
215: break;
216: case 39:
217: case 40:
218: boundedSize();
219: m_size_type = "BOUNDED";
220: break;
221: default:
222: jj_la1[8] = jj_gen;
223: jj_consume_token(-1);
224: throw new ParseException();
225: }
226: }
227:
228: final public void constantSize() throws ParseException {
229: Token x = null;
230: String size = "";
231: String units = "";
232: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
233: case INTEGER_LITERAL:
234: x = jj_consume_token(INTEGER_LITERAL);
235: break;
236: case FLOATING_POINT_LITERAL:
237: x = jj_consume_token(FLOATING_POINT_LITERAL);
238: break;
239: default:
240: jj_la1[9] = jj_gen;
241: jj_consume_token(-1);
242: throw new ParseException();
243: }
244: size = x.image;
245: units = units();
246: m_constant_size = size;
247: m_constant_units = units;
248: }
249:
250: final public void componentSize() throws ParseException {
251: Token x = null;
252: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
253: case 33:
254: case 34:
255: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
256: case 33:
257: jj_consume_token(33);
258: break;
259: case 34:
260: jj_consume_token(34);
261: break;
262: default:
263: jj_la1[10] = jj_gen;
264: jj_consume_token(-1);
265: throw new ParseException();
266: }
267: m_component_size = "MIN";
268: break;
269: case 35:
270: case 36:
271: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
272: case 35:
273: jj_consume_token(35);
274: break;
275: case 36:
276: jj_consume_token(36);
277: break;
278: default:
279: jj_la1[11] = jj_gen;
280: jj_consume_token(-1);
281: throw new ParseException();
282: }
283: m_component_size = "PREF";
284: break;
285: case 37:
286: case 38:
287: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
288: case 37:
289: jj_consume_token(37);
290: break;
291: case 38:
292: jj_consume_token(38);
293: break;
294: default:
295: jj_la1[12] = jj_gen;
296: jj_consume_token(-1);
297: throw new ParseException();
298: }
299: m_component_size = "DEFAULT";
300: break;
301: default:
302: jj_la1[13] = jj_gen;
303: jj_consume_token(-1);
304: throw new ParseException();
305: }
306: }
307:
308: final public void boundedSize() throws ParseException {
309: Token x = null;
310: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
311: case 39:
312: jj_consume_token(39);
313: m_bounded_size = "MIN";
314: break;
315: case 40:
316: jj_consume_token(40);
317: m_bounded_size = "MAX";
318: break;
319: default:
320: jj_la1[14] = jj_gen;
321: jj_consume_token(-1);
322: throw new ParseException();
323: }
324: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
325: case INTEGER_LITERAL:
326: case FLOATING_POINT_LITERAL:
327: constantSize();
328: jj_consume_token(SEMICOLON);
329: componentSize();
330: break;
331: case 33:
332: case 34:
333: case 35:
334: case 36:
335: case 37:
336: case 38:
337: componentSize();
338: jj_consume_token(SEMICOLON);
339: constantSize();
340: break;
341: default:
342: jj_la1[15] = jj_gen;
343: jj_consume_token(-1);
344: throw new ParseException();
345: }
346: jj_consume_token(41);
347: }
348:
349: final public void resize() throws ParseException {
350: Token x = null;
351: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
352: case 42:
353: case 43:
354: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
355: case 42:
356: jj_consume_token(42);
357: break;
358: case 43:
359: jj_consume_token(43);
360: break;
361: default:
362: jj_la1[16] = jj_gen;
363: jj_consume_token(-1);
364: throw new ParseException();
365: }
366: m_resize = "NONE";
367: break;
368: case 44:
369: case 45:
370: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
371: case 44:
372: jj_consume_token(44);
373: break;
374: case 45:
375: jj_consume_token(45);
376: break;
377: default:
378: jj_la1[17] = jj_gen;
379: jj_consume_token(-1);
380: throw new ParseException();
381: }
382: m_resize = "GROW";
383: label_1: while (true) {
384: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
385: case 46:
386: ;
387: break;
388: default:
389: jj_la1[18] = jj_gen;
390: break label_1;
391: }
392: jj_consume_token(46);
393: x = jj_consume_token(FLOATING_POINT_LITERAL);
394: m_resize_weight = x.image;
395: jj_consume_token(41);
396: }
397: break;
398: default:
399: jj_la1[19] = jj_gen;
400: jj_consume_token(-1);
401: throw new ParseException();
402: }
403: }
404:
405: public FormSpecParserTokenManager token_source;
406: SimpleCharStream jj_input_stream;
407: public Token token, jj_nt;
408: private int jj_ntk;
409: private int jj_gen;
410: final private int[] jj_la1 = new int[20];
411: static private int[] jj_la1_0;
412: static private int[] jj_la1_1;
413: static {
414: jj_la1_0();
415: jj_la1_1();
416: }
417:
418: private static void jj_la1_0() {
419: jj_la1_0 = new int[] { 0x6000, 0x18000, 0x60000, 0x180000,
420: 0x600000, 0x1800000, 0x1ffe000, 0xfe000000, 0x60, 0x60,
421: 0x0, 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0x0, 0x0, 0x0, };
422: }
423:
424: private static void jj_la1_1() {
425: jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
426: 0x1fe, 0x0, 0x6, 0x18, 0x60, 0x7e, 0x180, 0x7e, 0xc00,
427: 0x3000, 0x4000, 0x3c00, };
428: }
429:
430: public FormSpecParser(java.io.InputStream stream) {
431: jj_input_stream = new SimpleCharStream(stream, 1, 1);
432: token_source = new FormSpecParserTokenManager(jj_input_stream);
433: token = new Token();
434: jj_ntk = -1;
435: jj_gen = 0;
436: for (int i = 0; i < 20; i++)
437: jj_la1[i] = -1;
438: }
439:
440: public void ReInit(java.io.InputStream stream) {
441: jj_input_stream.ReInit(stream, 1, 1);
442: token_source.ReInit(jj_input_stream);
443: token = new Token();
444: jj_ntk = -1;
445: jj_gen = 0;
446: for (int i = 0; i < 20; i++)
447: jj_la1[i] = -1;
448: }
449:
450: public FormSpecParser(java.io.Reader stream) {
451: jj_input_stream = new SimpleCharStream(stream, 1, 1);
452: token_source = new FormSpecParserTokenManager(jj_input_stream);
453: token = new Token();
454: jj_ntk = -1;
455: jj_gen = 0;
456: for (int i = 0; i < 20; i++)
457: jj_la1[i] = -1;
458: }
459:
460: public void ReInit(java.io.Reader stream) {
461: jj_input_stream.ReInit(stream, 1, 1);
462: token_source.ReInit(jj_input_stream);
463: token = new Token();
464: jj_ntk = -1;
465: jj_gen = 0;
466: for (int i = 0; i < 20; i++)
467: jj_la1[i] = -1;
468: }
469:
470: public FormSpecParser(FormSpecParserTokenManager tm) {
471: token_source = tm;
472: token = new Token();
473: jj_ntk = -1;
474: jj_gen = 0;
475: for (int i = 0; i < 20; i++)
476: jj_la1[i] = -1;
477: }
478:
479: public void ReInit(FormSpecParserTokenManager tm) {
480: token_source = tm;
481: token = new Token();
482: jj_ntk = -1;
483: jj_gen = 0;
484: for (int i = 0; i < 20; i++)
485: jj_la1[i] = -1;
486: }
487:
488: final private Token jj_consume_token(int kind)
489: throws ParseException {
490: Token oldToken;
491: if ((oldToken = token).next != null)
492: token = token.next;
493: else
494: token = token.next = token_source.getNextToken();
495: jj_ntk = -1;
496: if (token.kind == kind) {
497: jj_gen++;
498: return token;
499: }
500: token = oldToken;
501: jj_kind = kind;
502: throw generateParseException();
503: }
504:
505: final public Token getNextToken() {
506: if (token.next != null)
507: token = token.next;
508: else
509: token = token.next = token_source.getNextToken();
510: jj_ntk = -1;
511: jj_gen++;
512: return token;
513: }
514:
515: final public Token getToken(int index) {
516: Token t = token;
517: for (int i = 0; i < index; i++) {
518: if (t.next != null)
519: t = t.next;
520: else
521: t = t.next = token_source.getNextToken();
522: }
523: return t;
524: }
525:
526: final private int jj_ntk() {
527: if ((jj_nt = token.next) == null)
528: return (jj_ntk = (token.next = token_source.getNextToken()).kind);
529: else
530: return (jj_ntk = jj_nt.kind);
531: }
532:
533: private java.util.Vector jj_expentries = new java.util.Vector();
534: private int[] jj_expentry;
535: private int jj_kind = -1;
536:
537: public ParseException generateParseException() {
538: jj_expentries.removeAllElements();
539: boolean[] la1tokens = new boolean[47];
540: for (int i = 0; i < 47; i++) {
541: la1tokens[i] = false;
542: }
543: if (jj_kind >= 0) {
544: la1tokens[jj_kind] = true;
545: jj_kind = -1;
546: }
547: for (int i = 0; i < 20; i++) {
548: if (jj_la1[i] == jj_gen) {
549: for (int j = 0; j < 32; j++) {
550: if ((jj_la1_0[i] & (1 << j)) != 0) {
551: la1tokens[j] = true;
552: }
553: if ((jj_la1_1[i] & (1 << j)) != 0) {
554: la1tokens[32 + j] = true;
555: }
556: }
557: }
558: }
559: for (int i = 0; i < 47; i++) {
560: if (la1tokens[i]) {
561: jj_expentry = new int[1];
562: jj_expentry[0] = i;
563: jj_expentries.addElement(jj_expentry);
564: }
565: }
566: int[][] exptokseq = new int[jj_expentries.size()][];
567: for (int i = 0; i < jj_expentries.size(); i++) {
568: exptokseq[i] = (int[]) jj_expentries.elementAt(i);
569: }
570: return new ParseException(token, exptokseq, tokenImage);
571: }
572:
573: final public void enable_tracing() {
574: }
575:
576: final public void disable_tracing() {
577: }
578:
579: }
|