1
2
3 package org.apache.commons.flatfile.dsl;
4
5 import java.io.IOException;
6 import java.util.Map;
7
8 import org.apache.commons.flatfile.*;
9
10 import java.io.InputStream;
11 import antlr.TokenStreamException;
12 import antlr.TokenStreamIOException;
13 import antlr.TokenStreamRecognitionException;
14 import antlr.CharStreamException;
15 import antlr.CharStreamIOException;
16 import antlr.ANTLRException;
17 import java.io.Reader;
18 import java.util.Hashtable;
19 import antlr.CharScanner;
20 import antlr.InputBuffer;
21 import antlr.ByteBuffer;
22 import antlr.CharBuffer;
23 import antlr.Token;
24 import antlr.CommonToken;
25 import antlr.RecognitionException;
26 import antlr.NoViableAltForCharException;
27 import antlr.MismatchedCharException;
28 import antlr.TokenStream;
29 import antlr.ANTLRHashString;
30 import antlr.LexerSharedInputState;
31 import antlr.collections.impl.BitSet;
32 import antlr.SemanticException;
33
34 public class EntityLexer extends antlr.CharScanner implements EntityTokenTypes, TokenStream
35 {
36 public EntityLexer(InputStream in) {
37 this(new ByteBuffer(in));
38 }
39 public EntityLexer(Reader in) {
40 this(new CharBuffer(in));
41 }
42 public EntityLexer(InputBuffer ib) {
43 this(new LexerSharedInputState(ib));
44 }
45 public EntityLexer(LexerSharedInputState state) {
46 super(state);
47 caseSensitiveLiterals = true;
48 setCaseSensitive(true);
49 literals = new Hashtable();
50 }
51
52 public Token nextToken() throws TokenStreamException {
53 Token theRetToken=null;
54 tryAgain:
55 for (;;) {
56 Token _token = null;
57 int _ttype = Token.INVALID_TYPE;
58 resetText();
59 try {
60 try {
61 switch ( LA(1)) {
62 case ';':
63 {
64 mSEMI(true);
65 theRetToken=_returnToken;
66 break;
67 }
68 case ',':
69 {
70 mCOMMA(true);
71 theRetToken=_returnToken;
72 break;
73 }
74 case '(':
75 {
76 mLPAREN(true);
77 theRetToken=_returnToken;
78 break;
79 }
80 case ')':
81 {
82 mRPAREN(true);
83 theRetToken=_returnToken;
84 break;
85 }
86 case '{':
87 {
88 mLCURLY(true);
89 theRetToken=_returnToken;
90 break;
91 }
92 case '}':
93 {
94 mRCURLY(true);
95 theRetToken=_returnToken;
96 break;
97 }
98 case '[':
99 {
100 mLBRACK(true);
101 theRetToken=_returnToken;
102 break;
103 }
104 case ']':
105 {
106 mRBRACK(true);
107 theRetToken=_returnToken;
108 break;
109 }
110 case '*':
111 {
112 mSTAR(true);
113 theRetToken=_returnToken;
114 break;
115 }
116 case '?':
117 {
118 mANON(true);
119 theRetToken=_returnToken;
120 break;
121 }
122 case ':':
123 {
124 mCOLON(true);
125 theRetToken=_returnToken;
126 break;
127 }
128 case '!':
129 {
130 mBANG(true);
131 theRetToken=_returnToken;
132 break;
133 }
134 case '=':
135 {
136 mASSIGN(true);
137 theRetToken=_returnToken;
138 break;
139 }
140 case '.':
141 {
142 mRANGE(true);
143 theRetToken=_returnToken;
144 break;
145 }
146 case '\t': case '\n': case '\u000c': case '\r':
147 case ' ':
148 {
149 mWS(true);
150 theRetToken=_returnToken;
151 break;
152 }
153 case 'A': case 'B': case 'C': case 'D':
154 case 'E': case 'F': case 'G': case 'H':
155 case 'I': case 'J': case 'K': case 'L':
156 case 'M': case 'N': case 'O': case 'P':
157 case 'Q': case 'R': case 'S': case 'T':
158 case 'U': case 'V': case 'W': case 'X':
159 case 'Y': case 'Z': case 'a': case 'b':
160 case 'c': case 'd': case 'e': case 'f':
161 case 'g': case 'h': case 'i': case 'j':
162 case 'k': case 'l': case 'm': case 'n':
163 case 'o': case 'p': case 'q': case 'r':
164 case 's': case 't': case 'u': case 'v':
165 case 'w': case 'x': case 'y': case 'z':
166 {
167 mIDENT(true);
168 theRetToken=_returnToken;
169 break;
170 }
171 case '$':
172 {
173 mTYPEREF(true);
174 theRetToken=_returnToken;
175 break;
176 }
177 case '@':
178 {
179 mOPTION_BLOCK(true);
180 theRetToken=_returnToken;
181 break;
182 }
183 case '0': case '1': case '2': case '3':
184 case '4': case '5': case '6': case '7':
185 case '8': case '9':
186 {
187 mNUMBER(true);
188 theRetToken=_returnToken;
189 break;
190 }
191 case '\'':
192 {
193 mCHAR_LITERAL(true);
194 theRetToken=_returnToken;
195 break;
196 }
197 case '"':
198 {
199 mSTRING_LITERAL(true);
200 theRetToken=_returnToken;
201 break;
202 }
203 default:
204 if ((LA(1)=='/') && (LA(2)=='/')) {
205 mSL_COMMENT(true);
206 theRetToken=_returnToken;
207 }
208 else if ((LA(1)=='/') && (LA(2)=='*')) {
209 mML_COMMENT(true);
210 theRetToken=_returnToken;
211 }
212 else {
213 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
214 else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
215 }
216 }
217 if ( _returnToken==null ) continue tryAgain;
218 _ttype = _returnToken.getType();
219 _ttype = testLiteralsTable(_ttype);
220 _returnToken.setType(_ttype);
221 return _returnToken;
222 }
223 catch (RecognitionException e) {
224 throw new TokenStreamRecognitionException(e);
225 }
226 }
227 catch (CharStreamException cse) {
228 if ( cse instanceof CharStreamIOException ) {
229 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
230 }
231 else {
232 throw new TokenStreamException(cse.getMessage());
233 }
234 }
235 }
236 }
237
238 public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
239 int _ttype; Token _token=null; int _begin=text.length();
240 _ttype = SEMI;
241 int _saveIndex;
242
243 match(';');
244 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
245 _token = makeToken(_ttype);
246 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
247 }
248 _returnToken = _token;
249 }
250
251 public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
252 int _ttype; Token _token=null; int _begin=text.length();
253 _ttype = COMMA;
254 int _saveIndex;
255
256 match(',');
257 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
258 _token = makeToken(_ttype);
259 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
260 }
261 _returnToken = _token;
262 }
263
264 public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
265 int _ttype; Token _token=null; int _begin=text.length();
266 _ttype = LPAREN;
267 int _saveIndex;
268
269 match('(');
270 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
271 _token = makeToken(_ttype);
272 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
273 }
274 _returnToken = _token;
275 }
276
277 public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
278 int _ttype; Token _token=null; int _begin=text.length();
279 _ttype = RPAREN;
280 int _saveIndex;
281
282 match(')');
283 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
284 _token = makeToken(_ttype);
285 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
286 }
287 _returnToken = _token;
288 }
289
290 public final void mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
291 int _ttype; Token _token=null; int _begin=text.length();
292 _ttype = LCURLY;
293 int _saveIndex;
294
295 match('{');
296 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
297 _token = makeToken(_ttype);
298 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
299 }
300 _returnToken = _token;
301 }
302
303 public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
304 int _ttype; Token _token=null; int _begin=text.length();
305 _ttype = RCURLY;
306 int _saveIndex;
307
308 match('}');
309 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
310 _token = makeToken(_ttype);
311 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
312 }
313 _returnToken = _token;
314 }
315
316 public final void mLBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
317 int _ttype; Token _token=null; int _begin=text.length();
318 _ttype = LBRACK;
319 int _saveIndex;
320
321 match('[');
322 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
323 _token = makeToken(_ttype);
324 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
325 }
326 _returnToken = _token;
327 }
328
329 public final void mRBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
330 int _ttype; Token _token=null; int _begin=text.length();
331 _ttype = RBRACK;
332 int _saveIndex;
333
334 match(']');
335 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
336 _token = makeToken(_ttype);
337 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
338 }
339 _returnToken = _token;
340 }
341
342 public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
343 int _ttype; Token _token=null; int _begin=text.length();
344 _ttype = STAR;
345 int _saveIndex;
346
347 match('*');
348 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
349 _token = makeToken(_ttype);
350 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
351 }
352 _returnToken = _token;
353 }
354
355 public final void mANON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
356 int _ttype; Token _token=null; int _begin=text.length();
357 _ttype = ANON;
358 int _saveIndex;
359
360 match('?');
361 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
362 _token = makeToken(_ttype);
363 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
364 }
365 _returnToken = _token;
366 }
367
368 public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
369 int _ttype; Token _token=null; int _begin=text.length();
370 _ttype = COLON;
371 int _saveIndex;
372
373 match(':');
374 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
375 _token = makeToken(_ttype);
376 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
377 }
378 _returnToken = _token;
379 }
380
381 public final void mBANG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
382 int _ttype; Token _token=null; int _begin=text.length();
383 _ttype = BANG;
384 int _saveIndex;
385
386 match('!');
387 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
388 _token = makeToken(_ttype);
389 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
390 }
391 _returnToken = _token;
392 }
393
394 public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
395 int _ttype; Token _token=null; int _begin=text.length();
396 _ttype = ASSIGN;
397 int _saveIndex;
398
399 match('=');
400 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
401 _token = makeToken(_ttype);
402 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
403 }
404 _returnToken = _token;
405 }
406
407 public final void mRANGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
408 int _ttype; Token _token=null; int _begin=text.length();
409 _ttype = RANGE;
410 int _saveIndex;
411
412 match("..");
413 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
414 _token = makeToken(_ttype);
415 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
416 }
417 _returnToken = _token;
418 }
419
420 public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
421 int _ttype; Token _token=null; int _begin=text.length();
422 _ttype = WS;
423 int _saveIndex;
424
425 {
426 switch ( LA(1)) {
427 case ' ':
428 {
429 match(' ');
430 break;
431 }
432 case '\t':
433 {
434 match('\t');
435 break;
436 }
437 case '\u000c':
438 {
439 match('\f');
440 break;
441 }
442 case '\n': case '\r':
443 {
444 mNL(false);
445 break;
446 }
447 default:
448 {
449 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
450 }
451 }
452 }
453 _ttype = Token.SKIP;
454 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
455 _token = makeToken(_ttype);
456 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
457 }
458 _returnToken = _token;
459 }
460
461 protected final void mNL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
462 int _ttype; Token _token=null; int _begin=text.length();
463 _ttype = NL;
464 int _saveIndex;
465
466 {
467 if (((LA(1)=='\r') && (LA(2)=='\n'))&&(LA(2) == '\n')) {
468 match('\r');
469 match('\n');
470 }
471 else if ((LA(1)=='\r') && (true)) {
472 match('\r');
473 }
474 else if ((LA(1)=='\n')) {
475 match('\n');
476 }
477 else {
478 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
479 }
480
481 }
482 newline();
483 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
484 _token = makeToken(_ttype);
485 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
486 }
487 _returnToken = _token;
488 }
489
490 public final void mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
491 int _ttype; Token _token=null; int _begin=text.length();
492 _ttype = SL_COMMENT;
493 int _saveIndex;
494
495 match("//");
496 {
497 _loop76:
498 do {
499 if ((_tokenSet_0.member(LA(1)))) {
500 {
501 match(_tokenSet_0);
502 }
503 }
504 else {
505 break _loop76;
506 }
507
508 } while (true);
509 }
510 {
511 if ((LA(1)=='\n'||LA(1)=='\r')) {
512 mNL(false);
513 }
514 else {
515 }
516
517 }
518 _ttype = Token.SKIP;
519 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
520 _token = makeToken(_ttype);
521 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
522 }
523 _returnToken = _token;
524 }
525
526 public final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
527 int _ttype; Token _token=null; int _begin=text.length();
528 _ttype = ML_COMMENT;
529 int _saveIndex;
530
531 match("/*");
532 {
533 _loop81:
534 do {
535 if (((LA(1)=='*') && ((LA(2) >= '\u0003' && LA(2) <= '\uffff')))&&( LA(2)!='/' )) {
536 match('*');
537 }
538 else if ((LA(1)=='\n'||LA(1)=='\r')) {
539 mNL(false);
540 }
541 else if ((_tokenSet_1.member(LA(1)))) {
542 {
543 match(_tokenSet_1);
544 }
545 }
546 else {
547 break _loop81;
548 }
549
550 } while (true);
551 }
552 match("*/");
553 _ttype = Token.SKIP;
554 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
555 _token = makeToken(_ttype);
556 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
557 }
558 _returnToken = _token;
559 }
560
561 public final void mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
562 int _ttype; Token _token=null; int _begin=text.length();
563 _ttype = IDENT;
564 int _saveIndex;
565
566 mPTIDENT(false);
567 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
568 _token = makeToken(_ttype);
569 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
570 }
571 _returnToken = _token;
572 }
573
574 protected final void mPTIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
575 int _ttype; Token _token=null; int _begin=text.length();
576 _ttype = PTIDENT;
577 int _saveIndex;
578
579 {
580 switch ( LA(1)) {
581 case 'a': case 'b': case 'c': case 'd':
582 case 'e': case 'f': case 'g': case 'h':
583 case 'i': case 'j': case 'k': case 'l':
584 case 'm': case 'n': case 'o': case 'p':
585 case 'q': case 'r': case 's': case 't':
586 case 'u': case 'v': case 'w': case 'x':
587 case 'y': case 'z':
588 {
589 matchRange('a','z');
590 break;
591 }
592 case 'A': case 'B': case 'C': case 'D':
593 case 'E': case 'F': case 'G': case 'H':
594 case 'I': case 'J': case 'K': case 'L':
595 case 'M': case 'N': case 'O': case 'P':
596 case 'Q': case 'R': case 'S': case 'T':
597 case 'U': case 'V': case 'W': case 'X':
598 case 'Y': case 'Z':
599 {
600 matchRange('A','Z');
601 break;
602 }
603 default:
604 {
605 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
606 }
607 }
608 }
609 {
610 _loop88:
611 do {
612 switch ( LA(1)) {
613 case 'a': case 'b': case 'c': case 'd':
614 case 'e': case 'f': case 'g': case 'h':
615 case 'i': case 'j': case 'k': case 'l':
616 case 'm': case 'n': case 'o': case 'p':
617 case 'q': case 'r': case 's': case 't':
618 case 'u': case 'v': case 'w': case 'x':
619 case 'y': case 'z':
620 {
621 matchRange('a','z');
622 break;
623 }
624 case 'A': case 'B': case 'C': case 'D':
625 case 'E': case 'F': case 'G': case 'H':
626 case 'I': case 'J': case 'K': case 'L':
627 case 'M': case 'N': case 'O': case 'P':
628 case 'Q': case 'R': case 'S': case 'T':
629 case 'U': case 'V': case 'W': case 'X':
630 case 'Y': case 'Z':
631 {
632 matchRange('A','Z');
633 break;
634 }
635 case '_':
636 {
637 match('_');
638 break;
639 }
640 case '0': case '1': case '2': case '3':
641 case '4': case '5': case '6': case '7':
642 case '8': case '9':
643 {
644 matchRange('0','9');
645 break;
646 }
647 case '$':
648 {
649 match('$');
650 break;
651 }
652 case '/':
653 {
654 match('/');
655 break;
656 }
657 case '*':
658 {
659 match('*');
660 break;
661 }
662 default:
663 {
664 break _loop88;
665 }
666 }
667 } while (true);
668 }
669 _ttype = testLiteralsTable(new String(text.getBuffer(),_begin,text.length()-_begin),_ttype);
670 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
671 _token = makeToken(_ttype);
672 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
673 }
674 _returnToken = _token;
675 }
676
677 public final void mTYPEREF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
678 int _ttype; Token _token=null; int _begin=text.length();
679 _ttype = TYPEREF;
680 int _saveIndex;
681 Token i=null;
682
683 match('$');
684 mPTIDENT(true);
685 i=_returnToken;
686 text.setLength(_begin); text.append(i.getText());
687 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
688 _token = makeToken(_ttype);
689 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
690 }
691 _returnToken = _token;
692 }
693
694 public final void mOPTION_BLOCK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
695 int _ttype; Token _token=null; int _begin=text.length();
696 _ttype = OPTION_BLOCK;
697 int _saveIndex;
698 Token i=null;
699
700 match('@');
701 mPTIDENT(true);
702 i=_returnToken;
703 text.setLength(_begin); text.append(i.getText());
704 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
705 _token = makeToken(_ttype);
706 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
707 }
708 _returnToken = _token;
709 }
710
711 public final void mNUMBER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
712 int _ttype; Token _token=null; int _begin=text.length();
713 _ttype = NUMBER;
714 int _saveIndex;
715
716 {
717 int _cnt93=0;
718 _loop93:
719 do {
720 if (((LA(1) >= '0' && LA(1) <= '9'))) {
721 matchRange('0','9');
722 }
723 else {
724 if ( _cnt93>=1 ) { break _loop93; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
725 }
726
727 _cnt93++;
728 } while (true);
729 }
730 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
731 _token = makeToken(_ttype);
732 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
733 }
734 _returnToken = _token;
735 }
736
737 public final void mCHAR_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
738 int _ttype; Token _token=null; int _begin=text.length();
739 _ttype = CHAR_LITERAL;
740 int _saveIndex;
741 Token c=null;
742
743 match('\'');
744 mCHAR_BODY(true);
745 c=_returnToken;
746 match('\'');
747 text.setLength(_begin); text.append(c.getText());
748 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
749 _token = makeToken(_ttype);
750 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
751 }
752 _returnToken = _token;
753 }
754
755 protected final void mCHAR_BODY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
756 int _ttype; Token _token=null; int _begin=text.length();
757 _ttype = CHAR_BODY;
758 int _saveIndex;
759
760 if ((LA(1)=='\\')) {
761 mESC(false);
762 }
763 else if ((_tokenSet_2.member(LA(1)))) {
764 {
765 match(_tokenSet_2);
766 }
767 }
768 else {
769 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
770 }
771
772 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
773 _token = makeToken(_ttype);
774 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
775 }
776 _returnToken = _token;
777 }
778
779 protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
780 int _ttype; Token _token=null; int _begin=text.length();
781 _ttype = ESC;
782 int _saveIndex;
783 char c = 0;
784
785 match('\\');
786 {
787 switch ( LA(1)) {
788 case 'n':
789 {
790 match('n');
791 text.setLength(_begin); text.append("\n");
792 break;
793 }
794 case 'r':
795 {
796 match('r');
797 text.setLength(_begin); text.append("\r");
798 break;
799 }
800 case 't':
801 {
802 match('t');
803 text.setLength(_begin); text.append("\t");
804 break;
805 }
806 case 'b':
807 {
808 match('b');
809 text.setLength(_begin); text.append("\b");
810 break;
811 }
812 case 'f':
813 {
814 match('f');
815 text.setLength(_begin); text.append("\f");
816 break;
817 }
818 case '"':
819 {
820 match('"');
821 text.setLength(_begin); text.append("\"");
822 break;
823 }
824 case '\'':
825 {
826 match('\'');
827 text.setLength(_begin); text.append("\'");
828 break;
829 }
830 case '\\':
831 {
832 match('\\');
833 text.setLength(_begin); text.append("\\");
834 break;
835 }
836 case 'u':
837 {
838 c=mUNICODE(false);
839 text.setLength(_begin); text.append(Character.toString(c));
840 break;
841 }
842 case '0': case '1': case '2': case '3':
843 case '4': case '5': case '6': case '7':
844 {
845 c=mOCTAL(false);
846 text.setLength(_begin); text.append(Character.toString(c));
847 break;
848 }
849 default:
850 {
851 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
852 }
853 }
854 }
855 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
856 _token = makeToken(_ttype);
857 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
858 }
859 _returnToken = _token;
860 }
861
862 public final void mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
863 int _ttype; Token _token=null; int _begin=text.length();
864 _ttype = STRING_LITERAL;
865 int _saveIndex;
866 Token s=null;
867
868 match('"');
869 mSTRING_BODY(true);
870 s=_returnToken;
871 match('"');
872 text.setLength(_begin); text.append(s.getText());
873 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
874 _token = makeToken(_ttype);
875 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
876 }
877 _returnToken = _token;
878 }
879
880 protected final void mSTRING_BODY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
881 int _ttype; Token _token=null; int _begin=text.length();
882 _ttype = STRING_BODY;
883 int _saveIndex;
884 Token e=null;
885 char o = '\0';
886 StringBuffer sb = new StringBuffer();
887
888 {
889 _loop101:
890 do {
891 if ((LA(1)=='\\')) {
892 mESC(true);
893 e=_returnToken;
894 sb.append(e.getText());
895 }
896 else if ((_tokenSet_3.member(LA(1)))) {
897 {
898 o = LA(1);
899 match(_tokenSet_3);
900 }
901 sb.append(o);
902 }
903 else {
904 break _loop101;
905 }
906
907 } while (true);
908 }
909 text.setLength(_begin); text.append(sb.toString());
910 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
911 _token = makeToken(_ttype);
912 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
913 }
914 _returnToken = _token;
915 }
916
917 protected final char mUNICODE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
918 char c = 0;;
919 int _ttype; Token _token=null; int _begin=text.length();
920 _ttype = UNICODE;
921 int _saveIndex;
922
923 {
924 int _cnt106=0;
925 _loop106:
926 do {
927 if ((LA(1)=='u')) {
928 match('u');
929 }
930 else {
931 if ( _cnt106>=1 ) { break _loop106; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
932 }
933
934 _cnt106++;
935 } while (true);
936 }
937 mHEX_DIGIT(false);
938 c <<= 4; c |= Character.digit(LA(0), 16);
939 mHEX_DIGIT(false);
940 c <<= 4; c |= Character.digit(LA(0), 16);
941 mHEX_DIGIT(false);
942 c <<= 4; c |= Character.digit(LA(0), 16);
943 mHEX_DIGIT(false);
944 c <<= 4; c |= Character.digit(LA(0), 16);
945 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
946 _token = makeToken(_ttype);
947 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
948 }
949 _returnToken = _token;
950 return c;
951 }
952
953 protected final char mOCTAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
954 char c = 0;;
955 int _ttype; Token _token=null; int _begin=text.length();
956 _ttype = OCTAL;
957 int _saveIndex;
958
959 switch ( LA(1)) {
960 case '0': case '1': case '2': case '3':
961 {
962 matchRange('0','3');
963 c <<= 3; c |= Character.digit(LA(0), 8);
964 {
965 if (((LA(1) >= '0' && LA(1) <= '7')) && (_tokenSet_0.member(LA(2)))) {
966 matchRange('0','7');
967 c <<= 3; c |= Character.digit(LA(0), 8);
968 {
969 if (((LA(1) >= '0' && LA(1) <= '7')) && (_tokenSet_0.member(LA(2)))) {
970 matchRange('0','7');
971 c <<= 3; c |= Character.digit(LA(0), 8);
972 }
973 else if ((_tokenSet_0.member(LA(1))) && (true)) {
974 }
975 else {
976 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
977 }
978
979 }
980 }
981 else if ((_tokenSet_0.member(LA(1))) && (true)) {
982 }
983 else {
984 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
985 }
986
987 }
988 break;
989 }
990 case '4': case '5': case '6': case '7':
991 {
992 matchRange('4','7');
993 c <<= 3; c |= Character.digit(LA(0), 8);
994 {
995 if (((LA(1) >= '0' && LA(1) <= '7')) && (_tokenSet_0.member(LA(2)))) {
996 matchRange('0','7');
997 c <<= 3; c |= Character.digit(LA(0), 8);
998 }
999 else if ((_tokenSet_0.member(LA(1))) && (true)) {
1000 }
1001 else {
1002 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1003 }
1004
1005 }
1006 break;
1007 }
1008 default:
1009 {
1010 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1011 }
1012 }
1013 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1014 _token = makeToken(_ttype);
1015 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1016 }
1017 _returnToken = _token;
1018 return c;
1019 }
1020
1021 protected final int mHEX_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1022 int i = 0;;
1023 int _ttype; Token _token=null; int _begin=text.length();
1024 _ttype = HEX_DIGIT;
1025 int _saveIndex;
1026
1027 {
1028 switch ( LA(1)) {
1029 case '0': case '1': case '2': case '3':
1030 case '4': case '5': case '6': case '7':
1031 case '8': case '9':
1032 {
1033 matchRange('0','9');
1034 break;
1035 }
1036 case 'A': case 'B': case 'C': case 'D':
1037 case 'E': case 'F':
1038 {
1039 matchRange('A','F');
1040 break;
1041 }
1042 case 'a': case 'b': case 'c': case 'd':
1043 case 'e': case 'f':
1044 {
1045 matchRange('a','f');
1046 break;
1047 }
1048 default:
1049 {
1050 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1051 }
1052 }
1053 }
1054 i = Character.digit(LA(0), 16);
1055 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1056 _token = makeToken(_ttype);
1057 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1058 }
1059 _returnToken = _token;
1060 return i;
1061 }
1062
1063
1064 private static final long[] mk_tokenSet_0() {
1065 long[] data = new long[2048];
1066 data[0]=-9224L;
1067 for (int i = 1; i<=1023; i++) { data[i]=-1L; }
1068 return data;
1069 }
1070 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1071 private static final long[] mk_tokenSet_1() {
1072 long[] data = new long[2048];
1073 data[0]=-4398046520328L;
1074 for (int i = 1; i<=1023; i++) { data[i]=-1L; }
1075 return data;
1076 }
1077 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1078 private static final long[] mk_tokenSet_2() {
1079 long[] data = new long[2048];
1080 data[0]=-549755823112L;
1081 data[1]=-268435457L;
1082 for (int i = 2; i<=1023; i++) { data[i]=-1L; }
1083 return data;
1084 }
1085 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1086 private static final long[] mk_tokenSet_3() {
1087 long[] data = new long[2048];
1088 data[0]=-17179878408L;
1089 data[1]=-268435457L;
1090 for (int i = 2; i<=1023; i++) { data[i]=-1L; }
1091 return data;
1092 }
1093 public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1094
1095 }