1 // $ANTLR 2.7.4: "langlexer.g" -> "AspectLanguageLexer.cs"$
3 // Generate header specific to lexer CSharp file
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
)
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;
120 int _ttype
= Token
.INVALID_TYPE
;
121 setCommitToPath(false);
123 try // for char stream error handling
125 try // for lexical error handling
132 theRetToken
= returnToken_
;
138 theRetToken
= returnToken_
;
144 theRetToken
= returnToken_
;
150 theRetToken
= returnToken_
;
156 theRetToken
= returnToken_
;
162 theRetToken
= returnToken_
;
168 theRetToken
= returnToken_
;
174 theRetToken
= returnToken_
;
180 theRetToken
= returnToken_
;
186 theRetToken
= returnToken_
;
192 theRetToken
= returnToken_
;
198 theRetToken
= returnToken_
;
201 case '0': case '1': case '2': case '3':
202 case '4': case '5': case '6': case '7':
206 theRetToken
= returnToken_
;
212 theRetToken
= returnToken_
;
217 mSTRING_LITERAL(true);
218 theRetToken
= returnToken_
;
221 case '\t': case '\n': case '\u000c': case '\r':
225 theRetToken
= returnToken_
;
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':
244 theRetToken
= returnToken_
;
249 if (LA(1)==EOF_CHAR
) { uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE); }
250 else { consume(); goto tryAgain; }
253 if ( null==returnToken_
) goto tryAgain
; // found SKIP token
254 _ttype
= returnToken_
.Type
;
255 returnToken_
.Type
= _ttype
;
258 catch (RecognitionException e
) {
259 if (!getCommitToPath())
264 throw new TokenStreamRecognitionException(e
);
267 catch (CharStreamException cse
) {
268 if ( cse
is CharStreamIOException
) {
269 throw new TokenStreamIOException(((CharStreamIOException
)cse
).io
);
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
441 if ((tokenSet_0_
.member(LA(1))))
449 goto _loop15_breakloop
;
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
;
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
;
487 if (((LA(1) >= '0' && LA(1) <= '9')))
493 if (_cnt19
>= 1) { goto _loop19_breakloop; }
else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
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
;
514 _saveIndex
= text
.Length
;
516 text
.Length
= _saveIndex
;
517 matchNot(EOF
/*_CHAR*/);
518 _saveIndex
= text
.Length
;
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
;
535 _saveIndex
= text
.Length
;
537 text
.Length
= _saveIndex
;
541 if ((LA(1)=='"') && (LA(2)=='"'))
544 _saveIndex
= text
.Length
;
546 text
.Length
= _saveIndex
;
548 else if ((tokenSet_1_
.member(LA(1)))) {
555 goto _loop24_breakloop
;
564 _saveIndex
= text
.Length
;
566 text
.Length
= _saveIndex
;
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
;
603 case '\n': case '\r':
606 if ((LA(1)=='\r') && (LA(2)=='\n'))
610 else if ((LA(1)=='\r') && (true)) {
613 else if ((LA(1)=='\n')) {
618 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
627 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
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
;
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':
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':
677 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
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':
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':
708 case '0': case '1': case '2': case '3':
709 case '4': case '5': case '6': case '7':
720 goto _loop32_breakloop
;
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}
;
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}
;
747 public static readonly BitSet tokenSet_1_
= new BitSet(mk_tokenSet_1_());