Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / AspectSharp / AspectSharp.Lang / AspectLanguageLexer.cs
blobbeaf2c8fa24eb15d09aa1600a07fdf8b53e48fbc
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 literals = new Hashtable(100, (float) 0.4, StringComparer.CurrentCulture);
94 literals.Add("assignableFrom", 18);
95 literals.Add("for", 5);
96 literals.Add("method", 14);
97 literals.Add("propertyread", 16);
98 literals.Add("aspect", 4);
99 literals.Add("interceptors", 11);
100 literals.Add("end", 7);
101 literals.Add("in", 6);
102 literals.Add("advice", 12);
103 literals.Add("customMatcher", 19);
104 literals.Add("propertywrite", 17);
105 literals.Add("pointcut", 13);
106 literals.Add("include", 10);
107 literals.Add("property", 15);
108 literals.Add("import", 8);
109 literals.Add("mixins", 9);
110 literals.Add("includes", 21);
111 literals.Add("excludes", 20);
114 override public IToken nextToken() //throws TokenStreamException
116 IToken theRetToken = null;
117 tryAgain:
118 for (;;)
120 int _ttype = Token.INVALID_TYPE;
121 setCommitToPath(false);
122 resetText();
123 try // for char stream error handling
125 try // for lexical error handling
127 switch ( LA(1) )
129 case '*':
131 mALL(true);
132 theRetToken = returnToken_;
133 break;
135 case ':':
137 mCOLON(true);
138 theRetToken = returnToken_;
139 break;
141 case ';':
143 mSEMI(true);
144 theRetToken = returnToken_;
145 break;
147 case ',':
149 mCOMMA(true);
150 theRetToken = returnToken_;
151 break;
153 case '|':
155 mOR(true);
156 theRetToken = returnToken_;
157 break;
159 case '<':
161 mINHERITS(true);
162 theRetToken = returnToken_;
163 break;
165 case '[':
167 mLBRACK(true);
168 theRetToken = returnToken_;
169 break;
171 case ']':
173 mRBRACK(true);
174 theRetToken = returnToken_;
175 break;
177 case '(':
179 mLCURLY(true);
180 theRetToken = returnToken_;
181 break;
183 case ')':
185 mRCURLY(true);
186 theRetToken = returnToken_;
187 break;
189 case '.':
191 mDOT(true);
192 theRetToken = returnToken_;
193 break;
195 case '/':
197 mCOMMENT(true);
198 theRetToken = returnToken_;
199 break;
201 case '0': case '1': case '2': case '3':
202 case '4': case '5': case '6': case '7':
203 case '8': case '9':
205 mINTLIT(true);
206 theRetToken = returnToken_;
207 break;
209 case '\'':
211 mCHARLIT(true);
212 theRetToken = returnToken_;
213 break;
215 case '"':
217 mSTRING_LITERAL(true);
218 theRetToken = returnToken_;
219 break;
221 case '\t': case '\n': case '\u000c': case '\r':
222 case ' ':
224 mWS(true);
225 theRetToken = returnToken_;
226 break;
228 case 'A': case 'B': case 'C': case 'D':
229 case 'E': case 'F': case 'G': case 'H':
230 case 'I': case 'J': case 'K': case 'L':
231 case 'M': case 'N': case 'O': case 'P':
232 case 'Q': case 'R': case 'S': case 'T':
233 case 'U': case 'V': case 'W': case 'X':
234 case 'Y': case 'Z': case 'a': case 'b':
235 case 'c': case 'd': case 'e': case 'f':
236 case 'g': case 'h': case 'i': case 'j':
237 case 'k': case 'l': case 'm': case 'n':
238 case 'o': case 'p': case 'q': case 'r':
239 case 's': case 't': case 'u': case 'v':
240 case 'w': case 'x': case 'y': case 'z':
241 case '_':
243 mID(true);
244 theRetToken = returnToken_;
245 break;
247 default:
249 if (LA(1)==EOF_CHAR) { uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE); }
250 else { consume(); goto tryAgain; }
252 break; }
253 if ( null==returnToken_ ) goto tryAgain; // found SKIP token
254 _ttype = returnToken_.Type;
255 returnToken_.Type = _ttype;
256 return returnToken_;
258 catch (RecognitionException e) {
259 if (!getCommitToPath())
261 consume();
262 goto tryAgain;
264 throw new TokenStreamRecognitionException(e);
267 catch (CharStreamException cse) {
268 if ( cse is CharStreamIOException ) {
269 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
271 else {
272 throw new TokenStreamException(cse.Message);
278 public void mALL(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
280 int _ttype; IToken _token=null; int _begin=text.Length;
281 _ttype = ALL;
283 match('*');
284 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
286 _token = makeToken(_ttype);
287 _token.setText(text.ToString(_begin, text.Length-_begin));
289 returnToken_ = _token;
292 public void mCOLON(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
294 int _ttype; IToken _token=null; int _begin=text.Length;
295 _ttype = COLON;
297 match(':');
298 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
300 _token = makeToken(_ttype);
301 _token.setText(text.ToString(_begin, text.Length-_begin));
303 returnToken_ = _token;
306 public void mSEMI(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
308 int _ttype; IToken _token=null; int _begin=text.Length;
309 _ttype = SEMI;
311 match(';');
312 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
314 _token = makeToken(_ttype);
315 _token.setText(text.ToString(_begin, text.Length-_begin));
317 returnToken_ = _token;
320 public void mCOMMA(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
322 int _ttype; IToken _token=null; int _begin=text.Length;
323 _ttype = COMMA;
325 match(',');
326 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
328 _token = makeToken(_ttype);
329 _token.setText(text.ToString(_begin, text.Length-_begin));
331 returnToken_ = _token;
334 public void mOR(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
336 int _ttype; IToken _token=null; int _begin=text.Length;
337 _ttype = OR;
339 match('|');
340 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
342 _token = makeToken(_ttype);
343 _token.setText(text.ToString(_begin, text.Length-_begin));
345 returnToken_ = _token;
348 public void mINHERITS(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
350 int _ttype; IToken _token=null; int _begin=text.Length;
351 _ttype = INHERITS;
353 match('<');
354 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
356 _token = makeToken(_ttype);
357 _token.setText(text.ToString(_begin, text.Length-_begin));
359 returnToken_ = _token;
362 public void mLBRACK(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
364 int _ttype; IToken _token=null; int _begin=text.Length;
365 _ttype = LBRACK;
367 match('[');
368 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
370 _token = makeToken(_ttype);
371 _token.setText(text.ToString(_begin, text.Length-_begin));
373 returnToken_ = _token;
376 public void mRBRACK(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
378 int _ttype; IToken _token=null; int _begin=text.Length;
379 _ttype = RBRACK;
381 match(']');
382 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
384 _token = makeToken(_ttype);
385 _token.setText(text.ToString(_begin, text.Length-_begin));
387 returnToken_ = _token;
390 public void mLCURLY(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
392 int _ttype; IToken _token=null; int _begin=text.Length;
393 _ttype = LCURLY;
395 match('(');
396 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
398 _token = makeToken(_ttype);
399 _token.setText(text.ToString(_begin, text.Length-_begin));
401 returnToken_ = _token;
404 public void mRCURLY(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
406 int _ttype; IToken _token=null; int _begin=text.Length;
407 _ttype = RCURLY;
409 match(')');
410 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
412 _token = makeToken(_ttype);
413 _token.setText(text.ToString(_begin, text.Length-_begin));
415 returnToken_ = _token;
418 public void mDOT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
420 int _ttype; IToken _token=null; int _begin=text.Length;
421 _ttype = DOT;
423 match('.');
424 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
426 _token = makeToken(_ttype);
427 _token.setText(text.ToString(_begin, text.Length-_begin));
429 returnToken_ = _token;
432 public void mCOMMENT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
434 int _ttype; IToken _token=null; int _begin=text.Length;
435 _ttype = COMMENT;
437 match("//");
438 { // ( ... )*
439 for (;;)
441 if ((tokenSet_0_.member(LA(1))))
444 match(tokenSet_0_);
447 else
449 goto _loop15_breakloop;
453 _loop15_breakloop: ;
454 } // ( ... )*
455 _ttype = Token.SKIP;
456 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
458 _token = makeToken(_ttype);
459 _token.setText(text.ToString(_begin, text.Length-_begin));
461 returnToken_ = _token;
464 protected void mDIGIT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
466 int _ttype; IToken _token=null; int _begin=text.Length;
467 _ttype = DIGIT;
469 matchRange('0','9');
470 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
472 _token = makeToken(_ttype);
473 _token.setText(text.ToString(_begin, text.Length-_begin));
475 returnToken_ = _token;
478 public void mINTLIT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
480 int _ttype; IToken _token=null; int _begin=text.Length;
481 _ttype = INTLIT;
483 { // ( ... )+
484 int _cnt19=0;
485 for (;;)
487 if (((LA(1) >= '0' && LA(1) <= '9')))
489 mDIGIT(false);
491 else
493 if (_cnt19 >= 1) { goto _loop19_breakloop; } else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
496 _cnt19++;
498 _loop19_breakloop: ;
499 } // ( ... )+
500 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
502 _token = makeToken(_ttype);
503 _token.setText(text.ToString(_begin, text.Length-_begin));
505 returnToken_ = _token;
508 public void mCHARLIT(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
510 int _ttype; IToken _token=null; int _begin=text.Length;
511 _ttype = CHARLIT;
513 int _saveIndex = 0;
514 _saveIndex = text.Length;
515 match('\'');
516 text.Length = _saveIndex;
517 matchNot(EOF/*_CHAR*/);
518 _saveIndex = text.Length;
519 match('\'');
520 text.Length = _saveIndex;
521 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
523 _token = makeToken(_ttype);
524 _token.setText(text.ToString(_begin, text.Length-_begin));
526 returnToken_ = _token;
529 public void mSTRING_LITERAL(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
531 int _ttype; IToken _token=null; int _begin=text.Length;
532 _ttype = STRING_LITERAL;
534 int _saveIndex = 0;
535 _saveIndex = text.Length;
536 match('"');
537 text.Length = _saveIndex;
538 { // ( ... )*
539 for (;;)
541 if ((LA(1)=='"') && (LA(2)=='"'))
543 match('"');
544 _saveIndex = text.Length;
545 match('"');
546 text.Length = _saveIndex;
548 else if ((tokenSet_1_.member(LA(1)))) {
550 match(tokenSet_1_);
553 else
555 goto _loop24_breakloop;
559 _loop24_breakloop: ;
560 } // ( ... )*
562 if ((LA(1)=='"'))
564 _saveIndex = text.Length;
565 match('"');
566 text.Length = _saveIndex;
568 else {
572 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
574 _token = makeToken(_ttype);
575 _token.setText(text.ToString(_begin, text.Length-_begin));
577 returnToken_ = _token;
580 public void mWS(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
582 int _ttype; IToken _token=null; int _begin=text.Length;
583 _ttype = WS;
586 switch ( LA(1) )
588 case ' ':
590 match(' ');
591 break;
593 case '\t':
595 match('\t');
596 break;
598 case '\u000c':
600 match('\f');
601 break;
603 case '\n': case '\r':
606 if ((LA(1)=='\r') && (LA(2)=='\n'))
608 match("\r\n");
610 else if ((LA(1)=='\r') && (true)) {
611 match('\r');
613 else if ((LA(1)=='\n')) {
614 match('\n');
616 else
618 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
622 newline();
623 break;
625 default:
627 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
631 _ttype = Token.SKIP;
632 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
634 _token = makeToken(_ttype);
635 _token.setText(text.ToString(_begin, text.Length-_begin));
637 returnToken_ = _token;
640 public void mID(bool _createToken) //throws RecognitionException, CharStreamException, TokenStreamException
642 int _ttype; IToken _token=null; int _begin=text.Length;
643 _ttype = ID;
646 switch ( LA(1) )
648 case 'a': case 'b': case 'c': case 'd':
649 case 'e': case 'f': case 'g': case 'h':
650 case 'i': case 'j': case 'k': case 'l':
651 case 'm': case 'n': case 'o': case 'p':
652 case 'q': case 'r': case 's': case 't':
653 case 'u': case 'v': case 'w': case 'x':
654 case 'y': case 'z':
656 matchRange('a','z');
657 break;
659 case 'A': case 'B': case 'C': case 'D':
660 case 'E': case 'F': case 'G': case 'H':
661 case 'I': case 'J': case 'K': case 'L':
662 case 'M': case 'N': case 'O': case 'P':
663 case 'Q': case 'R': case 'S': case 'T':
664 case 'U': case 'V': case 'W': case 'X':
665 case 'Y': case 'Z':
667 matchRange('A','Z');
668 break;
670 case '_':
672 match('_');
673 break;
675 default:
677 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
681 { // ( ... )*
682 for (;;)
684 switch ( LA(1) )
686 case 'a': case 'b': case 'c': case 'd':
687 case 'e': case 'f': case 'g': case 'h':
688 case 'i': case 'j': case 'k': case 'l':
689 case 'm': case 'n': case 'o': case 'p':
690 case 'q': case 'r': case 's': case 't':
691 case 'u': case 'v': case 'w': case 'x':
692 case 'y': case 'z':
694 matchRange('a','z');
695 break;
697 case 'A': case 'B': case 'C': case 'D':
698 case 'E': case 'F': case 'G': case 'H':
699 case 'I': case 'J': case 'K': case 'L':
700 case 'M': case 'N': case 'O': case 'P':
701 case 'Q': case 'R': case 'S': case 'T':
702 case 'U': case 'V': case 'W': case 'X':
703 case 'Y': case 'Z':
705 matchRange('A','Z');
706 break;
708 case '0': case '1': case '2': case '3':
709 case '4': case '5': case '6': case '7':
710 case '8': case '9':
712 matchRange('0','9');
713 break;
715 case '_': {
716 match('_');
717 break;
719 default: {
720 goto _loop32_breakloop;
724 _loop32_breakloop: ;
725 } // ( ... )*
726 _ttype = testLiteralsTable(_ttype);
727 if (_createToken && (null == _token) && (_ttype != Token.SKIP))
729 _token = makeToken(_ttype);
730 _token.setText(text.ToString(_begin, text.Length-_begin));
732 returnToken_ = _token;
736 private static long[] mk_tokenSet_0_()
738 long[] data = { 2305798500467610112L, 1729382249125642238L, 0L, 0L};
739 return data;
741 public static readonly BitSet tokenSet_0_ = new BitSet(mk_tokenSet_0_());
742 private static long[] mk_tokenSet_1_()
744 long[] data = { 2305798483287740928L, 1729382249125642238L, 0L, 0L};
745 return data;
747 public static readonly BitSet tokenSet_1_ = new BitSet(mk_tokenSet_1_());