AR-131 Applied patch Dave Godfrey
[castle.git] / AspectSharp / AspectSharp.Lang / AspectLanguageLexer.cs
blob813278cab754bfb6f1267b84fc2e02392ad79868
1 // $ANTLR 2.7.4: "langlexer.g" -> "AspectLanguageLexer.cs"$
3 // Generate header specific to lexer CSharp file
4 using System;
5 using antlr;
6 using Stream = System.IO.Stream;
7 using TextReader = System.IO.TextReader;
8 using Hashtable = System.Collections.Hashtable;
9 using Comparer = System.Collections.Comparer;
11 using TokenStreamException = antlr.TokenStreamException;
12 using TokenStreamIOException = antlr.TokenStreamIOException;
13 using TokenStreamRecognitionException = antlr.TokenStreamRecognitionException;
14 using CharStreamException = antlr.CharStreamException;
15 using CharStreamIOException = antlr.CharStreamIOException;
16 using ANTLRException = antlr.ANTLRException;
17 using CharScanner = antlr.CharScanner;
18 using InputBuffer = antlr.InputBuffer;
19 using ByteBuffer = antlr.ByteBuffer;
20 using CharBuffer = antlr.CharBuffer;
21 using Token = antlr.Token;
22 using CommonToken = antlr.CommonToken;
23 using SemanticException = antlr.SemanticException;
24 using RecognitionException = antlr.RecognitionException;
25 using NoViableAltForCharException = antlr.NoViableAltForCharException;
26 using MismatchedCharException = antlr.MismatchedCharException;
27 using TokenStream = antlr.TokenStream;
28 using LexerSharedInputState = antlr.LexerSharedInputState;
29 using BitSet = antlr.collections.impl.BitSet;
31 public class AspectLanguageLexer : antlr.CharScanner , TokenStream
33 public const int EOF = 1;
34 public const int NULL_TREE_LOOKAHEAD = 3;
35 public const int ASPECT = 4;
36 public const int FOR = 5;
37 public const int IN = 6;
38 public const int END = 7;
39 public const int IMPORT = 8;
40 public const int MIXINS = 9;
41 public const int INCLUDE = 10;
42 public const int INTERCEPTORS = 11;
43 public const int ADVICEINTERCEPTOR = 12;
44 public const int POINTCUT = 13;
45 public const int METHOD = 14;
46 public const int PROPERTY = 15;
47 public const int PROPERTY_READ = 16;
48 public const int PROPERTY_WRITE = 17;
49 public const int ASSIGNFROM = 18;
50 public const int CUSTOMMATCHER = 19;
51 public const int EXCLUDES = 20;
52 public const int INCLUDES = 21;
53 public const int EOS = 22;
54 public const int LBRACK = 23;
55 public const int SEMI = 24;
56 public const int RBRACK = 25;
57 public const int STRING_LITERAL = 26;
58 public const int COLON = 27;
59 public const int ID = 28;
60 public const int LCURLY = 29;
61 public const int RCURLY = 30;
62 public const int OR = 31;
63 public const int ALL = 32;
64 public const int COMMA = 33;
65 public const int DOT = 34;
66 public const int WS = 35;
67 public const int INHERITS = 36;
68 public const int COMMENT = 37;
69 public const int DIGIT = 38;
70 public const int INTLIT = 39;
71 public const int CHARLIT = 40;
73 public AspectLanguageLexer(Stream ins) : this(new ByteBuffer(ins))
77 public AspectLanguageLexer(TextReader r) : this(new CharBuffer(r))
81 public AspectLanguageLexer(InputBuffer ib) : this(new LexerSharedInputState(ib))
85 public AspectLanguageLexer(LexerSharedInputState state) : base(state)
87 initialize();
89 private void initialize()
91 caseSensitiveLiterals = true;
92 setCaseSensitive(true);
93 #if DOTNET2
94 literals = new Hashtable(100, (float) 0.4, StringComparer.CurrentCulture);
95 #else
96 literals = new Hashtable(100, (float) 0.4, null, Comparer.Default);
97 #endif
98 literals.Add("assignableFrom", 18);
99 literals.Add("for", 5);
100 literals.Add("method", 14);
101 literals.Add("propertyread", 16);
102 literals.Add("aspect", 4);
103 literals.Add("interceptors", 11);
104 literals.Add("end", 7);
105 literals.Add("in", 6);
106 literals.Add("advice", 12);
107 literals.Add("customMatcher", 19);
108 literals.Add("propertywrite", 17);
109 literals.Add("pointcut", 13);
110 literals.Add("include", 10);
111 literals.Add("property", 15);
112 literals.Add("import", 8);
113 literals.Add("mixins", 9);
114 literals.Add("includes", 21);
115 literals.Add("excludes", 20);
118 override public IToken nextToken() //throws TokenStreamException
120 IToken theRetToken = null;
121 tryAgain:
122 for (;;)
124 int _ttype = Token.INVALID_TYPE;
125 setCommitToPath(false);
126 resetText();
127 try // for char stream error handling
129 try // for lexical error handling
131 switch ( LA(1) )
133 case '*':
135 mALL(true);
136 theRetToken = returnToken_;
137 break;
139 case ':':
141 mCOLON(true);
142 theRetToken = returnToken_;
143 break;
145 case ';':
147 mSEMI(true);
148 theRetToken = returnToken_;
149 break;
151 case ',':
153 mCOMMA(true);
154 theRetToken = returnToken_;
155 break;
157 case '|':
159 mOR(true);
160 theRetToken = returnToken_;
161 break;
163 case '<':
165 mINHERITS(true);
166 theRetToken = returnToken_;
167 break;
169 case '[':
171 mLBRACK(true);
172 theRetToken = returnToken_;
173 break;
175 case ']':
177 mRBRACK(true);
178 theRetToken = returnToken_;
179 break;
181 case '(':
183 mLCURLY(true);
184 theRetToken = returnToken_;
185 break;
187 case ')':
189 mRCURLY(true);
190 theRetToken = returnToken_;
191 break;
193 case '.':
195 mDOT(true);
196 theRetToken = returnToken_;
197 break;
199 case '/':
201 mCOMMENT(true);
202 theRetToken = returnToken_;
203 break;
205 case '0': case '1': case '2': case '3':
206 case '4': case '5': case '6': case '7':
207 case '8': case '9':
209 mINTLIT(true);
210 theRetToken = returnToken_;
211 break;
213 case '\'':
215 mCHARLIT(true);
216 theRetToken = returnToken_;
217 break;
219 case '"':
221 mSTRING_LITERAL(true);
222 theRetToken = returnToken_;
223 break;
225 case '\t': case '\n': case '\u000c': case '\r':
226 case ' ':
228 mWS(true);
229 theRetToken = returnToken_;
230 break;
232 case 'A': case 'B': case 'C': case 'D':
233 case 'E': case 'F': case 'G': case 'H':
234 case 'I': case 'J': case 'K': case 'L':
235 case 'M': case 'N': case 'O': case 'P':
236 case 'Q': case 'R': case 'S': case 'T':
237 case 'U': case 'V': case 'W': case 'X':
238 case 'Y': case 'Z': case 'a': case 'b':
239 case 'c': case 'd': case 'e': case 'f':
240 case 'g': case 'h': case 'i': case 'j':
241 case 'k': case 'l': case 'm': case 'n':
242 case 'o': case 'p': case 'q': case 'r':
243 case 's': case 't': case 'u': case 'v':
244 case 'w': case 'x': case 'y': case 'z':
245 case '_':
247 mID(true);
248 theRetToken = returnToken_;
249 break;
251 default:
253 if (LA(1)==EOF_CHAR) { uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE); }
254 else { consume(); goto tryAgain; }
256 break; }
257 if ( null==returnToken_ ) goto tryAgain; // found SKIP token
258 _ttype = returnToken_.Type;
259 returnToken_.Type = _ttype;
260 return returnToken_;
262 catch (RecognitionException e) {
263 if (!getCommitToPath())
265 consume();
266 goto tryAgain;
268 throw new TokenStreamRecognitionException(e);
271 catch (CharStreamException cse) {
272 if ( cse is CharStreamIOException ) {
273 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
275 else {
276 throw new TokenStreamException(cse.Message);
282 public void mALL(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
284 int _ttype; IToken _token=null; int _begin=text.Length;
285 _ttype = ALL;
287 match('*');
288 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
290 _token = makeToken(_ttype);
291 _token.setText(text.ToString(_begin, text.Length-_begin));
293 returnToken_ = _token;
296 public void mCOLON(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
298 int _ttype; IToken _token=null; int _begin=text.Length;
299 _ttype = COLON;
301 match(':');
302 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
304 _token = makeToken(_ttype);
305 _token.setText(text.ToString(_begin, text.Length-_begin));
307 returnToken_ = _token;
310 public void mSEMI(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
312 int _ttype; IToken _token=null; int _begin=text.Length;
313 _ttype = SEMI;
315 match(';');
316 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
318 _token = makeToken(_ttype);
319 _token.setText(text.ToString(_begin, text.Length-_begin));
321 returnToken_ = _token;
324 public void mCOMMA(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
326 int _ttype; IToken _token=null; int _begin=text.Length;
327 _ttype = COMMA;
329 match(',');
330 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
332 _token = makeToken(_ttype);
333 _token.setText(text.ToString(_begin, text.Length-_begin));
335 returnToken_ = _token;
338 public void mOR(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
340 int _ttype; IToken _token=null; int _begin=text.Length;
341 _ttype = OR;
343 match('|');
344 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
346 _token = makeToken(_ttype);
347 _token.setText(text.ToString(_begin, text.Length-_begin));
349 returnToken_ = _token;
352 public void mINHERITS(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
354 int _ttype; IToken _token=null; int _begin=text.Length;
355 _ttype = INHERITS;
357 match('<');
358 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
360 _token = makeToken(_ttype);
361 _token.setText(text.ToString(_begin, text.Length-_begin));
363 returnToken_ = _token;
366 public void mLBRACK(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
368 int _ttype; IToken _token=null; int _begin=text.Length;
369 _ttype = LBRACK;
371 match('[');
372 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
374 _token = makeToken(_ttype);
375 _token.setText(text.ToString(_begin, text.Length-_begin));
377 returnToken_ = _token;
380 public void mRBRACK(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
382 int _ttype; IToken _token=null; int _begin=text.Length;
383 _ttype = RBRACK;
385 match(']');
386 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
388 _token = makeToken(_ttype);
389 _token.setText(text.ToString(_begin, text.Length-_begin));
391 returnToken_ = _token;
394 public void mLCURLY(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
396 int _ttype; IToken _token=null; int _begin=text.Length;
397 _ttype = LCURLY;
399 match('(');
400 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
402 _token = makeToken(_ttype);
403 _token.setText(text.ToString(_begin, text.Length-_begin));
405 returnToken_ = _token;
408 public void mRCURLY(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
410 int _ttype; IToken _token=null; int _begin=text.Length;
411 _ttype = RCURLY;
413 match(')');
414 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
416 _token = makeToken(_ttype);
417 _token.setText(text.ToString(_begin, text.Length-_begin));
419 returnToken_ = _token;
422 public void mDOT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
424 int _ttype; IToken _token=null; int _begin=text.Length;
425 _ttype = DOT;
427 match('.');
428 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
430 _token = makeToken(_ttype);
431 _token.setText(text.ToString(_begin, text.Length-_begin));
433 returnToken_ = _token;
436 public void mCOMMENT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
438 int _ttype; IToken _token=null; int _begin=text.Length;
439 _ttype = COMMENT;
441 match("//");
442 { // ( ... )*
443 for (;;)
445 if ((tokenSet_0_.member(LA(1))))
448 match(tokenSet_0_);
451 else
453 goto _loop15_breakloop;
457 _loop15_breakloop: ;
458 } // ( ... )*
459 _ttype = Token.SKIP;
460 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
462 _token = makeToken(_ttype);
463 _token.setText(text.ToString(_begin, text.Length-_begin));
465 returnToken_ = _token;
468 protected void mDIGIT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
470 int _ttype; IToken _token=null; int _begin=text.Length;
471 _ttype = DIGIT;
473 matchRange('0','9');
474 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
476 _token = makeToken(_ttype);
477 _token.setText(text.ToString(_begin, text.Length-_begin));
479 returnToken_ = _token;
482 public void mINTLIT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
484 int _ttype; IToken _token=null; int _begin=text.Length;
485 _ttype = INTLIT;
487 { // ( ... )+
488 int _cnt19=0;
489 for (;;)
491 if (((LA(1) >= '0' && LA(1) <= '9')))
493 mDIGIT(false);
495 else
497 if (_cnt19 >= 1) { goto _loop19_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
500 _cnt19++;
502 _loop19_breakloop: ;
503 } // ( ... )+
504 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
506 _token = makeToken(_ttype);
507 _token.setText(text.ToString(_begin, text.Length-_begin));
509 returnToken_ = _token;
512 public void mCHARLIT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
514 int _ttype; IToken _token=null; int _begin=text.Length;
515 _ttype = CHARLIT;
517 int _saveIndex = 0;
518 _saveIndex = text.Length;
519 match('\'');
520 text.Length = _saveIndex;
521 matchNot(EOF/*_CHAR*/);
522 _saveIndex = text.Length;
523 match('\'');
524 text.Length = _saveIndex;
525 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
527 _token = makeToken(_ttype);
528 _token.setText(text.ToString(_begin, text.Length-_begin));
530 returnToken_ = _token;
533 public void mSTRING_LITERAL(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
535 int _ttype; IToken _token=null; int _begin=text.Length;
536 _ttype = STRING_LITERAL;
538 int _saveIndex = 0;
539 _saveIndex = text.Length;
540 match('"');
541 text.Length = _saveIndex;
542 { // ( ... )*
543 for (;;)
545 if ((LA(1)=='"') && (LA(2)=='"'))
547 match('"');
548 _saveIndex = text.Length;
549 match('"');
550 text.Length = _saveIndex;
552 else if ((tokenSet_1_.member(LA(1)))) {
554 match(tokenSet_1_);
557 else
559 goto _loop24_breakloop;
563 _loop24_breakloop: ;
564 } // ( ... )*
566 if ((LA(1)=='"'))
568 _saveIndex = text.Length;
569 match('"');
570 text.Length = _saveIndex;
572 else {
576 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
578 _token = makeToken(_ttype);
579 _token.setText(text.ToString(_begin, text.Length-_begin));
581 returnToken_ = _token;
584 public void mWS(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
586 int _ttype; IToken _token=null; int _begin=text.Length;
587 _ttype = WS;
590 switch ( LA(1) )
592 case ' ':
594 match(' ');
595 break;
597 case '\t':
599 match('\t');
600 break;
602 case '\u000c':
604 match('\f');
605 break;
607 case '\n': case '\r':
610 if ((LA(1)=='\r') && (LA(2)=='\n'))
612 match("\r\n");
614 else if ((LA(1)=='\r') && (true)) {
615 match('\r');
617 else if ((LA(1)=='\n')) {
618 match('\n');
620 else
622 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
626 newline();
627 break;
629 default:
631 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
635 _ttype = Token.SKIP;
636 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
638 _token = makeToken(_ttype);
639 _token.setText(text.ToString(_begin, text.Length-_begin));
641 returnToken_ = _token;
644 public void mID(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
646 int _ttype; IToken _token=null; int _begin=text.Length;
647 _ttype = ID;
650 switch ( LA(1) )
652 case 'a': case 'b': case 'c': case 'd':
653 case 'e': case 'f': case 'g': case 'h':
654 case 'i': case 'j': case 'k': case 'l':
655 case 'm': case 'n': case 'o': case 'p':
656 case 'q': case 'r': case 's': case 't':
657 case 'u': case 'v': case 'w': case 'x':
658 case 'y': case 'z':
660 matchRange('a','z');
661 break;
663 case 'A': case 'B': case 'C': case 'D':
664 case 'E': case 'F': case 'G': case 'H':
665 case 'I': case 'J': case 'K': case 'L':
666 case 'M': case 'N': case 'O': case 'P':
667 case 'Q': case 'R': case 'S': case 'T':
668 case 'U': case 'V': case 'W': case 'X':
669 case 'Y': case 'Z':
671 matchRange('A','Z');
672 break;
674 case '_':
676 match('_');
677 break;
679 default:
681 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
685 { // ( ... )*
686 for (;;)
688 switch ( LA(1) )
690 case 'a': case 'b': case 'c': case 'd':
691 case 'e': case 'f': case 'g': case 'h':
692 case 'i': case 'j': case 'k': case 'l':
693 case 'm': case 'n': case 'o': case 'p':
694 case 'q': case 'r': case 's': case 't':
695 case 'u': case 'v': case 'w': case 'x':
696 case 'y': case 'z':
698 matchRange('a','z');
699 break;
701 case 'A': case 'B': case 'C': case 'D':
702 case 'E': case 'F': case 'G': case 'H':
703 case 'I': case 'J': case 'K': case 'L':
704 case 'M': case 'N': case 'O': case 'P':
705 case 'Q': case 'R': case 'S': case 'T':
706 case 'U': case 'V': case 'W': case 'X':
707 case 'Y': case 'Z':
709 matchRange('A','Z');
710 break;
712 case '0': case '1': case '2': case '3':
713 case '4': case '5': case '6': case '7':
714 case '8': case '9':
716 matchRange('0','9');
717 break;
719 case '_': {
720 match('_');
721 break;
723 default: {
724 goto _loop32_breakloop;
728 _loop32_breakloop: ;
729 } // ( ... )*
730 _ttype = testLiteralsTable(_ttype);
731 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
733 _token = makeToken(_ttype);
734 _token.setText(text.ToString(_begin, text.Length-_begin));
736 returnToken_ = _token;
740 private static long[] mk_tokenSet_0_()
742 long[] data = { 2305798500467610112L, 1729382249125642238L, 0L, 0L};
743 return data;
745 public static readonly BitSet tokenSet_0_ = new BitSet(mk_tokenSet_0_());
746 private static long[] mk_tokenSet_1_()
748 long[] data = { 2305798483287740928L, 1729382249125642238L, 0L, 0L};
749 return data;
751 public static readonly BitSet tokenSet_1_ = new BitSet(mk_tokenSet_1_());