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