1 | // $ANTLR : "action.g" -> "ActionLexer.java"$ |
---|
2 | |
---|
3 | package antlr.actions.csharp; |
---|
4 | |
---|
5 | import java.io.InputStream; |
---|
6 | import antlr.TokenStreamException; |
---|
7 | import antlr.TokenStreamIOException; |
---|
8 | import antlr.TokenStreamRecognitionException; |
---|
9 | import antlr.CharStreamException; |
---|
10 | import antlr.CharStreamIOException; |
---|
11 | import antlr.ANTLRException; |
---|
12 | import java.io.Reader; |
---|
13 | import java.util.Hashtable; |
---|
14 | import antlr.CharScanner; |
---|
15 | import antlr.InputBuffer; |
---|
16 | import antlr.ByteBuffer; |
---|
17 | import antlr.CharBuffer; |
---|
18 | import antlr.Token; |
---|
19 | import antlr.CommonToken; |
---|
20 | import antlr.RecognitionException; |
---|
21 | import antlr.NoViableAltForCharException; |
---|
22 | import antlr.MismatchedCharException; |
---|
23 | import antlr.TokenStream; |
---|
24 | import antlr.ANTLRHashString; |
---|
25 | import antlr.LexerSharedInputState; |
---|
26 | import antlr.collections.impl.BitSet; |
---|
27 | import antlr.SemanticException; |
---|
28 | |
---|
29 | import java.io.StringReader; |
---|
30 | import antlr.collections.impl.Vector; |
---|
31 | import antlr.*; |
---|
32 | |
---|
33 | /** Perform the following translations: |
---|
34 | |
---|
35 | AST related translations |
---|
36 | |
---|
37 | ## -> currentRule_AST |
---|
38 | #(x,y,z) -> codeGenerator.getASTCreateString(vector-of(x,y,z)) |
---|
39 | #[x] -> codeGenerator.getASTCreateString(x) |
---|
40 | #x -> codeGenerator.mapTreeId(x) |
---|
41 | |
---|
42 | Inside context of #(...), you can ref (x,y,z), [x], and x as shortcuts. |
---|
43 | |
---|
44 | Text related translations |
---|
45 | |
---|
46 | $append(x) -> text.append(x) |
---|
47 | $setText(x) -> text.setLength(_begin); text.append(x) |
---|
48 | $getText -> new String(text.getBuffer(),_begin,text.length()-_begin) |
---|
49 | $setToken(x) -> _token = x |
---|
50 | $setType(x) -> _ttype = x |
---|
51 | $FOLLOW(r) -> FOLLOW set name for rule r (optional arg) |
---|
52 | $FIRST(r) -> FIRST set name for rule r (optional arg) |
---|
53 | */ |
---|
54 | public class ActionLexer extends antlr.CharScanner implements ActionLexerTokenTypes, TokenStream |
---|
55 | { |
---|
56 | |
---|
57 | protected RuleBlock currentRule; |
---|
58 | protected CodeGenerator generator; |
---|
59 | protected int lineOffset = 0; |
---|
60 | private Tool antlrTool; // The ANTLR tool |
---|
61 | ActionTransInfo transInfo; |
---|
62 | |
---|
63 | public ActionLexer( String s, RuleBlock currentRule, |
---|
64 | CodeGenerator generator, |
---|
65 | ActionTransInfo transInfo ) |
---|
66 | { |
---|
67 | this(new StringReader(s)); |
---|
68 | this.currentRule = currentRule; |
---|
69 | this.generator = generator; |
---|
70 | this.transInfo = transInfo; |
---|
71 | } |
---|
72 | |
---|
73 | public void setLineOffset(int lineOffset) |
---|
74 | { |
---|
75 | setLine(lineOffset); |
---|
76 | } |
---|
77 | |
---|
78 | public void setTool(Tool tool) |
---|
79 | { |
---|
80 | this.antlrTool = tool; |
---|
81 | } |
---|
82 | |
---|
83 | public void reportError(RecognitionException e) |
---|
84 | { |
---|
85 | antlrTool.error("Syntax error in action: "+e,getFilename(),getLine(),getColumn()); |
---|
86 | } |
---|
87 | |
---|
88 | public void reportError(String s) |
---|
89 | { |
---|
90 | antlrTool.error(s,getFilename(),getLine(),getColumn()); |
---|
91 | } |
---|
92 | |
---|
93 | public void reportWarning(String s) |
---|
94 | { |
---|
95 | if ( getFilename()==null ) |
---|
96 | antlrTool.warning(s); |
---|
97 | else |
---|
98 | antlrTool.warning(s,getFilename(),getLine(),getColumn()); |
---|
99 | } |
---|
100 | public ActionLexer(InputStream in) { |
---|
101 | this(new ByteBuffer(in)); |
---|
102 | } |
---|
103 | public ActionLexer(Reader in) { |
---|
104 | this(new CharBuffer(in)); |
---|
105 | } |
---|
106 | public ActionLexer(InputBuffer ib) { |
---|
107 | this(new LexerSharedInputState(ib)); |
---|
108 | } |
---|
109 | public ActionLexer(LexerSharedInputState state) { |
---|
110 | super(state); |
---|
111 | caseSensitiveLiterals = true; |
---|
112 | setCaseSensitive(true); |
---|
113 | literals = new Hashtable(); |
---|
114 | } |
---|
115 | |
---|
116 | public Token nextToken() throws TokenStreamException { |
---|
117 | Token theRetToken=null; |
---|
118 | tryAgain: |
---|
119 | for (;;) { |
---|
120 | Token _token = null; |
---|
121 | int _ttype = Token.INVALID_TYPE; |
---|
122 | resetText(); |
---|
123 | try { // for char stream error handling |
---|
124 | try { // for lexical error handling |
---|
125 | if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))) { |
---|
126 | mACTION(true); |
---|
127 | theRetToken=_returnToken; |
---|
128 | } |
---|
129 | else { |
---|
130 | if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} |
---|
131 | else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
132 | } |
---|
133 | |
---|
134 | if ( _returnToken==null ) continue tryAgain; // found SKIP token |
---|
135 | _ttype = _returnToken.getType(); |
---|
136 | _returnToken.setType(_ttype); |
---|
137 | return _returnToken; |
---|
138 | } |
---|
139 | catch (RecognitionException e) { |
---|
140 | throw new TokenStreamRecognitionException(e); |
---|
141 | } |
---|
142 | } |
---|
143 | catch (CharStreamException cse) { |
---|
144 | if ( cse instanceof CharStreamIOException ) { |
---|
145 | throw new TokenStreamIOException(((CharStreamIOException)cse).io); |
---|
146 | } |
---|
147 | else { |
---|
148 | throw new TokenStreamException(cse.getMessage()); |
---|
149 | } |
---|
150 | } |
---|
151 | } |
---|
152 | } |
---|
153 | |
---|
154 | public final void mACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
155 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
156 | _ttype = ACTION; |
---|
157 | int _saveIndex; |
---|
158 | |
---|
159 | { |
---|
160 | int _cnt623=0; |
---|
161 | _loop623: |
---|
162 | do { |
---|
163 | switch ( LA(1)) { |
---|
164 | case '#': |
---|
165 | { |
---|
166 | mAST_ITEM(false); |
---|
167 | break; |
---|
168 | } |
---|
169 | case '$': |
---|
170 | { |
---|
171 | mTEXT_ITEM(false); |
---|
172 | break; |
---|
173 | } |
---|
174 | default: |
---|
175 | if ((_tokenSet_0.member(LA(1)))) { |
---|
176 | mSTUFF(false); |
---|
177 | } |
---|
178 | else { |
---|
179 | if ( _cnt623>=1 ) { break _loop623; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
180 | } |
---|
181 | } |
---|
182 | _cnt623++; |
---|
183 | } while (true); |
---|
184 | } |
---|
185 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
186 | _token = makeToken(_ttype); |
---|
187 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
188 | } |
---|
189 | _returnToken = _token; |
---|
190 | } |
---|
191 | |
---|
192 | /** stuff in between #(...) and #id items |
---|
193 | * Allow the escaping of the # for C# preprocessor stuff. |
---|
194 | */ |
---|
195 | protected final void mSTUFF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
196 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
197 | _ttype = STUFF; |
---|
198 | int _saveIndex; |
---|
199 | |
---|
200 | switch ( LA(1)) { |
---|
201 | case '"': |
---|
202 | { |
---|
203 | mSTRING(false); |
---|
204 | break; |
---|
205 | } |
---|
206 | case '\'': |
---|
207 | { |
---|
208 | mCHAR(false); |
---|
209 | break; |
---|
210 | } |
---|
211 | case '\n': |
---|
212 | { |
---|
213 | match('\n'); |
---|
214 | newline(); |
---|
215 | break; |
---|
216 | } |
---|
217 | default: |
---|
218 | if ((LA(1)=='/') && (LA(2)=='*'||LA(2)=='/')) { |
---|
219 | mCOMMENT(false); |
---|
220 | } |
---|
221 | else if ((LA(1)=='\r') && (LA(2)=='\n') && (true)) { |
---|
222 | match("\r\n"); |
---|
223 | newline(); |
---|
224 | } |
---|
225 | else if ((LA(1)=='\\') && (LA(2)=='#') && (true)) { |
---|
226 | match('\\'); |
---|
227 | match('#'); |
---|
228 | text.setLength(_begin); text.append("#"); |
---|
229 | } |
---|
230 | else if ((LA(1)=='/') && (_tokenSet_1.member(LA(2)))) { |
---|
231 | match('/'); |
---|
232 | { |
---|
233 | match(_tokenSet_1); |
---|
234 | } |
---|
235 | } |
---|
236 | else if ((LA(1)=='\r') && (true) && (true)) { |
---|
237 | match('\r'); |
---|
238 | newline(); |
---|
239 | } |
---|
240 | else if ((_tokenSet_2.member(LA(1))) && (true) && (true)) { |
---|
241 | { |
---|
242 | match(_tokenSet_2); |
---|
243 | } |
---|
244 | } |
---|
245 | else { |
---|
246 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
247 | } |
---|
248 | } |
---|
249 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
250 | _token = makeToken(_ttype); |
---|
251 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
252 | } |
---|
253 | _returnToken = _token; |
---|
254 | } |
---|
255 | |
---|
256 | protected final void mAST_ITEM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
257 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
258 | _ttype = AST_ITEM; |
---|
259 | int _saveIndex; |
---|
260 | Token t=null; |
---|
261 | Token id=null; |
---|
262 | Token ctor=null; |
---|
263 | |
---|
264 | if ((LA(1)=='#') && (LA(2)=='(')) { |
---|
265 | _saveIndex=text.length(); |
---|
266 | match('#'); |
---|
267 | text.setLength(_saveIndex); |
---|
268 | mTREE(true); |
---|
269 | t=_returnToken; |
---|
270 | } |
---|
271 | else if ((LA(1)=='#') && (_tokenSet_3.member(LA(2)))) { |
---|
272 | _saveIndex=text.length(); |
---|
273 | match('#'); |
---|
274 | text.setLength(_saveIndex); |
---|
275 | { |
---|
276 | switch ( LA(1)) { |
---|
277 | case '\t': case '\n': case '\r': case ' ': |
---|
278 | { |
---|
279 | mWS(false); |
---|
280 | break; |
---|
281 | } |
---|
282 | case 'A': case 'B': case 'C': case 'D': |
---|
283 | case 'E': case 'F': case 'G': case 'H': |
---|
284 | case 'I': case 'J': case 'K': case 'L': |
---|
285 | case 'M': case 'N': case 'O': case 'P': |
---|
286 | case 'Q': case 'R': case 'S': case 'T': |
---|
287 | case 'U': case 'V': case 'W': case 'X': |
---|
288 | case 'Y': case 'Z': case '_': case 'a': |
---|
289 | case 'b': case 'c': case 'd': case 'e': |
---|
290 | case 'f': case 'g': case 'h': case 'i': |
---|
291 | case 'j': case 'k': case 'l': case 'm': |
---|
292 | case 'n': case 'o': case 'p': case 'q': |
---|
293 | case 'r': case 's': case 't': case 'u': |
---|
294 | case 'v': case 'w': case 'x': case 'y': |
---|
295 | case 'z': |
---|
296 | { |
---|
297 | break; |
---|
298 | } |
---|
299 | default: |
---|
300 | { |
---|
301 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
302 | } |
---|
303 | } |
---|
304 | } |
---|
305 | mID(true); |
---|
306 | id=_returnToken; |
---|
307 | |
---|
308 | String idt = id.getText(); |
---|
309 | String mapped = generator.mapTreeId(id.getText(), transInfo); |
---|
310 | |
---|
311 | // verify that it's not a preprocessor macro... |
---|
312 | if ( (mapped != null) && !idt.equals(mapped) ) |
---|
313 | { |
---|
314 | text.setLength(_begin); text.append(mapped); |
---|
315 | } |
---|
316 | else |
---|
317 | { |
---|
318 | if (idt.equals("define") || |
---|
319 | idt.equals("undef") || |
---|
320 | idt.equals("if") || |
---|
321 | idt.equals("elif") || |
---|
322 | idt.equals("else") || |
---|
323 | idt.equals("endif") || |
---|
324 | idt.equals("line") || |
---|
325 | idt.equals("error") || |
---|
326 | idt.equals("warning") || |
---|
327 | idt.equals("region") || |
---|
328 | idt.equals("endregion")) |
---|
329 | { |
---|
330 | text.setLength(_begin); text.append("#"+idt); |
---|
331 | } |
---|
332 | } |
---|
333 | |
---|
334 | { |
---|
335 | if ((_tokenSet_4.member(LA(1))) && (true) && (true)) { |
---|
336 | mWS(false); |
---|
337 | } |
---|
338 | else { |
---|
339 | } |
---|
340 | |
---|
341 | } |
---|
342 | { |
---|
343 | if ((LA(1)=='=') && (true) && (true)) { |
---|
344 | mVAR_ASSIGN(false); |
---|
345 | } |
---|
346 | else { |
---|
347 | } |
---|
348 | |
---|
349 | } |
---|
350 | } |
---|
351 | else if ((LA(1)=='#') && (LA(2)=='[')) { |
---|
352 | _saveIndex=text.length(); |
---|
353 | match('#'); |
---|
354 | text.setLength(_saveIndex); |
---|
355 | mAST_CONSTRUCTOR(true); |
---|
356 | ctor=_returnToken; |
---|
357 | } |
---|
358 | else if ((LA(1)=='#') && (LA(2)=='#')) { |
---|
359 | match("##"); |
---|
360 | |
---|
361 | if( currentRule != null ) |
---|
362 | { |
---|
363 | String r = currentRule.getRuleName()+"_AST"; |
---|
364 | text.setLength(_begin); text.append(r); |
---|
365 | |
---|
366 | if ( transInfo!=null ) { |
---|
367 | transInfo.refRuleRoot=r; // we ref root of tree |
---|
368 | } |
---|
369 | } |
---|
370 | else |
---|
371 | { |
---|
372 | reportWarning("\"##\" not valid in this context"); |
---|
373 | text.setLength(_begin); text.append("##"); |
---|
374 | } |
---|
375 | |
---|
376 | { |
---|
377 | if ((_tokenSet_4.member(LA(1))) && (true) && (true)) { |
---|
378 | mWS(false); |
---|
379 | } |
---|
380 | else { |
---|
381 | } |
---|
382 | |
---|
383 | } |
---|
384 | { |
---|
385 | if ((LA(1)=='=') && (true) && (true)) { |
---|
386 | mVAR_ASSIGN(false); |
---|
387 | } |
---|
388 | else { |
---|
389 | } |
---|
390 | |
---|
391 | } |
---|
392 | } |
---|
393 | else { |
---|
394 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
395 | } |
---|
396 | |
---|
397 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
398 | _token = makeToken(_ttype); |
---|
399 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
400 | } |
---|
401 | _returnToken = _token; |
---|
402 | } |
---|
403 | |
---|
404 | protected final void mTEXT_ITEM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
405 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
406 | _ttype = TEXT_ITEM; |
---|
407 | int _saveIndex; |
---|
408 | Token a1=null; |
---|
409 | Token a2=null; |
---|
410 | Token a3=null; |
---|
411 | Token a4=null; |
---|
412 | Token a5=null; |
---|
413 | Token a6=null; |
---|
414 | |
---|
415 | if ((LA(1)=='$') && (LA(2)=='F') && (LA(3)=='O')) { |
---|
416 | match("$FOLLOW"); |
---|
417 | { |
---|
418 | if ((_tokenSet_5.member(LA(1))) && (_tokenSet_6.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
419 | { |
---|
420 | switch ( LA(1)) { |
---|
421 | case '\t': case '\n': case '\r': case ' ': |
---|
422 | { |
---|
423 | mWS(false); |
---|
424 | break; |
---|
425 | } |
---|
426 | case '(': |
---|
427 | { |
---|
428 | break; |
---|
429 | } |
---|
430 | default: |
---|
431 | { |
---|
432 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
433 | } |
---|
434 | } |
---|
435 | } |
---|
436 | match('('); |
---|
437 | mTEXT_ARG(true); |
---|
438 | a5=_returnToken; |
---|
439 | match(')'); |
---|
440 | } |
---|
441 | else { |
---|
442 | } |
---|
443 | |
---|
444 | } |
---|
445 | |
---|
446 | String rule = currentRule.getRuleName(); |
---|
447 | if ( a5!=null ) { |
---|
448 | rule = a5.getText(); |
---|
449 | } |
---|
450 | String setName = generator.getFOLLOWBitSet(rule, 1); |
---|
451 | // System.out.println("FOLLOW("+rule+")="+setName); |
---|
452 | if ( setName==null ) { |
---|
453 | reportError("$FOLLOW("+rule+")"+ |
---|
454 | ": unknown rule or bad lookahead computation"); |
---|
455 | } |
---|
456 | else { |
---|
457 | text.setLength(_begin); text.append(setName); |
---|
458 | } |
---|
459 | |
---|
460 | } |
---|
461 | else if ((LA(1)=='$') && (LA(2)=='F') && (LA(3)=='I')) { |
---|
462 | match("$FIRST"); |
---|
463 | { |
---|
464 | if ((_tokenSet_5.member(LA(1))) && (_tokenSet_6.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
465 | { |
---|
466 | switch ( LA(1)) { |
---|
467 | case '\t': case '\n': case '\r': case ' ': |
---|
468 | { |
---|
469 | mWS(false); |
---|
470 | break; |
---|
471 | } |
---|
472 | case '(': |
---|
473 | { |
---|
474 | break; |
---|
475 | } |
---|
476 | default: |
---|
477 | { |
---|
478 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
479 | } |
---|
480 | } |
---|
481 | } |
---|
482 | match('('); |
---|
483 | mTEXT_ARG(true); |
---|
484 | a6=_returnToken; |
---|
485 | match(')'); |
---|
486 | } |
---|
487 | else { |
---|
488 | } |
---|
489 | |
---|
490 | } |
---|
491 | |
---|
492 | String rule = currentRule.getRuleName(); |
---|
493 | if ( a6!=null ) { |
---|
494 | rule = a6.getText(); |
---|
495 | } |
---|
496 | String setName = generator.getFIRSTBitSet(rule, 1); |
---|
497 | // System.out.println("FIRST("+rule+")="+setName); |
---|
498 | if ( setName==null ) { |
---|
499 | reportError("$FIRST("+rule+")"+ |
---|
500 | ": unknown rule or bad lookahead computation"); |
---|
501 | } |
---|
502 | else { |
---|
503 | text.setLength(_begin); text.append(setName); |
---|
504 | } |
---|
505 | |
---|
506 | } |
---|
507 | else if ((LA(1)=='$') && (LA(2)=='a')) { |
---|
508 | match("$append"); |
---|
509 | { |
---|
510 | switch ( LA(1)) { |
---|
511 | case '\t': case '\n': case '\r': case ' ': |
---|
512 | { |
---|
513 | mWS(false); |
---|
514 | break; |
---|
515 | } |
---|
516 | case '(': |
---|
517 | { |
---|
518 | break; |
---|
519 | } |
---|
520 | default: |
---|
521 | { |
---|
522 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
523 | } |
---|
524 | } |
---|
525 | } |
---|
526 | match('('); |
---|
527 | mTEXT_ARG(true); |
---|
528 | a1=_returnToken; |
---|
529 | match(')'); |
---|
530 | |
---|
531 | String t = "text.Append("+a1.getText()+")"; |
---|
532 | text.setLength(_begin); text.append(t); |
---|
533 | |
---|
534 | } |
---|
535 | else if ((LA(1)=='$') && (LA(2)=='s')) { |
---|
536 | match("$set"); |
---|
537 | { |
---|
538 | if ((LA(1)=='T') && (LA(2)=='e')) { |
---|
539 | match("Text"); |
---|
540 | { |
---|
541 | switch ( LA(1)) { |
---|
542 | case '\t': case '\n': case '\r': case ' ': |
---|
543 | { |
---|
544 | mWS(false); |
---|
545 | break; |
---|
546 | } |
---|
547 | case '(': |
---|
548 | { |
---|
549 | break; |
---|
550 | } |
---|
551 | default: |
---|
552 | { |
---|
553 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
554 | } |
---|
555 | } |
---|
556 | } |
---|
557 | match('('); |
---|
558 | mTEXT_ARG(true); |
---|
559 | a2=_returnToken; |
---|
560 | match(')'); |
---|
561 | |
---|
562 | String t; |
---|
563 | t = "text.Length = _begin; text.Append("+a2.getText()+")"; |
---|
564 | text.setLength(_begin); text.append(t); |
---|
565 | |
---|
566 | } |
---|
567 | else if ((LA(1)=='T') && (LA(2)=='o')) { |
---|
568 | match("Token"); |
---|
569 | { |
---|
570 | switch ( LA(1)) { |
---|
571 | case '\t': case '\n': case '\r': case ' ': |
---|
572 | { |
---|
573 | mWS(false); |
---|
574 | break; |
---|
575 | } |
---|
576 | case '(': |
---|
577 | { |
---|
578 | break; |
---|
579 | } |
---|
580 | default: |
---|
581 | { |
---|
582 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
583 | } |
---|
584 | } |
---|
585 | } |
---|
586 | match('('); |
---|
587 | mTEXT_ARG(true); |
---|
588 | a3=_returnToken; |
---|
589 | match(')'); |
---|
590 | |
---|
591 | String t="_token = "+a3.getText(); |
---|
592 | text.setLength(_begin); text.append(t); |
---|
593 | |
---|
594 | } |
---|
595 | else if ((LA(1)=='T') && (LA(2)=='y')) { |
---|
596 | match("Type"); |
---|
597 | { |
---|
598 | switch ( LA(1)) { |
---|
599 | case '\t': case '\n': case '\r': case ' ': |
---|
600 | { |
---|
601 | mWS(false); |
---|
602 | break; |
---|
603 | } |
---|
604 | case '(': |
---|
605 | { |
---|
606 | break; |
---|
607 | } |
---|
608 | default: |
---|
609 | { |
---|
610 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
611 | } |
---|
612 | } |
---|
613 | } |
---|
614 | match('('); |
---|
615 | mTEXT_ARG(true); |
---|
616 | a4=_returnToken; |
---|
617 | match(')'); |
---|
618 | |
---|
619 | String t="_ttype = "+a4.getText(); |
---|
620 | text.setLength(_begin); text.append(t); |
---|
621 | |
---|
622 | } |
---|
623 | else { |
---|
624 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
625 | } |
---|
626 | |
---|
627 | } |
---|
628 | } |
---|
629 | else if ((LA(1)=='$') && (LA(2)=='g')) { |
---|
630 | match("$getText"); |
---|
631 | |
---|
632 | text.setLength(_begin); text.append("text.ToString(_begin, text.Length-_begin)"); |
---|
633 | |
---|
634 | } |
---|
635 | else { |
---|
636 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
637 | } |
---|
638 | |
---|
639 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
640 | _token = makeToken(_ttype); |
---|
641 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
642 | } |
---|
643 | _returnToken = _token; |
---|
644 | } |
---|
645 | |
---|
646 | protected final void mCOMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
647 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
648 | _ttype = COMMENT; |
---|
649 | int _saveIndex; |
---|
650 | |
---|
651 | if ((LA(1)=='/') && (LA(2)=='/')) { |
---|
652 | mSL_COMMENT(false); |
---|
653 | } |
---|
654 | else if ((LA(1)=='/') && (LA(2)=='*')) { |
---|
655 | mML_COMMENT(false); |
---|
656 | } |
---|
657 | else { |
---|
658 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
659 | } |
---|
660 | |
---|
661 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
662 | _token = makeToken(_ttype); |
---|
663 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
664 | } |
---|
665 | _returnToken = _token; |
---|
666 | } |
---|
667 | |
---|
668 | protected final void mSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
669 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
670 | _ttype = STRING; |
---|
671 | int _saveIndex; |
---|
672 | |
---|
673 | match('"'); |
---|
674 | { |
---|
675 | _loop720: |
---|
676 | do { |
---|
677 | if ((LA(1)=='\\')) { |
---|
678 | mESC(false); |
---|
679 | } |
---|
680 | else if ((_tokenSet_7.member(LA(1)))) { |
---|
681 | matchNot('"'); |
---|
682 | } |
---|
683 | else { |
---|
684 | break _loop720; |
---|
685 | } |
---|
686 | |
---|
687 | } while (true); |
---|
688 | } |
---|
689 | match('"'); |
---|
690 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
691 | _token = makeToken(_ttype); |
---|
692 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
693 | } |
---|
694 | _returnToken = _token; |
---|
695 | } |
---|
696 | |
---|
697 | protected final void mCHAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
698 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
699 | _ttype = CHAR; |
---|
700 | int _saveIndex; |
---|
701 | |
---|
702 | match('\''); |
---|
703 | { |
---|
704 | if ((LA(1)=='\\')) { |
---|
705 | mESC(false); |
---|
706 | } |
---|
707 | else if ((_tokenSet_8.member(LA(1)))) { |
---|
708 | matchNot('\''); |
---|
709 | } |
---|
710 | else { |
---|
711 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
712 | } |
---|
713 | |
---|
714 | } |
---|
715 | match('\''); |
---|
716 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
717 | _token = makeToken(_ttype); |
---|
718 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
719 | } |
---|
720 | _returnToken = _token; |
---|
721 | } |
---|
722 | |
---|
723 | protected final void mTREE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
724 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
725 | _ttype = TREE; |
---|
726 | int _saveIndex; |
---|
727 | Token t=null; |
---|
728 | Token t2=null; |
---|
729 | |
---|
730 | StringBuffer buf = new StringBuffer(); |
---|
731 | int n=0; |
---|
732 | Vector terms = new Vector(10); |
---|
733 | |
---|
734 | |
---|
735 | _saveIndex=text.length(); |
---|
736 | match('('); |
---|
737 | text.setLength(_saveIndex); |
---|
738 | { |
---|
739 | switch ( LA(1)) { |
---|
740 | case '\t': case '\n': case '\r': case ' ': |
---|
741 | { |
---|
742 | _saveIndex=text.length(); |
---|
743 | mWS(false); |
---|
744 | text.setLength(_saveIndex); |
---|
745 | break; |
---|
746 | } |
---|
747 | case '"': case '#': case '(': case 'A': |
---|
748 | case 'B': case 'C': case 'D': case 'E': |
---|
749 | case 'F': case 'G': case 'H': case 'I': |
---|
750 | case 'J': case 'K': case 'L': case 'M': |
---|
751 | case 'N': case 'O': case 'P': case 'Q': |
---|
752 | case 'R': case 'S': case 'T': case 'U': |
---|
753 | case 'V': case 'W': case 'X': case 'Y': |
---|
754 | case 'Z': case '[': case '_': case 'a': |
---|
755 | case 'b': case 'c': case 'd': case 'e': |
---|
756 | case 'f': case 'g': case 'h': case 'i': |
---|
757 | case 'j': case 'k': case 'l': case 'm': |
---|
758 | case 'n': case 'o': case 'p': case 'q': |
---|
759 | case 'r': case 's': case 't': case 'u': |
---|
760 | case 'v': case 'w': case 'x': case 'y': |
---|
761 | case 'z': |
---|
762 | { |
---|
763 | break; |
---|
764 | } |
---|
765 | default: |
---|
766 | { |
---|
767 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
768 | } |
---|
769 | } |
---|
770 | } |
---|
771 | _saveIndex=text.length(); |
---|
772 | mTREE_ELEMENT(true); |
---|
773 | text.setLength(_saveIndex); |
---|
774 | t=_returnToken; |
---|
775 | |
---|
776 | terms.appendElement( |
---|
777 | generator.processStringForASTConstructor(t.getText()) |
---|
778 | ); |
---|
779 | |
---|
780 | { |
---|
781 | switch ( LA(1)) { |
---|
782 | case '\t': case '\n': case '\r': case ' ': |
---|
783 | { |
---|
784 | _saveIndex=text.length(); |
---|
785 | mWS(false); |
---|
786 | text.setLength(_saveIndex); |
---|
787 | break; |
---|
788 | } |
---|
789 | case ')': case ',': |
---|
790 | { |
---|
791 | break; |
---|
792 | } |
---|
793 | default: |
---|
794 | { |
---|
795 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
796 | } |
---|
797 | } |
---|
798 | } |
---|
799 | { |
---|
800 | _loop649: |
---|
801 | do { |
---|
802 | if ((LA(1)==',')) { |
---|
803 | _saveIndex=text.length(); |
---|
804 | match(','); |
---|
805 | text.setLength(_saveIndex); |
---|
806 | { |
---|
807 | switch ( LA(1)) { |
---|
808 | case '\t': case '\n': case '\r': case ' ': |
---|
809 | { |
---|
810 | _saveIndex=text.length(); |
---|
811 | mWS(false); |
---|
812 | text.setLength(_saveIndex); |
---|
813 | break; |
---|
814 | } |
---|
815 | case '"': case '#': case '(': case 'A': |
---|
816 | case 'B': case 'C': case 'D': case 'E': |
---|
817 | case 'F': case 'G': case 'H': case 'I': |
---|
818 | case 'J': case 'K': case 'L': case 'M': |
---|
819 | case 'N': case 'O': case 'P': case 'Q': |
---|
820 | case 'R': case 'S': case 'T': case 'U': |
---|
821 | case 'V': case 'W': case 'X': case 'Y': |
---|
822 | case 'Z': case '[': case '_': case 'a': |
---|
823 | case 'b': case 'c': case 'd': case 'e': |
---|
824 | case 'f': case 'g': case 'h': case 'i': |
---|
825 | case 'j': case 'k': case 'l': case 'm': |
---|
826 | case 'n': case 'o': case 'p': case 'q': |
---|
827 | case 'r': case 's': case 't': case 'u': |
---|
828 | case 'v': case 'w': case 'x': case 'y': |
---|
829 | case 'z': |
---|
830 | { |
---|
831 | break; |
---|
832 | } |
---|
833 | default: |
---|
834 | { |
---|
835 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
836 | } |
---|
837 | } |
---|
838 | } |
---|
839 | _saveIndex=text.length(); |
---|
840 | mTREE_ELEMENT(true); |
---|
841 | text.setLength(_saveIndex); |
---|
842 | t2=_returnToken; |
---|
843 | |
---|
844 | terms.appendElement( |
---|
845 | generator.processStringForASTConstructor(t2.getText()) |
---|
846 | ); |
---|
847 | |
---|
848 | { |
---|
849 | switch ( LA(1)) { |
---|
850 | case '\t': case '\n': case '\r': case ' ': |
---|
851 | { |
---|
852 | _saveIndex=text.length(); |
---|
853 | mWS(false); |
---|
854 | text.setLength(_saveIndex); |
---|
855 | break; |
---|
856 | } |
---|
857 | case ')': case ',': |
---|
858 | { |
---|
859 | break; |
---|
860 | } |
---|
861 | default: |
---|
862 | { |
---|
863 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
864 | } |
---|
865 | } |
---|
866 | } |
---|
867 | } |
---|
868 | else { |
---|
869 | break _loop649; |
---|
870 | } |
---|
871 | |
---|
872 | } while (true); |
---|
873 | } |
---|
874 | text.setLength(_begin); text.append(generator.getASTCreateString(terms)); |
---|
875 | _saveIndex=text.length(); |
---|
876 | match(')'); |
---|
877 | text.setLength(_saveIndex); |
---|
878 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
879 | _token = makeToken(_ttype); |
---|
880 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
881 | } |
---|
882 | _returnToken = _token; |
---|
883 | } |
---|
884 | |
---|
885 | protected final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
886 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
887 | _ttype = WS; |
---|
888 | int _saveIndex; |
---|
889 | |
---|
890 | { |
---|
891 | int _cnt740=0; |
---|
892 | _loop740: |
---|
893 | do { |
---|
894 | if ((LA(1)=='\r') && (LA(2)=='\n') && (true)) { |
---|
895 | match('\r'); |
---|
896 | match('\n'); |
---|
897 | newline(); |
---|
898 | } |
---|
899 | else if ((LA(1)==' ') && (true) && (true)) { |
---|
900 | match(' '); |
---|
901 | } |
---|
902 | else if ((LA(1)=='\t') && (true) && (true)) { |
---|
903 | match('\t'); |
---|
904 | } |
---|
905 | else if ((LA(1)=='\r') && (true) && (true)) { |
---|
906 | match('\r'); |
---|
907 | newline(); |
---|
908 | } |
---|
909 | else if ((LA(1)=='\n') && (true) && (true)) { |
---|
910 | match('\n'); |
---|
911 | newline(); |
---|
912 | } |
---|
913 | else { |
---|
914 | if ( _cnt740>=1 ) { break _loop740; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
915 | } |
---|
916 | |
---|
917 | _cnt740++; |
---|
918 | } while (true); |
---|
919 | } |
---|
920 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
921 | _token = makeToken(_ttype); |
---|
922 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
923 | } |
---|
924 | _returnToken = _token; |
---|
925 | } |
---|
926 | |
---|
927 | protected final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
928 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
929 | _ttype = ID; |
---|
930 | int _saveIndex; |
---|
931 | |
---|
932 | { |
---|
933 | switch ( LA(1)) { |
---|
934 | case 'a': case 'b': case 'c': case 'd': |
---|
935 | case 'e': case 'f': case 'g': case 'h': |
---|
936 | case 'i': case 'j': case 'k': case 'l': |
---|
937 | case 'm': case 'n': case 'o': case 'p': |
---|
938 | case 'q': case 'r': case 's': case 't': |
---|
939 | case 'u': case 'v': case 'w': case 'x': |
---|
940 | case 'y': case 'z': |
---|
941 | { |
---|
942 | matchRange('a','z'); |
---|
943 | break; |
---|
944 | } |
---|
945 | case 'A': case 'B': case 'C': case 'D': |
---|
946 | case 'E': case 'F': case 'G': case 'H': |
---|
947 | case 'I': case 'J': case 'K': case 'L': |
---|
948 | case 'M': case 'N': case 'O': case 'P': |
---|
949 | case 'Q': case 'R': case 'S': case 'T': |
---|
950 | case 'U': case 'V': case 'W': case 'X': |
---|
951 | case 'Y': case 'Z': |
---|
952 | { |
---|
953 | matchRange('A','Z'); |
---|
954 | break; |
---|
955 | } |
---|
956 | case '_': |
---|
957 | { |
---|
958 | match('_'); |
---|
959 | break; |
---|
960 | } |
---|
961 | default: |
---|
962 | { |
---|
963 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
964 | } |
---|
965 | } |
---|
966 | } |
---|
967 | { |
---|
968 | _loop706: |
---|
969 | do { |
---|
970 | if ((_tokenSet_9.member(LA(1))) && (true) && (true)) { |
---|
971 | { |
---|
972 | switch ( LA(1)) { |
---|
973 | case 'a': case 'b': case 'c': case 'd': |
---|
974 | case 'e': case 'f': case 'g': case 'h': |
---|
975 | case 'i': case 'j': case 'k': case 'l': |
---|
976 | case 'm': case 'n': case 'o': case 'p': |
---|
977 | case 'q': case 'r': case 's': case 't': |
---|
978 | case 'u': case 'v': case 'w': case 'x': |
---|
979 | case 'y': case 'z': |
---|
980 | { |
---|
981 | matchRange('a','z'); |
---|
982 | break; |
---|
983 | } |
---|
984 | case 'A': case 'B': case 'C': case 'D': |
---|
985 | case 'E': case 'F': case 'G': case 'H': |
---|
986 | case 'I': case 'J': case 'K': case 'L': |
---|
987 | case 'M': case 'N': case 'O': case 'P': |
---|
988 | case 'Q': case 'R': case 'S': case 'T': |
---|
989 | case 'U': case 'V': case 'W': case 'X': |
---|
990 | case 'Y': case 'Z': |
---|
991 | { |
---|
992 | matchRange('A','Z'); |
---|
993 | break; |
---|
994 | } |
---|
995 | case '0': case '1': case '2': case '3': |
---|
996 | case '4': case '5': case '6': case '7': |
---|
997 | case '8': case '9': |
---|
998 | { |
---|
999 | matchRange('0','9'); |
---|
1000 | break; |
---|
1001 | } |
---|
1002 | case '_': |
---|
1003 | { |
---|
1004 | match('_'); |
---|
1005 | break; |
---|
1006 | } |
---|
1007 | default: |
---|
1008 | { |
---|
1009 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1010 | } |
---|
1011 | } |
---|
1012 | } |
---|
1013 | } |
---|
1014 | else { |
---|
1015 | break _loop706; |
---|
1016 | } |
---|
1017 | |
---|
1018 | } while (true); |
---|
1019 | } |
---|
1020 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1021 | _token = makeToken(_ttype); |
---|
1022 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1023 | } |
---|
1024 | _returnToken = _token; |
---|
1025 | } |
---|
1026 | |
---|
1027 | protected final void mVAR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1028 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1029 | _ttype = VAR_ASSIGN; |
---|
1030 | int _saveIndex; |
---|
1031 | |
---|
1032 | match('='); |
---|
1033 | |
---|
1034 | // inform the code generator that an assignment was done to |
---|
1035 | // AST root for the rule if invoker set refRuleRoot. |
---|
1036 | if ( LA(1)!='=' && transInfo!=null && transInfo.refRuleRoot!=null ) { |
---|
1037 | transInfo.assignToRoot=true; |
---|
1038 | } |
---|
1039 | |
---|
1040 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1041 | _token = makeToken(_ttype); |
---|
1042 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1043 | } |
---|
1044 | _returnToken = _token; |
---|
1045 | } |
---|
1046 | |
---|
1047 | protected final void mAST_CONSTRUCTOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1048 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1049 | _ttype = AST_CONSTRUCTOR; |
---|
1050 | int _saveIndex; |
---|
1051 | Token x=null; |
---|
1052 | Token y=null; |
---|
1053 | Token z=null; |
---|
1054 | |
---|
1055 | _saveIndex=text.length(); |
---|
1056 | match('['); |
---|
1057 | text.setLength(_saveIndex); |
---|
1058 | { |
---|
1059 | switch ( LA(1)) { |
---|
1060 | case '\t': case '\n': case '\r': case ' ': |
---|
1061 | { |
---|
1062 | _saveIndex=text.length(); |
---|
1063 | mWS(false); |
---|
1064 | text.setLength(_saveIndex); |
---|
1065 | break; |
---|
1066 | } |
---|
1067 | case '"': case '#': case '(': case '0': |
---|
1068 | case '1': case '2': case '3': case '4': |
---|
1069 | case '5': case '6': case '7': case '8': |
---|
1070 | case '9': case 'A': case 'B': case 'C': |
---|
1071 | case 'D': case 'E': case 'F': case 'G': |
---|
1072 | case 'H': case 'I': case 'J': case 'K': |
---|
1073 | case 'L': case 'M': case 'N': case 'O': |
---|
1074 | case 'P': case 'Q': case 'R': case 'S': |
---|
1075 | case 'T': case 'U': case 'V': case 'W': |
---|
1076 | case 'X': case 'Y': case 'Z': case '[': |
---|
1077 | case '_': case 'a': case 'b': case 'c': |
---|
1078 | case 'd': case 'e': case 'f': case 'g': |
---|
1079 | case 'h': case 'i': case 'j': case 'k': |
---|
1080 | case 'l': case 'm': case 'n': case 'o': |
---|
1081 | case 'p': case 'q': case 'r': case 's': |
---|
1082 | case 't': case 'u': case 'v': case 'w': |
---|
1083 | case 'x': case 'y': case 'z': |
---|
1084 | { |
---|
1085 | break; |
---|
1086 | } |
---|
1087 | default: |
---|
1088 | { |
---|
1089 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1090 | } |
---|
1091 | } |
---|
1092 | } |
---|
1093 | _saveIndex=text.length(); |
---|
1094 | mAST_CTOR_ELEMENT(true); |
---|
1095 | text.setLength(_saveIndex); |
---|
1096 | x=_returnToken; |
---|
1097 | { |
---|
1098 | switch ( LA(1)) { |
---|
1099 | case '\t': case '\n': case '\r': case ' ': |
---|
1100 | { |
---|
1101 | _saveIndex=text.length(); |
---|
1102 | mWS(false); |
---|
1103 | text.setLength(_saveIndex); |
---|
1104 | break; |
---|
1105 | } |
---|
1106 | case ',': case ']': |
---|
1107 | { |
---|
1108 | break; |
---|
1109 | } |
---|
1110 | default: |
---|
1111 | { |
---|
1112 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1113 | } |
---|
1114 | } |
---|
1115 | } |
---|
1116 | { |
---|
1117 | if ((LA(1)==',') && (_tokenSet_10.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
1118 | _saveIndex=text.length(); |
---|
1119 | match(','); |
---|
1120 | text.setLength(_saveIndex); |
---|
1121 | { |
---|
1122 | switch ( LA(1)) { |
---|
1123 | case '\t': case '\n': case '\r': case ' ': |
---|
1124 | { |
---|
1125 | _saveIndex=text.length(); |
---|
1126 | mWS(false); |
---|
1127 | text.setLength(_saveIndex); |
---|
1128 | break; |
---|
1129 | } |
---|
1130 | case '"': case '#': case '(': case '0': |
---|
1131 | case '1': case '2': case '3': case '4': |
---|
1132 | case '5': case '6': case '7': case '8': |
---|
1133 | case '9': case 'A': case 'B': case 'C': |
---|
1134 | case 'D': case 'E': case 'F': case 'G': |
---|
1135 | case 'H': case 'I': case 'J': case 'K': |
---|
1136 | case 'L': case 'M': case 'N': case 'O': |
---|
1137 | case 'P': case 'Q': case 'R': case 'S': |
---|
1138 | case 'T': case 'U': case 'V': case 'W': |
---|
1139 | case 'X': case 'Y': case 'Z': case '[': |
---|
1140 | case '_': case 'a': case 'b': case 'c': |
---|
1141 | case 'd': case 'e': case 'f': case 'g': |
---|
1142 | case 'h': case 'i': case 'j': case 'k': |
---|
1143 | case 'l': case 'm': case 'n': case 'o': |
---|
1144 | case 'p': case 'q': case 'r': case 's': |
---|
1145 | case 't': case 'u': case 'v': case 'w': |
---|
1146 | case 'x': case 'y': case 'z': |
---|
1147 | { |
---|
1148 | break; |
---|
1149 | } |
---|
1150 | default: |
---|
1151 | { |
---|
1152 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1153 | } |
---|
1154 | } |
---|
1155 | } |
---|
1156 | _saveIndex=text.length(); |
---|
1157 | mAST_CTOR_ELEMENT(true); |
---|
1158 | text.setLength(_saveIndex); |
---|
1159 | y=_returnToken; |
---|
1160 | { |
---|
1161 | switch ( LA(1)) { |
---|
1162 | case '\t': case '\n': case '\r': case ' ': |
---|
1163 | { |
---|
1164 | _saveIndex=text.length(); |
---|
1165 | mWS(false); |
---|
1166 | text.setLength(_saveIndex); |
---|
1167 | break; |
---|
1168 | } |
---|
1169 | case ',': case ']': |
---|
1170 | { |
---|
1171 | break; |
---|
1172 | } |
---|
1173 | default: |
---|
1174 | { |
---|
1175 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1176 | } |
---|
1177 | } |
---|
1178 | } |
---|
1179 | } |
---|
1180 | else if ((LA(1)==','||LA(1)==']') && (true) && (true)) { |
---|
1181 | } |
---|
1182 | else { |
---|
1183 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1184 | } |
---|
1185 | |
---|
1186 | } |
---|
1187 | { |
---|
1188 | switch ( LA(1)) { |
---|
1189 | case ',': |
---|
1190 | { |
---|
1191 | _saveIndex=text.length(); |
---|
1192 | match(','); |
---|
1193 | text.setLength(_saveIndex); |
---|
1194 | { |
---|
1195 | switch ( LA(1)) { |
---|
1196 | case '\t': case '\n': case '\r': case ' ': |
---|
1197 | { |
---|
1198 | _saveIndex=text.length(); |
---|
1199 | mWS(false); |
---|
1200 | text.setLength(_saveIndex); |
---|
1201 | break; |
---|
1202 | } |
---|
1203 | case '"': case '#': case '(': case '0': |
---|
1204 | case '1': case '2': case '3': case '4': |
---|
1205 | case '5': case '6': case '7': case '8': |
---|
1206 | case '9': case 'A': case 'B': case 'C': |
---|
1207 | case 'D': case 'E': case 'F': case 'G': |
---|
1208 | case 'H': case 'I': case 'J': case 'K': |
---|
1209 | case 'L': case 'M': case 'N': case 'O': |
---|
1210 | case 'P': case 'Q': case 'R': case 'S': |
---|
1211 | case 'T': case 'U': case 'V': case 'W': |
---|
1212 | case 'X': case 'Y': case 'Z': case '[': |
---|
1213 | case '_': case 'a': case 'b': case 'c': |
---|
1214 | case 'd': case 'e': case 'f': case 'g': |
---|
1215 | case 'h': case 'i': case 'j': case 'k': |
---|
1216 | case 'l': case 'm': case 'n': case 'o': |
---|
1217 | case 'p': case 'q': case 'r': case 's': |
---|
1218 | case 't': case 'u': case 'v': case 'w': |
---|
1219 | case 'x': case 'y': case 'z': |
---|
1220 | { |
---|
1221 | break; |
---|
1222 | } |
---|
1223 | default: |
---|
1224 | { |
---|
1225 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1226 | } |
---|
1227 | } |
---|
1228 | } |
---|
1229 | _saveIndex=text.length(); |
---|
1230 | mAST_CTOR_ELEMENT(true); |
---|
1231 | text.setLength(_saveIndex); |
---|
1232 | z=_returnToken; |
---|
1233 | { |
---|
1234 | switch ( LA(1)) { |
---|
1235 | case '\t': case '\n': case '\r': case ' ': |
---|
1236 | { |
---|
1237 | _saveIndex=text.length(); |
---|
1238 | mWS(false); |
---|
1239 | text.setLength(_saveIndex); |
---|
1240 | break; |
---|
1241 | } |
---|
1242 | case ']': |
---|
1243 | { |
---|
1244 | break; |
---|
1245 | } |
---|
1246 | default: |
---|
1247 | { |
---|
1248 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1249 | } |
---|
1250 | } |
---|
1251 | } |
---|
1252 | break; |
---|
1253 | } |
---|
1254 | case ']': |
---|
1255 | { |
---|
1256 | break; |
---|
1257 | } |
---|
1258 | default: |
---|
1259 | { |
---|
1260 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1261 | } |
---|
1262 | } |
---|
1263 | } |
---|
1264 | _saveIndex=text.length(); |
---|
1265 | match(']'); |
---|
1266 | text.setLength(_saveIndex); |
---|
1267 | |
---|
1268 | String args = generator.processStringForASTConstructor(x.getText()); |
---|
1269 | |
---|
1270 | // the second does not need processing coz it's a string |
---|
1271 | // (eg second param of astFactory.create(x,y) |
---|
1272 | if ( y!=null ) |
---|
1273 | args += ","+y.getText(); |
---|
1274 | if ( z!=null ) |
---|
1275 | args += ","+z.getText(); |
---|
1276 | |
---|
1277 | text.setLength(_begin); text.append(generator.getASTCreateString(null,args)); |
---|
1278 | |
---|
1279 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1280 | _token = makeToken(_ttype); |
---|
1281 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1282 | } |
---|
1283 | _returnToken = _token; |
---|
1284 | } |
---|
1285 | |
---|
1286 | protected final void mTEXT_ARG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1287 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1288 | _ttype = TEXT_ARG; |
---|
1289 | int _saveIndex; |
---|
1290 | |
---|
1291 | { |
---|
1292 | switch ( LA(1)) { |
---|
1293 | case '\t': case '\n': case '\r': case ' ': |
---|
1294 | { |
---|
1295 | mWS(false); |
---|
1296 | break; |
---|
1297 | } |
---|
1298 | case '"': case '$': case '\'': case '+': |
---|
1299 | case '0': case '1': case '2': case '3': |
---|
1300 | case '4': case '5': case '6': case '7': |
---|
1301 | case '8': case '9': case 'A': case 'B': |
---|
1302 | case 'C': case 'D': case 'E': case 'F': |
---|
1303 | case 'G': case 'H': case 'I': case 'J': |
---|
1304 | case 'K': case 'L': case 'M': case 'N': |
---|
1305 | case 'O': case 'P': case 'Q': case 'R': |
---|
1306 | case 'S': case 'T': case 'U': case 'V': |
---|
1307 | case 'W': case 'X': case 'Y': case 'Z': |
---|
1308 | case '_': case 'a': case 'b': case 'c': |
---|
1309 | case 'd': case 'e': case 'f': case 'g': |
---|
1310 | case 'h': case 'i': case 'j': case 'k': |
---|
1311 | case 'l': case 'm': case 'n': case 'o': |
---|
1312 | case 'p': case 'q': case 'r': case 's': |
---|
1313 | case 't': case 'u': case 'v': case 'w': |
---|
1314 | case 'x': case 'y': case 'z': |
---|
1315 | { |
---|
1316 | break; |
---|
1317 | } |
---|
1318 | default: |
---|
1319 | { |
---|
1320 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1321 | } |
---|
1322 | } |
---|
1323 | } |
---|
1324 | { |
---|
1325 | int _cnt680=0; |
---|
1326 | _loop680: |
---|
1327 | do { |
---|
1328 | if ((_tokenSet_11.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
1329 | mTEXT_ARG_ELEMENT(false); |
---|
1330 | { |
---|
1331 | if ((_tokenSet_4.member(LA(1))) && (_tokenSet_12.member(LA(2))) && (true)) { |
---|
1332 | mWS(false); |
---|
1333 | } |
---|
1334 | else if ((_tokenSet_12.member(LA(1))) && (true) && (true)) { |
---|
1335 | } |
---|
1336 | else { |
---|
1337 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1338 | } |
---|
1339 | |
---|
1340 | } |
---|
1341 | } |
---|
1342 | else { |
---|
1343 | if ( _cnt680>=1 ) { break _loop680; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
1344 | } |
---|
1345 | |
---|
1346 | _cnt680++; |
---|
1347 | } while (true); |
---|
1348 | } |
---|
1349 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1350 | _token = makeToken(_ttype); |
---|
1351 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1352 | } |
---|
1353 | _returnToken = _token; |
---|
1354 | } |
---|
1355 | |
---|
1356 | protected final void mTREE_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1357 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1358 | _ttype = TREE_ELEMENT; |
---|
1359 | int _saveIndex; |
---|
1360 | Token id=null; |
---|
1361 | boolean was_mapped; |
---|
1362 | |
---|
1363 | switch ( LA(1)) { |
---|
1364 | case '(': |
---|
1365 | { |
---|
1366 | mTREE(false); |
---|
1367 | break; |
---|
1368 | } |
---|
1369 | case '[': |
---|
1370 | { |
---|
1371 | mAST_CONSTRUCTOR(false); |
---|
1372 | break; |
---|
1373 | } |
---|
1374 | case 'A': case 'B': case 'C': case 'D': |
---|
1375 | case 'E': case 'F': case 'G': case 'H': |
---|
1376 | case 'I': case 'J': case 'K': case 'L': |
---|
1377 | case 'M': case 'N': case 'O': case 'P': |
---|
1378 | case 'Q': case 'R': case 'S': case 'T': |
---|
1379 | case 'U': case 'V': case 'W': case 'X': |
---|
1380 | case 'Y': case 'Z': case '_': case 'a': |
---|
1381 | case 'b': case 'c': case 'd': case 'e': |
---|
1382 | case 'f': case 'g': case 'h': case 'i': |
---|
1383 | case 'j': case 'k': case 'l': case 'm': |
---|
1384 | case 'n': case 'o': case 'p': case 'q': |
---|
1385 | case 'r': case 's': case 't': case 'u': |
---|
1386 | case 'v': case 'w': case 'x': case 'y': |
---|
1387 | case 'z': |
---|
1388 | { |
---|
1389 | mID_ELEMENT(false); |
---|
1390 | break; |
---|
1391 | } |
---|
1392 | case '"': |
---|
1393 | { |
---|
1394 | mSTRING(false); |
---|
1395 | break; |
---|
1396 | } |
---|
1397 | default: |
---|
1398 | if ((LA(1)=='#') && (LA(2)=='(')) { |
---|
1399 | _saveIndex=text.length(); |
---|
1400 | match('#'); |
---|
1401 | text.setLength(_saveIndex); |
---|
1402 | mTREE(false); |
---|
1403 | } |
---|
1404 | else if ((LA(1)=='#') && (LA(2)=='[')) { |
---|
1405 | _saveIndex=text.length(); |
---|
1406 | match('#'); |
---|
1407 | text.setLength(_saveIndex); |
---|
1408 | mAST_CONSTRUCTOR(false); |
---|
1409 | } |
---|
1410 | else if ((LA(1)=='#') && (_tokenSet_13.member(LA(2)))) { |
---|
1411 | _saveIndex=text.length(); |
---|
1412 | match('#'); |
---|
1413 | text.setLength(_saveIndex); |
---|
1414 | was_mapped=mID_ELEMENT(true); |
---|
1415 | id=_returnToken; |
---|
1416 | // RK: I have a queer feeling that this maptreeid is redundant.. |
---|
1417 | if ( ! was_mapped ) |
---|
1418 | { |
---|
1419 | String t = generator.mapTreeId(id.getText(), null); |
---|
1420 | if ( t!=null ) { |
---|
1421 | text.setLength(_begin); text.append(t); |
---|
1422 | } |
---|
1423 | } |
---|
1424 | |
---|
1425 | } |
---|
1426 | else if ((LA(1)=='#') && (LA(2)=='#')) { |
---|
1427 | match("##"); |
---|
1428 | |
---|
1429 | if( currentRule != null ) |
---|
1430 | { |
---|
1431 | String t = currentRule.getRuleName()+"_AST"; |
---|
1432 | text.setLength(_begin); text.append(t); |
---|
1433 | } |
---|
1434 | else |
---|
1435 | { |
---|
1436 | reportError("\"##\" not valid in this context"); |
---|
1437 | text.setLength(_begin); text.append("##"); |
---|
1438 | } |
---|
1439 | |
---|
1440 | } |
---|
1441 | else { |
---|
1442 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1443 | } |
---|
1444 | } |
---|
1445 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1446 | _token = makeToken(_ttype); |
---|
1447 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1448 | } |
---|
1449 | _returnToken = _token; |
---|
1450 | } |
---|
1451 | |
---|
1452 | /** An ID_ELEMENT can be a func call, array ref, simple var, |
---|
1453 | * or AST label ref. |
---|
1454 | */ |
---|
1455 | protected final boolean mID_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1456 | boolean mapped=false; |
---|
1457 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1458 | _ttype = ID_ELEMENT; |
---|
1459 | int _saveIndex; |
---|
1460 | Token id=null; |
---|
1461 | |
---|
1462 | mID(true); |
---|
1463 | id=_returnToken; |
---|
1464 | { |
---|
1465 | if ((_tokenSet_4.member(LA(1))) && (_tokenSet_14.member(LA(2))) && (true)) { |
---|
1466 | _saveIndex=text.length(); |
---|
1467 | mWS(false); |
---|
1468 | text.setLength(_saveIndex); |
---|
1469 | } |
---|
1470 | else if ((_tokenSet_14.member(LA(1))) && (true) && (true)) { |
---|
1471 | } |
---|
1472 | else { |
---|
1473 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1474 | } |
---|
1475 | |
---|
1476 | } |
---|
1477 | { |
---|
1478 | switch ( LA(1)) { |
---|
1479 | case '(': |
---|
1480 | { |
---|
1481 | match('('); |
---|
1482 | { |
---|
1483 | if ((_tokenSet_4.member(LA(1))) && (_tokenSet_15.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
1484 | _saveIndex=text.length(); |
---|
1485 | mWS(false); |
---|
1486 | text.setLength(_saveIndex); |
---|
1487 | } |
---|
1488 | else if ((_tokenSet_15.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
1489 | } |
---|
1490 | else { |
---|
1491 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1492 | } |
---|
1493 | |
---|
1494 | } |
---|
1495 | { |
---|
1496 | switch ( LA(1)) { |
---|
1497 | case '"': case '#': case '\'': case '(': |
---|
1498 | case '0': case '1': case '2': case '3': |
---|
1499 | case '4': case '5': case '6': case '7': |
---|
1500 | case '8': case '9': case 'A': case 'B': |
---|
1501 | case 'C': case 'D': case 'E': case 'F': |
---|
1502 | case 'G': case 'H': case 'I': case 'J': |
---|
1503 | case 'K': case 'L': case 'M': case 'N': |
---|
1504 | case 'O': case 'P': case 'Q': case 'R': |
---|
1505 | case 'S': case 'T': case 'U': case 'V': |
---|
1506 | case 'W': case 'X': case 'Y': case 'Z': |
---|
1507 | case '[': case '_': case 'a': case 'b': |
---|
1508 | case 'c': case 'd': case 'e': case 'f': |
---|
1509 | case 'g': case 'h': case 'i': case 'j': |
---|
1510 | case 'k': case 'l': case 'm': case 'n': |
---|
1511 | case 'o': case 'p': case 'q': case 'r': |
---|
1512 | case 's': case 't': case 'u': case 'v': |
---|
1513 | case 'w': case 'x': case 'y': case 'z': |
---|
1514 | { |
---|
1515 | mARG(false); |
---|
1516 | { |
---|
1517 | _loop668: |
---|
1518 | do { |
---|
1519 | if ((LA(1)==',')) { |
---|
1520 | match(','); |
---|
1521 | { |
---|
1522 | switch ( LA(1)) { |
---|
1523 | case '\t': case '\n': case '\r': case ' ': |
---|
1524 | { |
---|
1525 | _saveIndex=text.length(); |
---|
1526 | mWS(false); |
---|
1527 | text.setLength(_saveIndex); |
---|
1528 | break; |
---|
1529 | } |
---|
1530 | case '"': case '#': case '\'': case '(': |
---|
1531 | case '0': case '1': case '2': case '3': |
---|
1532 | case '4': case '5': case '6': case '7': |
---|
1533 | case '8': case '9': case 'A': case 'B': |
---|
1534 | case 'C': case 'D': case 'E': case 'F': |
---|
1535 | case 'G': case 'H': case 'I': case 'J': |
---|
1536 | case 'K': case 'L': case 'M': case 'N': |
---|
1537 | case 'O': case 'P': case 'Q': case 'R': |
---|
1538 | case 'S': case 'T': case 'U': case 'V': |
---|
1539 | case 'W': case 'X': case 'Y': case 'Z': |
---|
1540 | case '[': case '_': case 'a': case 'b': |
---|
1541 | case 'c': case 'd': case 'e': case 'f': |
---|
1542 | case 'g': case 'h': case 'i': case 'j': |
---|
1543 | case 'k': case 'l': case 'm': case 'n': |
---|
1544 | case 'o': case 'p': case 'q': case 'r': |
---|
1545 | case 's': case 't': case 'u': case 'v': |
---|
1546 | case 'w': case 'x': case 'y': case 'z': |
---|
1547 | { |
---|
1548 | break; |
---|
1549 | } |
---|
1550 | default: |
---|
1551 | { |
---|
1552 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1553 | } |
---|
1554 | } |
---|
1555 | } |
---|
1556 | mARG(false); |
---|
1557 | } |
---|
1558 | else { |
---|
1559 | break _loop668; |
---|
1560 | } |
---|
1561 | |
---|
1562 | } while (true); |
---|
1563 | } |
---|
1564 | break; |
---|
1565 | } |
---|
1566 | case '\t': case '\n': case '\r': case ' ': |
---|
1567 | case ')': |
---|
1568 | { |
---|
1569 | break; |
---|
1570 | } |
---|
1571 | default: |
---|
1572 | { |
---|
1573 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1574 | } |
---|
1575 | } |
---|
1576 | } |
---|
1577 | { |
---|
1578 | switch ( LA(1)) { |
---|
1579 | case '\t': case '\n': case '\r': case ' ': |
---|
1580 | { |
---|
1581 | _saveIndex=text.length(); |
---|
1582 | mWS(false); |
---|
1583 | text.setLength(_saveIndex); |
---|
1584 | break; |
---|
1585 | } |
---|
1586 | case ')': |
---|
1587 | { |
---|
1588 | break; |
---|
1589 | } |
---|
1590 | default: |
---|
1591 | { |
---|
1592 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1593 | } |
---|
1594 | } |
---|
1595 | } |
---|
1596 | match(')'); |
---|
1597 | break; |
---|
1598 | } |
---|
1599 | case '[': |
---|
1600 | { |
---|
1601 | { |
---|
1602 | int _cnt673=0; |
---|
1603 | _loop673: |
---|
1604 | do { |
---|
1605 | if ((LA(1)=='[')) { |
---|
1606 | match('['); |
---|
1607 | { |
---|
1608 | switch ( LA(1)) { |
---|
1609 | case '\t': case '\n': case '\r': case ' ': |
---|
1610 | { |
---|
1611 | _saveIndex=text.length(); |
---|
1612 | mWS(false); |
---|
1613 | text.setLength(_saveIndex); |
---|
1614 | break; |
---|
1615 | } |
---|
1616 | case '"': case '#': case '\'': case '(': |
---|
1617 | case '0': case '1': case '2': case '3': |
---|
1618 | case '4': case '5': case '6': case '7': |
---|
1619 | case '8': case '9': case 'A': case 'B': |
---|
1620 | case 'C': case 'D': case 'E': case 'F': |
---|
1621 | case 'G': case 'H': case 'I': case 'J': |
---|
1622 | case 'K': case 'L': case 'M': case 'N': |
---|
1623 | case 'O': case 'P': case 'Q': case 'R': |
---|
1624 | case 'S': case 'T': case 'U': case 'V': |
---|
1625 | case 'W': case 'X': case 'Y': case 'Z': |
---|
1626 | case '[': case '_': case 'a': case 'b': |
---|
1627 | case 'c': case 'd': case 'e': case 'f': |
---|
1628 | case 'g': case 'h': case 'i': case 'j': |
---|
1629 | case 'k': case 'l': case 'm': case 'n': |
---|
1630 | case 'o': case 'p': case 'q': case 'r': |
---|
1631 | case 's': case 't': case 'u': case 'v': |
---|
1632 | case 'w': case 'x': case 'y': case 'z': |
---|
1633 | { |
---|
1634 | break; |
---|
1635 | } |
---|
1636 | default: |
---|
1637 | { |
---|
1638 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1639 | } |
---|
1640 | } |
---|
1641 | } |
---|
1642 | mARG(false); |
---|
1643 | { |
---|
1644 | switch ( LA(1)) { |
---|
1645 | case '\t': case '\n': case '\r': case ' ': |
---|
1646 | { |
---|
1647 | _saveIndex=text.length(); |
---|
1648 | mWS(false); |
---|
1649 | text.setLength(_saveIndex); |
---|
1650 | break; |
---|
1651 | } |
---|
1652 | case ']': |
---|
1653 | { |
---|
1654 | break; |
---|
1655 | } |
---|
1656 | default: |
---|
1657 | { |
---|
1658 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1659 | } |
---|
1660 | } |
---|
1661 | } |
---|
1662 | match(']'); |
---|
1663 | } |
---|
1664 | else { |
---|
1665 | if ( _cnt673>=1 ) { break _loop673; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
1666 | } |
---|
1667 | |
---|
1668 | _cnt673++; |
---|
1669 | } while (true); |
---|
1670 | } |
---|
1671 | break; |
---|
1672 | } |
---|
1673 | case '.': |
---|
1674 | { |
---|
1675 | match('.'); |
---|
1676 | mID_ELEMENT(false); |
---|
1677 | break; |
---|
1678 | } |
---|
1679 | default: |
---|
1680 | if ((LA(1)=='-') && (LA(2)=='>') && (_tokenSet_13.member(LA(3)))) { |
---|
1681 | match("->"); |
---|
1682 | mID_ELEMENT(false); |
---|
1683 | } |
---|
1684 | else if ((_tokenSet_16.member(LA(1))) && (true) && (true)) { |
---|
1685 | |
---|
1686 | mapped = true; |
---|
1687 | String t = generator.mapTreeId(id.getText(), transInfo); |
---|
1688 | // System.out.println("mapped: "+id.getText()+" -> "+t); |
---|
1689 | if ( t!=null ) { |
---|
1690 | text.setLength(_begin); text.append(t); |
---|
1691 | } |
---|
1692 | |
---|
1693 | { |
---|
1694 | if (((_tokenSet_17.member(LA(1))) && (_tokenSet_16.member(LA(2))) && (true))&&(transInfo!=null && transInfo.refRuleRoot!=null)) { |
---|
1695 | { |
---|
1696 | switch ( LA(1)) { |
---|
1697 | case '\t': case '\n': case '\r': case ' ': |
---|
1698 | { |
---|
1699 | mWS(false); |
---|
1700 | break; |
---|
1701 | } |
---|
1702 | case '=': |
---|
1703 | { |
---|
1704 | break; |
---|
1705 | } |
---|
1706 | default: |
---|
1707 | { |
---|
1708 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1709 | } |
---|
1710 | } |
---|
1711 | } |
---|
1712 | mVAR_ASSIGN(false); |
---|
1713 | } |
---|
1714 | else if ((_tokenSet_18.member(LA(1))) && (true) && (true)) { |
---|
1715 | } |
---|
1716 | else { |
---|
1717 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1718 | } |
---|
1719 | |
---|
1720 | } |
---|
1721 | } |
---|
1722 | else { |
---|
1723 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1724 | } |
---|
1725 | } |
---|
1726 | } |
---|
1727 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1728 | _token = makeToken(_ttype); |
---|
1729 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1730 | } |
---|
1731 | _returnToken = _token; |
---|
1732 | return mapped; |
---|
1733 | } |
---|
1734 | |
---|
1735 | /** The arguments of a #[...] constructor are text, token type, |
---|
1736 | * or a tree. |
---|
1737 | */ |
---|
1738 | protected final void mAST_CTOR_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1739 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1740 | _ttype = AST_CTOR_ELEMENT; |
---|
1741 | int _saveIndex; |
---|
1742 | |
---|
1743 | if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
1744 | mSTRING(false); |
---|
1745 | } |
---|
1746 | else if ((_tokenSet_19.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
1747 | mTREE_ELEMENT(false); |
---|
1748 | } |
---|
1749 | else if (((LA(1) >= '0' && LA(1) <= '9'))) { |
---|
1750 | mINT(false); |
---|
1751 | } |
---|
1752 | else { |
---|
1753 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1754 | } |
---|
1755 | |
---|
1756 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1757 | _token = makeToken(_ttype); |
---|
1758 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1759 | } |
---|
1760 | _returnToken = _token; |
---|
1761 | } |
---|
1762 | |
---|
1763 | protected final void mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1764 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1765 | _ttype = INT; |
---|
1766 | int _saveIndex; |
---|
1767 | |
---|
1768 | { |
---|
1769 | int _cnt731=0; |
---|
1770 | _loop731: |
---|
1771 | do { |
---|
1772 | if (((LA(1) >= '0' && LA(1) <= '9'))) { |
---|
1773 | mDIGIT(false); |
---|
1774 | } |
---|
1775 | else { |
---|
1776 | if ( _cnt731>=1 ) { break _loop731; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
1777 | } |
---|
1778 | |
---|
1779 | _cnt731++; |
---|
1780 | } while (true); |
---|
1781 | } |
---|
1782 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1783 | _token = makeToken(_ttype); |
---|
1784 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1785 | } |
---|
1786 | _returnToken = _token; |
---|
1787 | } |
---|
1788 | |
---|
1789 | protected final void mARG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1790 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1791 | _ttype = ARG; |
---|
1792 | int _saveIndex; |
---|
1793 | |
---|
1794 | { |
---|
1795 | switch ( LA(1)) { |
---|
1796 | case '\'': |
---|
1797 | { |
---|
1798 | mCHAR(false); |
---|
1799 | break; |
---|
1800 | } |
---|
1801 | case '0': case '1': case '2': case '3': |
---|
1802 | case '4': case '5': case '6': case '7': |
---|
1803 | case '8': case '9': |
---|
1804 | { |
---|
1805 | mINT_OR_FLOAT(false); |
---|
1806 | break; |
---|
1807 | } |
---|
1808 | default: |
---|
1809 | if ((_tokenSet_19.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
1810 | mTREE_ELEMENT(false); |
---|
1811 | } |
---|
1812 | else if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
1813 | mSTRING(false); |
---|
1814 | } |
---|
1815 | else { |
---|
1816 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1817 | } |
---|
1818 | } |
---|
1819 | } |
---|
1820 | { |
---|
1821 | _loop701: |
---|
1822 | do { |
---|
1823 | if ((_tokenSet_20.member(LA(1))) && (_tokenSet_21.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
1824 | { |
---|
1825 | switch ( LA(1)) { |
---|
1826 | case '\t': case '\n': case '\r': case ' ': |
---|
1827 | { |
---|
1828 | mWS(false); |
---|
1829 | break; |
---|
1830 | } |
---|
1831 | case '*': case '+': case '-': case '/': |
---|
1832 | { |
---|
1833 | break; |
---|
1834 | } |
---|
1835 | default: |
---|
1836 | { |
---|
1837 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1838 | } |
---|
1839 | } |
---|
1840 | } |
---|
1841 | { |
---|
1842 | switch ( LA(1)) { |
---|
1843 | case '+': |
---|
1844 | { |
---|
1845 | match('+'); |
---|
1846 | break; |
---|
1847 | } |
---|
1848 | case '-': |
---|
1849 | { |
---|
1850 | match('-'); |
---|
1851 | break; |
---|
1852 | } |
---|
1853 | case '*': |
---|
1854 | { |
---|
1855 | match('*'); |
---|
1856 | break; |
---|
1857 | } |
---|
1858 | case '/': |
---|
1859 | { |
---|
1860 | match('/'); |
---|
1861 | break; |
---|
1862 | } |
---|
1863 | default: |
---|
1864 | { |
---|
1865 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1866 | } |
---|
1867 | } |
---|
1868 | } |
---|
1869 | { |
---|
1870 | switch ( LA(1)) { |
---|
1871 | case '\t': case '\n': case '\r': case ' ': |
---|
1872 | { |
---|
1873 | mWS(false); |
---|
1874 | break; |
---|
1875 | } |
---|
1876 | case '"': case '#': case '\'': case '(': |
---|
1877 | case '0': case '1': case '2': case '3': |
---|
1878 | case '4': case '5': case '6': case '7': |
---|
1879 | case '8': case '9': case 'A': case 'B': |
---|
1880 | case 'C': case 'D': case 'E': case 'F': |
---|
1881 | case 'G': case 'H': case 'I': case 'J': |
---|
1882 | case 'K': case 'L': case 'M': case 'N': |
---|
1883 | case 'O': case 'P': case 'Q': case 'R': |
---|
1884 | case 'S': case 'T': case 'U': case 'V': |
---|
1885 | case 'W': case 'X': case 'Y': case 'Z': |
---|
1886 | case '[': case '_': case 'a': case 'b': |
---|
1887 | case 'c': case 'd': case 'e': case 'f': |
---|
1888 | case 'g': case 'h': case 'i': case 'j': |
---|
1889 | case 'k': case 'l': case 'm': case 'n': |
---|
1890 | case 'o': case 'p': case 'q': case 'r': |
---|
1891 | case 's': case 't': case 'u': case 'v': |
---|
1892 | case 'w': case 'x': case 'y': case 'z': |
---|
1893 | { |
---|
1894 | break; |
---|
1895 | } |
---|
1896 | default: |
---|
1897 | { |
---|
1898 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1899 | } |
---|
1900 | } |
---|
1901 | } |
---|
1902 | mARG(false); |
---|
1903 | } |
---|
1904 | else { |
---|
1905 | break _loop701; |
---|
1906 | } |
---|
1907 | |
---|
1908 | } while (true); |
---|
1909 | } |
---|
1910 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1911 | _token = makeToken(_ttype); |
---|
1912 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1913 | } |
---|
1914 | _returnToken = _token; |
---|
1915 | } |
---|
1916 | |
---|
1917 | protected final void mTEXT_ARG_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1918 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1919 | _ttype = TEXT_ARG_ELEMENT; |
---|
1920 | int _saveIndex; |
---|
1921 | |
---|
1922 | switch ( LA(1)) { |
---|
1923 | case 'A': case 'B': case 'C': case 'D': |
---|
1924 | case 'E': case 'F': case 'G': case 'H': |
---|
1925 | case 'I': case 'J': case 'K': case 'L': |
---|
1926 | case 'M': case 'N': case 'O': case 'P': |
---|
1927 | case 'Q': case 'R': case 'S': case 'T': |
---|
1928 | case 'U': case 'V': case 'W': case 'X': |
---|
1929 | case 'Y': case 'Z': case '_': case 'a': |
---|
1930 | case 'b': case 'c': case 'd': case 'e': |
---|
1931 | case 'f': case 'g': case 'h': case 'i': |
---|
1932 | case 'j': case 'k': case 'l': case 'm': |
---|
1933 | case 'n': case 'o': case 'p': case 'q': |
---|
1934 | case 'r': case 's': case 't': case 'u': |
---|
1935 | case 'v': case 'w': case 'x': case 'y': |
---|
1936 | case 'z': |
---|
1937 | { |
---|
1938 | mTEXT_ARG_ID_ELEMENT(false); |
---|
1939 | break; |
---|
1940 | } |
---|
1941 | case '"': |
---|
1942 | { |
---|
1943 | mSTRING(false); |
---|
1944 | break; |
---|
1945 | } |
---|
1946 | case '\'': |
---|
1947 | { |
---|
1948 | mCHAR(false); |
---|
1949 | break; |
---|
1950 | } |
---|
1951 | case '0': case '1': case '2': case '3': |
---|
1952 | case '4': case '5': case '6': case '7': |
---|
1953 | case '8': case '9': |
---|
1954 | { |
---|
1955 | mINT_OR_FLOAT(false); |
---|
1956 | break; |
---|
1957 | } |
---|
1958 | case '$': |
---|
1959 | { |
---|
1960 | mTEXT_ITEM(false); |
---|
1961 | break; |
---|
1962 | } |
---|
1963 | case '+': |
---|
1964 | { |
---|
1965 | match('+'); |
---|
1966 | break; |
---|
1967 | } |
---|
1968 | default: |
---|
1969 | { |
---|
1970 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1971 | } |
---|
1972 | } |
---|
1973 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
1974 | _token = makeToken(_ttype); |
---|
1975 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
1976 | } |
---|
1977 | _returnToken = _token; |
---|
1978 | } |
---|
1979 | |
---|
1980 | protected final void mTEXT_ARG_ID_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
1981 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
1982 | _ttype = TEXT_ARG_ID_ELEMENT; |
---|
1983 | int _saveIndex; |
---|
1984 | Token id=null; |
---|
1985 | |
---|
1986 | mID(true); |
---|
1987 | id=_returnToken; |
---|
1988 | { |
---|
1989 | if ((_tokenSet_4.member(LA(1))) && (_tokenSet_22.member(LA(2))) && (true)) { |
---|
1990 | _saveIndex=text.length(); |
---|
1991 | mWS(false); |
---|
1992 | text.setLength(_saveIndex); |
---|
1993 | } |
---|
1994 | else if ((_tokenSet_22.member(LA(1))) && (true) && (true)) { |
---|
1995 | } |
---|
1996 | else { |
---|
1997 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
1998 | } |
---|
1999 | |
---|
2000 | } |
---|
2001 | { |
---|
2002 | switch ( LA(1)) { |
---|
2003 | case '(': |
---|
2004 | { |
---|
2005 | match('('); |
---|
2006 | { |
---|
2007 | if ((_tokenSet_4.member(LA(1))) && (_tokenSet_23.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2008 | _saveIndex=text.length(); |
---|
2009 | mWS(false); |
---|
2010 | text.setLength(_saveIndex); |
---|
2011 | } |
---|
2012 | else if ((_tokenSet_23.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
2013 | } |
---|
2014 | else { |
---|
2015 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2016 | } |
---|
2017 | |
---|
2018 | } |
---|
2019 | { |
---|
2020 | _loop689: |
---|
2021 | do { |
---|
2022 | if ((_tokenSet_24.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2023 | mTEXT_ARG(false); |
---|
2024 | { |
---|
2025 | _loop688: |
---|
2026 | do { |
---|
2027 | if ((LA(1)==',')) { |
---|
2028 | match(','); |
---|
2029 | mTEXT_ARG(false); |
---|
2030 | } |
---|
2031 | else { |
---|
2032 | break _loop688; |
---|
2033 | } |
---|
2034 | |
---|
2035 | } while (true); |
---|
2036 | } |
---|
2037 | } |
---|
2038 | else { |
---|
2039 | break _loop689; |
---|
2040 | } |
---|
2041 | |
---|
2042 | } while (true); |
---|
2043 | } |
---|
2044 | { |
---|
2045 | switch ( LA(1)) { |
---|
2046 | case '\t': case '\n': case '\r': case ' ': |
---|
2047 | { |
---|
2048 | _saveIndex=text.length(); |
---|
2049 | mWS(false); |
---|
2050 | text.setLength(_saveIndex); |
---|
2051 | break; |
---|
2052 | } |
---|
2053 | case ')': |
---|
2054 | { |
---|
2055 | break; |
---|
2056 | } |
---|
2057 | default: |
---|
2058 | { |
---|
2059 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2060 | } |
---|
2061 | } |
---|
2062 | } |
---|
2063 | match(')'); |
---|
2064 | break; |
---|
2065 | } |
---|
2066 | case '[': |
---|
2067 | { |
---|
2068 | { |
---|
2069 | int _cnt694=0; |
---|
2070 | _loop694: |
---|
2071 | do { |
---|
2072 | if ((LA(1)=='[')) { |
---|
2073 | match('['); |
---|
2074 | { |
---|
2075 | if ((_tokenSet_4.member(LA(1))) && (_tokenSet_24.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2076 | _saveIndex=text.length(); |
---|
2077 | mWS(false); |
---|
2078 | text.setLength(_saveIndex); |
---|
2079 | } |
---|
2080 | else if ((_tokenSet_24.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2081 | } |
---|
2082 | else { |
---|
2083 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2084 | } |
---|
2085 | |
---|
2086 | } |
---|
2087 | mTEXT_ARG(false); |
---|
2088 | { |
---|
2089 | switch ( LA(1)) { |
---|
2090 | case '\t': case '\n': case '\r': case ' ': |
---|
2091 | { |
---|
2092 | _saveIndex=text.length(); |
---|
2093 | mWS(false); |
---|
2094 | text.setLength(_saveIndex); |
---|
2095 | break; |
---|
2096 | } |
---|
2097 | case ']': |
---|
2098 | { |
---|
2099 | break; |
---|
2100 | } |
---|
2101 | default: |
---|
2102 | { |
---|
2103 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2104 | } |
---|
2105 | } |
---|
2106 | } |
---|
2107 | match(']'); |
---|
2108 | } |
---|
2109 | else { |
---|
2110 | if ( _cnt694>=1 ) { break _loop694; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
2111 | } |
---|
2112 | |
---|
2113 | _cnt694++; |
---|
2114 | } while (true); |
---|
2115 | } |
---|
2116 | break; |
---|
2117 | } |
---|
2118 | case '.': |
---|
2119 | { |
---|
2120 | match('.'); |
---|
2121 | mTEXT_ARG_ID_ELEMENT(false); |
---|
2122 | break; |
---|
2123 | } |
---|
2124 | case '-': |
---|
2125 | { |
---|
2126 | match("->"); |
---|
2127 | mTEXT_ARG_ID_ELEMENT(false); |
---|
2128 | break; |
---|
2129 | } |
---|
2130 | case '\t': case '\n': case '\r': case ' ': |
---|
2131 | case '"': case '$': case '\'': case ')': |
---|
2132 | case '+': case ',': case '0': case '1': |
---|
2133 | case '2': case '3': case '4': case '5': |
---|
2134 | case '6': case '7': case '8': case '9': |
---|
2135 | case 'A': case 'B': case 'C': case 'D': |
---|
2136 | case 'E': case 'F': case 'G': case 'H': |
---|
2137 | case 'I': case 'J': case 'K': case 'L': |
---|
2138 | case 'M': case 'N': case 'O': case 'P': |
---|
2139 | case 'Q': case 'R': case 'S': case 'T': |
---|
2140 | case 'U': case 'V': case 'W': case 'X': |
---|
2141 | case 'Y': case 'Z': case ']': case '_': |
---|
2142 | case 'a': case 'b': case 'c': case 'd': |
---|
2143 | case 'e': case 'f': case 'g': case 'h': |
---|
2144 | case 'i': case 'j': case 'k': case 'l': |
---|
2145 | case 'm': case 'n': case 'o': case 'p': |
---|
2146 | case 'q': case 'r': case 's': case 't': |
---|
2147 | case 'u': case 'v': case 'w': case 'x': |
---|
2148 | case 'y': case 'z': |
---|
2149 | { |
---|
2150 | break; |
---|
2151 | } |
---|
2152 | default: |
---|
2153 | { |
---|
2154 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2155 | } |
---|
2156 | } |
---|
2157 | } |
---|
2158 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
2159 | _token = makeToken(_ttype); |
---|
2160 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
2161 | } |
---|
2162 | _returnToken = _token; |
---|
2163 | } |
---|
2164 | |
---|
2165 | protected final void mINT_OR_FLOAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
2166 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
2167 | _ttype = INT_OR_FLOAT; |
---|
2168 | int _saveIndex; |
---|
2169 | |
---|
2170 | { |
---|
2171 | int _cnt734=0; |
---|
2172 | _loop734: |
---|
2173 | do { |
---|
2174 | if (((LA(1) >= '0' && LA(1) <= '9')) && (_tokenSet_25.member(LA(2))) && (true)) { |
---|
2175 | mDIGIT(false); |
---|
2176 | } |
---|
2177 | else { |
---|
2178 | if ( _cnt734>=1 ) { break _loop734; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} |
---|
2179 | } |
---|
2180 | |
---|
2181 | _cnt734++; |
---|
2182 | } while (true); |
---|
2183 | } |
---|
2184 | { |
---|
2185 | if ((LA(1)=='L') && (_tokenSet_26.member(LA(2))) && (true)) { |
---|
2186 | match('L'); |
---|
2187 | } |
---|
2188 | else if ((LA(1)=='l') && (_tokenSet_26.member(LA(2))) && (true)) { |
---|
2189 | match('l'); |
---|
2190 | } |
---|
2191 | else if ((LA(1)=='.')) { |
---|
2192 | match('.'); |
---|
2193 | { |
---|
2194 | _loop737: |
---|
2195 | do { |
---|
2196 | if (((LA(1) >= '0' && LA(1) <= '9')) && (_tokenSet_26.member(LA(2))) && (true)) { |
---|
2197 | mDIGIT(false); |
---|
2198 | } |
---|
2199 | else { |
---|
2200 | break _loop737; |
---|
2201 | } |
---|
2202 | |
---|
2203 | } while (true); |
---|
2204 | } |
---|
2205 | } |
---|
2206 | else if ((_tokenSet_26.member(LA(1))) && (true) && (true)) { |
---|
2207 | } |
---|
2208 | else { |
---|
2209 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2210 | } |
---|
2211 | |
---|
2212 | } |
---|
2213 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
2214 | _token = makeToken(_ttype); |
---|
2215 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
2216 | } |
---|
2217 | _returnToken = _token; |
---|
2218 | } |
---|
2219 | |
---|
2220 | protected final void mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
2221 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
2222 | _ttype = SL_COMMENT; |
---|
2223 | int _saveIndex; |
---|
2224 | |
---|
2225 | match("//"); |
---|
2226 | { |
---|
2227 | _loop711: |
---|
2228 | do { |
---|
2229 | // nongreedy exit test |
---|
2230 | if ((LA(1)=='\n'||LA(1)=='\r') && (true) && (true)) break _loop711; |
---|
2231 | if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
2232 | matchNot(EOF_CHAR); |
---|
2233 | } |
---|
2234 | else { |
---|
2235 | break _loop711; |
---|
2236 | } |
---|
2237 | |
---|
2238 | } while (true); |
---|
2239 | } |
---|
2240 | { |
---|
2241 | if ((LA(1)=='\r') && (LA(2)=='\n') && (true)) { |
---|
2242 | match("\r\n"); |
---|
2243 | } |
---|
2244 | else if ((LA(1)=='\n')) { |
---|
2245 | match('\n'); |
---|
2246 | } |
---|
2247 | else if ((LA(1)=='\r') && (true) && (true)) { |
---|
2248 | match('\r'); |
---|
2249 | } |
---|
2250 | else { |
---|
2251 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2252 | } |
---|
2253 | |
---|
2254 | } |
---|
2255 | newline(); |
---|
2256 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
2257 | _token = makeToken(_ttype); |
---|
2258 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
2259 | } |
---|
2260 | _returnToken = _token; |
---|
2261 | } |
---|
2262 | |
---|
2263 | protected final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
2264 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
2265 | _ttype = ML_COMMENT; |
---|
2266 | int _saveIndex; |
---|
2267 | |
---|
2268 | match("/*"); |
---|
2269 | { |
---|
2270 | _loop715: |
---|
2271 | do { |
---|
2272 | // nongreedy exit test |
---|
2273 | if ((LA(1)=='*') && (LA(2)=='/') && (true)) break _loop715; |
---|
2274 | if ((LA(1)=='\r') && (LA(2)=='\n') && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2275 | match('\r'); |
---|
2276 | match('\n'); |
---|
2277 | newline(); |
---|
2278 | } |
---|
2279 | else if ((LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2280 | match('\r'); |
---|
2281 | newline(); |
---|
2282 | } |
---|
2283 | else if ((LA(1)=='\n') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2284 | match('\n'); |
---|
2285 | newline(); |
---|
2286 | } |
---|
2287 | else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { |
---|
2288 | matchNot(EOF_CHAR); |
---|
2289 | } |
---|
2290 | else { |
---|
2291 | break _loop715; |
---|
2292 | } |
---|
2293 | |
---|
2294 | } while (true); |
---|
2295 | } |
---|
2296 | match("*/"); |
---|
2297 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
2298 | _token = makeToken(_ttype); |
---|
2299 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
2300 | } |
---|
2301 | _returnToken = _token; |
---|
2302 | } |
---|
2303 | |
---|
2304 | protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
2305 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
2306 | _ttype = ESC; |
---|
2307 | int _saveIndex; |
---|
2308 | |
---|
2309 | match('\\'); |
---|
2310 | { |
---|
2311 | switch ( LA(1)) { |
---|
2312 | case 'n': |
---|
2313 | { |
---|
2314 | match('n'); |
---|
2315 | break; |
---|
2316 | } |
---|
2317 | case 'r': |
---|
2318 | { |
---|
2319 | match('r'); |
---|
2320 | break; |
---|
2321 | } |
---|
2322 | case 't': |
---|
2323 | { |
---|
2324 | match('t'); |
---|
2325 | break; |
---|
2326 | } |
---|
2327 | case 'b': |
---|
2328 | { |
---|
2329 | match('b'); |
---|
2330 | break; |
---|
2331 | } |
---|
2332 | case 'f': |
---|
2333 | { |
---|
2334 | match('f'); |
---|
2335 | break; |
---|
2336 | } |
---|
2337 | case '"': |
---|
2338 | { |
---|
2339 | match('"'); |
---|
2340 | break; |
---|
2341 | } |
---|
2342 | case '\'': |
---|
2343 | { |
---|
2344 | match('\''); |
---|
2345 | break; |
---|
2346 | } |
---|
2347 | case '\\': |
---|
2348 | { |
---|
2349 | match('\\'); |
---|
2350 | break; |
---|
2351 | } |
---|
2352 | case '0': case '1': case '2': case '3': |
---|
2353 | { |
---|
2354 | { |
---|
2355 | matchRange('0','3'); |
---|
2356 | } |
---|
2357 | { |
---|
2358 | if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
2359 | mDIGIT(false); |
---|
2360 | { |
---|
2361 | if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
2362 | mDIGIT(false); |
---|
2363 | } |
---|
2364 | else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { |
---|
2365 | } |
---|
2366 | else { |
---|
2367 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2368 | } |
---|
2369 | |
---|
2370 | } |
---|
2371 | } |
---|
2372 | else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { |
---|
2373 | } |
---|
2374 | else { |
---|
2375 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2376 | } |
---|
2377 | |
---|
2378 | } |
---|
2379 | break; |
---|
2380 | } |
---|
2381 | case '4': case '5': case '6': case '7': |
---|
2382 | { |
---|
2383 | { |
---|
2384 | matchRange('4','7'); |
---|
2385 | } |
---|
2386 | { |
---|
2387 | if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { |
---|
2388 | mDIGIT(false); |
---|
2389 | } |
---|
2390 | else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { |
---|
2391 | } |
---|
2392 | else { |
---|
2393 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2394 | } |
---|
2395 | |
---|
2396 | } |
---|
2397 | break; |
---|
2398 | } |
---|
2399 | default: |
---|
2400 | { |
---|
2401 | throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); |
---|
2402 | } |
---|
2403 | } |
---|
2404 | } |
---|
2405 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
2406 | _token = makeToken(_ttype); |
---|
2407 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
2408 | } |
---|
2409 | _returnToken = _token; |
---|
2410 | } |
---|
2411 | |
---|
2412 | protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { |
---|
2413 | int _ttype; Token _token=null; int _begin=text.length(); |
---|
2414 | _ttype = DIGIT; |
---|
2415 | int _saveIndex; |
---|
2416 | |
---|
2417 | matchRange('0','9'); |
---|
2418 | if ( _createToken && _token==null && _ttype!=Token.SKIP ) { |
---|
2419 | _token = makeToken(_ttype); |
---|
2420 | _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); |
---|
2421 | } |
---|
2422 | _returnToken = _token; |
---|
2423 | } |
---|
2424 | |
---|
2425 | |
---|
2426 | private static final long[] mk_tokenSet_0() { |
---|
2427 | long[] data = new long[8]; |
---|
2428 | data[0]=-103079215112L; |
---|
2429 | for (int i = 1; i<=3; i++) { data[i]=-1L; } |
---|
2430 | return data; |
---|
2431 | } |
---|
2432 | public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); |
---|
2433 | private static final long[] mk_tokenSet_1() { |
---|
2434 | long[] data = new long[8]; |
---|
2435 | data[0]=-145135534866440L; |
---|
2436 | for (int i = 1; i<=3; i++) { data[i]=-1L; } |
---|
2437 | return data; |
---|
2438 | } |
---|
2439 | public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); |
---|
2440 | private static final long[] mk_tokenSet_2() { |
---|
2441 | long[] data = new long[8]; |
---|
2442 | data[0]=-141407503262728L; |
---|
2443 | for (int i = 1; i<=3; i++) { data[i]=-1L; } |
---|
2444 | return data; |
---|
2445 | } |
---|
2446 | public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); |
---|
2447 | private static final long[] mk_tokenSet_3() { |
---|
2448 | long[] data = { 4294977024L, 576460745995190270L, 0L, 0L, 0L}; |
---|
2449 | return data; |
---|
2450 | } |
---|
2451 | public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); |
---|
2452 | private static final long[] mk_tokenSet_4() { |
---|
2453 | long[] data = { 4294977024L, 0L, 0L, 0L, 0L}; |
---|
2454 | return data; |
---|
2455 | } |
---|
2456 | public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); |
---|
2457 | private static final long[] mk_tokenSet_5() { |
---|
2458 | long[] data = { 1103806604800L, 0L, 0L, 0L, 0L}; |
---|
2459 | return data; |
---|
2460 | } |
---|
2461 | public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); |
---|
2462 | private static final long[] mk_tokenSet_6() { |
---|
2463 | long[] data = { 287959436729787904L, 576460745995190270L, 0L, 0L, 0L}; |
---|
2464 | return data; |
---|
2465 | } |
---|
2466 | public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); |
---|
2467 | private static final long[] mk_tokenSet_7() { |
---|
2468 | long[] data = new long[8]; |
---|
2469 | data[0]=-17179869192L; |
---|
2470 | data[1]=-268435457L; |
---|
2471 | for (int i = 2; i<=3; i++) { data[i]=-1L; } |
---|
2472 | return data; |
---|
2473 | } |
---|
2474 | public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7()); |
---|
2475 | private static final long[] mk_tokenSet_8() { |
---|
2476 | long[] data = new long[8]; |
---|
2477 | data[0]=-549755813896L; |
---|
2478 | data[1]=-268435457L; |
---|
2479 | for (int i = 2; i<=3; i++) { data[i]=-1L; } |
---|
2480 | return data; |
---|
2481 | } |
---|
2482 | public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8()); |
---|
2483 | private static final long[] mk_tokenSet_9() { |
---|
2484 | long[] data = { 287948901175001088L, 576460745995190270L, 0L, 0L, 0L}; |
---|
2485 | return data; |
---|
2486 | } |
---|
2487 | public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9()); |
---|
2488 | private static final long[] mk_tokenSet_10() { |
---|
2489 | long[] data = { 287950056521213440L, 576460746129407998L, 0L, 0L, 0L}; |
---|
2490 | return data; |
---|
2491 | } |
---|
2492 | public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10()); |
---|
2493 | private static final long[] mk_tokenSet_11() { |
---|
2494 | long[] data = { 287958332923183104L, 576460745995190270L, 0L, 0L, 0L}; |
---|
2495 | return data; |
---|
2496 | } |
---|
2497 | public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11()); |
---|
2498 | private static final long[] mk_tokenSet_12() { |
---|
2499 | long[] data = { 287978128427460096L, 576460746532061182L, 0L, 0L, 0L}; |
---|
2500 | return data; |
---|
2501 | } |
---|
2502 | public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12()); |
---|
2503 | private static final long[] mk_tokenSet_13() { |
---|
2504 | long[] data = { 0L, 576460745995190270L, 0L, 0L, 0L}; |
---|
2505 | return data; |
---|
2506 | } |
---|
2507 | public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13()); |
---|
2508 | private static final long[] mk_tokenSet_14() { |
---|
2509 | long[] data = { 2306123388973753856L, 671088640L, 0L, 0L, 0L}; |
---|
2510 | return data; |
---|
2511 | } |
---|
2512 | public static final BitSet _tokenSet_14 = new BitSet(mk_tokenSet_14()); |
---|
2513 | private static final long[] mk_tokenSet_15() { |
---|
2514 | long[] data = { 287952805300282880L, 576460746129407998L, 0L, 0L, 0L}; |
---|
2515 | return data; |
---|
2516 | } |
---|
2517 | public static final BitSet _tokenSet_15 = new BitSet(mk_tokenSet_15()); |
---|
2518 | private static final long[] mk_tokenSet_16() { |
---|
2519 | long[] data = { 2306051920717948416L, 536870912L, 0L, 0L, 0L}; |
---|
2520 | return data; |
---|
2521 | } |
---|
2522 | public static final BitSet _tokenSet_16 = new BitSet(mk_tokenSet_16()); |
---|
2523 | private static final long[] mk_tokenSet_17() { |
---|
2524 | long[] data = { 2305843013508670976L, 0L, 0L, 0L, 0L}; |
---|
2525 | return data; |
---|
2526 | } |
---|
2527 | public static final BitSet _tokenSet_17 = new BitSet(mk_tokenSet_17()); |
---|
2528 | private static final long[] mk_tokenSet_18() { |
---|
2529 | long[] data = { 208911504254464L, 536870912L, 0L, 0L, 0L}; |
---|
2530 | return data; |
---|
2531 | } |
---|
2532 | public static final BitSet _tokenSet_18 = new BitSet(mk_tokenSet_18()); |
---|
2533 | private static final long[] mk_tokenSet_19() { |
---|
2534 | long[] data = { 1151051235328L, 576460746129407998L, 0L, 0L, 0L}; |
---|
2535 | return data; |
---|
2536 | } |
---|
2537 | public static final BitSet _tokenSet_19 = new BitSet(mk_tokenSet_19()); |
---|
2538 | private static final long[] mk_tokenSet_20() { |
---|
2539 | long[] data = { 189120294954496L, 0L, 0L, 0L, 0L}; |
---|
2540 | return data; |
---|
2541 | } |
---|
2542 | public static final BitSet _tokenSet_20 = new BitSet(mk_tokenSet_20()); |
---|
2543 | private static final long[] mk_tokenSet_21() { |
---|
2544 | long[] data = { 288139722277004800L, 576460746129407998L, 0L, 0L, 0L}; |
---|
2545 | return data; |
---|
2546 | } |
---|
2547 | public static final BitSet _tokenSet_21 = new BitSet(mk_tokenSet_21()); |
---|
2548 | private static final long[] mk_tokenSet_22() { |
---|
2549 | long[] data = { 288084781055354368L, 576460746666278910L, 0L, 0L, 0L}; |
---|
2550 | return data; |
---|
2551 | } |
---|
2552 | public static final BitSet _tokenSet_22 = new BitSet(mk_tokenSet_22()); |
---|
2553 | private static final long[] mk_tokenSet_23() { |
---|
2554 | long[] data = { 287960536241415680L, 576460745995190270L, 0L, 0L, 0L}; |
---|
2555 | return data; |
---|
2556 | } |
---|
2557 | public static final BitSet _tokenSet_23 = new BitSet(mk_tokenSet_23()); |
---|
2558 | private static final long[] mk_tokenSet_24() { |
---|
2559 | long[] data = { 287958337218160128L, 576460745995190270L, 0L, 0L, 0L}; |
---|
2560 | return data; |
---|
2561 | } |
---|
2562 | public static final BitSet _tokenSet_24 = new BitSet(mk_tokenSet_24()); |
---|
2563 | private static final long[] mk_tokenSet_25() { |
---|
2564 | long[] data = { 288228817078593024L, 576460746532061182L, 0L, 0L, 0L}; |
---|
2565 | return data; |
---|
2566 | } |
---|
2567 | public static final BitSet _tokenSet_25 = new BitSet(mk_tokenSet_25()); |
---|
2568 | private static final long[] mk_tokenSet_26() { |
---|
2569 | long[] data = { 288158448334415360L, 576460746532061182L, 0L, 0L, 0L}; |
---|
2570 | return data; |
---|
2571 | } |
---|
2572 | public static final BitSet _tokenSet_26 = new BitSet(mk_tokenSet_26()); |
---|
2573 | |
---|
2574 | } |
---|