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