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);
94 literals
= new Hashtable(100, (float) 0.4, StringComparer
.CurrentCulture
);
96 literals
= new Hashtable(100, (float) 0.4, null, Comparer
.Default
);
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;
124 int _ttype
= Token
.INVALID_TYPE
;
125 setCommitToPath(false);
127 try // for char stream error handling
129 try // for lexical error handling
136 theRetToken
= returnToken_
;
142 theRetToken
= returnToken_
;
148 theRetToken
= returnToken_
;
154 theRetToken
= returnToken_
;
160 theRetToken
= returnToken_
;
166 theRetToken
= returnToken_
;
172 theRetToken
= returnToken_
;
178 theRetToken
= returnToken_
;
184 theRetToken
= returnToken_
;
190 theRetToken
= returnToken_
;
196 theRetToken
= returnToken_
;
202 theRetToken
= returnToken_
;
205 case '0': case '1': case '2': case '3':
206 case '4': case '5': case '6': case '7':
210 theRetToken
= returnToken_
;
216 theRetToken
= returnToken_
;
221 mSTRING_LITERAL(true);
222 theRetToken
= returnToken_
;
225 case '\t': case '\n': case '\u000c': case '\r':
229 theRetToken
= returnToken_
;
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':
248 theRetToken
= returnToken_
;
253 if (LA(1)==EOF_CHAR
) { uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE); }
254 else { consume(); goto tryAgain; }
257 if ( null==returnToken_
) goto tryAgain
; // found SKIP token
258 _ttype
= returnToken_
.Type
;
259 returnToken_
.Type
= _ttype
;
262 catch (RecognitionException e
) {
263 if (!getCommitToPath())
268 throw new TokenStreamRecognitionException(e
);
271 catch (CharStreamException cse
) {
272 if ( cse
is CharStreamIOException
) {
273 throw new TokenStreamIOException(((CharStreamIOException
)cse
).io
);
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
445 if ((tokenSet_0_
.member(LA(1))))
453 goto _loop15_breakloop
;
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
;
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
;
491 if (((LA(1) >= '0' && LA(1) <= '9')))
497 if (_cnt19
>= 1) { goto _loop19_breakloop; }
else { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());; }
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
;
518 _saveIndex
= text
.Length
;
520 text
.Length
= _saveIndex
;
521 matchNot(EOF
/*_CHAR*/);
522 _saveIndex
= text
.Length
;
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
;
539 _saveIndex
= text
.Length
;
541 text
.Length
= _saveIndex
;
545 if ((LA(1)=='"') && (LA(2)=='"'))
548 _saveIndex
= text
.Length
;
550 text
.Length
= _saveIndex
;
552 else if ((tokenSet_1_
.member(LA(1)))) {
559 goto _loop24_breakloop
;
568 _saveIndex
= text
.Length
;
570 text
.Length
= _saveIndex
;
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
;
607 case '\n': case '\r':
610 if ((LA(1)=='\r') && (LA(2)=='\n'))
614 else if ((LA(1)=='\r') && (true)) {
617 else if ((LA(1)=='\n')) {
622 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
631 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
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
;
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':
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':
681 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
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':
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':
712 case '0': case '1': case '2': case '3':
713 case '4': case '5': case '6': case '7':
724 goto _loop32_breakloop
;
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}
;
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}
;
751 public static readonly BitSet tokenSet_1_
= new BitSet(mk_tokenSet_1_());