1 /* The following code was generated by JFlex 1.4.1 on 12.02.08 15:44 */
3 /* It's an automatically generated code. Do not modify it. */
4 package com
.intellij
.codeInsight
.template
.impl
;
6 import com
.intellij
.psi
.TokenType
;
7 import com
.intellij
.psi
.tree
.IElementType
;
8 import com
.intellij
.lexer
.FlexLexer
;
12 * This class is a scanner generated by
13 * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
14 * on 12.02.08 15:44 from the specification file
15 * <tt>C:/JetBrains/IDEA/tools/lexer/_MacroLexer.flex</tt>
17 class _MacroLexer
implements FlexLexer
{
18 /** initial size of the lookahead buffer */
19 private static final int ZZ_BUFFERSIZE
= 16384;
22 public static final int YYINITIAL
= 0;
25 * Translates characters to character classes
27 private static final String ZZ_CMAP_PACKED
=
28 "\11\2\1\3\1\6\1\0\1\3\1\6\16\2\4\0\1\3\1\0"+
29 "\1\4\1\0\1\1\3\0\1\7\1\10\2\0\1\11\3\0\12\2"+
30 "\3\0\1\12\3\0\32\1\1\0\1\5\2\0\1\1\1\0\32\1"+
31 "\4\0\41\2\2\0\4\1\4\0\1\1\2\0\1\2\7\0\1\1"+
32 "\4\0\1\1\5\0\27\1\1\0\37\1\1\0\u013f\1\31\0\162\1"+
33 "\4\0\14\1\16\0\5\1\11\0\1\1\21\0\130\2\5\0\23\2"+
34 "\12\0\1\1\13\0\1\1\1\0\3\1\1\0\1\1\1\0\24\1"+
35 "\1\0\54\1\1\0\46\1\1\0\5\1\4\0\202\1\1\0\4\2"+
36 "\3\0\105\1\1\0\46\1\2\0\2\1\6\0\20\1\41\0\46\1"+
37 "\2\0\1\1\7\0\47\1\11\0\21\2\1\0\27\2\1\0\3\2"+
38 "\1\0\1\2\1\0\2\2\1\0\1\2\13\0\33\1\5\0\3\1"+
39 "\15\0\4\2\14\0\6\2\13\0\32\1\5\0\13\1\16\2\7\0"+
40 "\12\2\4\0\2\1\1\2\143\1\1\0\1\1\10\2\1\0\6\2"+
41 "\2\1\2\2\1\0\4\2\2\1\12\2\3\1\2\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c\1\2\0\10\1\12\0\32\1\5\0\113\1\3\0\3\1"+
87 "\17\0\15\1\1\0\4\1\3\2\13\0\22\1\3\2\13\0\22\1"+
88 "\2\2\14\0\15\1\1\0\3\1\1\0\2\2\14\0\64\1\40\2"+
89 "\3\0\1\1\3\0\2\1\1\2\2\0\12\2\41\0\3\2\2\0"+
90 "\12\2\6\0\130\1\10\0\51\1\1\2\126\0\35\1\3\0\14\2"+
91 "\4\0\14\2\12\0\12\2\36\1\2\0\5\1\u038b\0\154\1\224\0"+
92 "\234\1\4\0\132\1\6\0\26\1\2\0\6\1\2\0\46\1\2\0"+
93 "\6\1\2\0\10\1\1\0\1\1\1\0\1\1\1\0\1\1\1\0"+
94 "\37\1\2\0\65\1\1\0\7\1\1\0\1\1\3\0\3\1\1\0"+
95 "\7\1\3\0\4\1\2\0\6\1\4\0\15\1\5\0\3\1\1\0"+
96 "\7\1\17\0\4\2\32\0\5\2\20\0\2\1\23\0\1\1\13\0"+
97 "\4\2\6\0\6\2\1\0\1\1\15\0\1\1\40\0\22\1\36\0"+
98 "\15\2\4\0\1\2\3\0\6\2\27\0\1\1\4\0\1\1\2\0"+
99 "\12\1\1\0\1\1\3\0\5\1\6\0\1\1\1\0\1\1\1\0"+
100 "\1\1\1\0\4\1\1\0\3\1\1\0\7\1\3\0\3\1\5\0"+
101 "\5\1\26\0\44\1\u0e81\0\3\1\31\0\11\1\6\2\1\0\5\1"+
102 "\2\0\5\1\4\0\126\1\2\0\2\2\2\0\3\1\1\0\137\1"+
103 "\5\0\50\1\4\0\136\1\21\0\30\1\70\0\20\1\u0200\0\u19b6\1"+
104 "\112\0\u51a6\1\132\0\u048d\1\u0773\0\u2ba4\1\u215c\0\u012e\1\2\0\73\1"+
105 "\225\0\7\1\14\0\5\1\5\0\1\1\1\2\12\1\1\0\15\1"+
106 "\1\0\5\1\1\0\1\1\1\0\2\1\1\0\2\1\1\0\154\1"+
107 "\41\0\u016b\1\22\0\100\1\2\0\66\1\50\0\15\1\3\0\20\2"+
108 "\20\0\4\2\17\0\2\1\30\0\3\1\31\0\1\1\6\0\5\1"+
109 "\1\0\207\1\2\0\1\2\4\0\1\1\13\0\12\2\7\0\32\1"+
110 "\4\0\1\1\1\0\32\1\12\0\132\1\3\0\6\1\2\0\6\1"+
111 "\2\0\6\1\2\0\3\1\3\0\2\1\3\0\2\1\22\0\3\2"+
115 * Translates characters to character classes
117 private static final char [] ZZ_CMAP
= zzUnpackCMap(ZZ_CMAP_PACKED
);
120 * Translates DFA states to action switch labels.
122 private static final int [] ZZ_ACTION
= zzUnpackAction();
124 private static final String ZZ_ACTION_PACKED_0
=
125 "\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+
128 private static int [] zzUnpackAction() {
129 int [] result
= new int[11];
131 offset
= zzUnpackAction(ZZ_ACTION_PACKED_0
, offset
, result
);
135 private static int zzUnpackAction(String packed
, int offset
, int [] result
) {
136 int i
= 0; /* index in packed string */
137 int j
= offset
; /* index in unpacked array */
138 int l
= packed
.length();
140 int count
= packed
.charAt(i
++);
141 int value
= packed
.charAt(i
++);
142 do result
[j
++] = value
; while (--count
> 0);
149 * Translates a state to a row index in the transition table
151 private static final int [] ZZ_ROWMAP
= zzUnpackRowMap();
153 private static final String ZZ_ROWMAP_PACKED_0
=
154 "\0\0\0\13\0\26\0\41\0\54\0\13\0\13\0\13"+
157 private static int [] zzUnpackRowMap() {
158 int [] result
= new int[11];
160 offset
= zzUnpackRowMap(ZZ_ROWMAP_PACKED_0
, offset
, result
);
164 private static int zzUnpackRowMap(String packed
, int offset
, int [] result
) {
165 int i
= 0; /* index in packed string */
166 int j
= offset
; /* index in unpacked array */
167 int l
= packed
.length();
169 int high
= packed
.charAt(i
++) << 16;
170 result
[j
++] = high
| packed
.charAt(i
++);
176 * The transition table of the DFA
178 private static final int [] ZZ_TRANS
= zzUnpackTrans();
180 private static final String ZZ_TRANS_PACKED_0
=
181 "\1\2\1\3\1\2\1\4\1\5\1\2\1\4\1\6"+
182 "\1\7\1\10\1\11\14\0\2\3\13\0\1\4\2\0"+
183 "\1\4\4\0\4\5\1\12\1\13\1\0\12\5\1\0"+
186 private static int [] zzUnpackTrans() {
187 int [] result
= new int[66];
189 offset
= zzUnpackTrans(ZZ_TRANS_PACKED_0
, offset
, result
);
193 private static int zzUnpackTrans(String packed
, int offset
, int [] result
) {
194 int i
= 0; /* index in packed string */
195 int j
= offset
; /* index in unpacked array */
196 int l
= packed
.length();
198 int count
= packed
.charAt(i
++);
199 int value
= packed
.charAt(i
++);
201 do result
[j
++] = value
; while (--count
> 0);
208 private static final int ZZ_UNKNOWN_ERROR
= 0;
209 private static final int ZZ_NO_MATCH
= 1;
210 private static final int ZZ_PUSHBACK_2BIG
= 2;
211 private static final char[] EMPTY_BUFFER
= new char[0];
212 private static final int YYEOF
= -1;
213 private static java
.io
.Reader zzReader
= null; // Fake
215 /* error messages for the codes above */
216 private static final String ZZ_ERROR_MSG
[] = {
217 "Unkown internal scanner error",
218 "Error: could not match input",
219 "Error: pushback value was too large"
223 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
225 private static final int [] ZZ_ATTRIBUTE
= zzUnpackAttribute();
227 private static final String ZZ_ATTRIBUTE_PACKED_0
=
228 "\1\0\1\11\3\1\5\11\1\1";
230 private static int [] zzUnpackAttribute() {
231 int [] result
= new int[11];
233 offset
= zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0
, offset
, result
);
237 private static int zzUnpackAttribute(String packed
, int offset
, int [] result
) {
238 int i
= 0; /* index in packed string */
239 int j
= offset
; /* index in unpacked array */
240 int l
= packed
.length();
242 int count
= packed
.charAt(i
++);
243 int value
= packed
.charAt(i
++);
244 do result
[j
++] = value
; while (--count
> 0);
249 /** the current state of the DFA */
252 /** the current lexical state */
253 private int zzLexicalState
= YYINITIAL
;
255 /** this buffer contains the current text to be matched and is
256 the source of the yytext() string */
257 private CharSequence zzBuffer
= "";
259 /** this buffer may contains the current text array to be matched when it is cheap to acquire it */
260 private char[] zzBufferArray
;
262 /** the textposition at the last accepting state */
263 private int zzMarkedPos
;
265 /** the textposition at the last state to be included in yytext */
266 private int zzPushbackPos
;
268 /** the current text position in the buffer */
269 private int zzCurrentPos
;
271 /** startRead marks the beginning of the yytext() string in the buffer */
272 private int zzStartRead
;
274 /** endRead marks the last character in the buffer, that has been read
276 private int zzEndRead
;
279 * zzAtBOL == true <=> the scanner is currently at the beginning of a line
281 private boolean zzAtBOL
= true;
283 /** zzAtEOF == true <=> the scanner is at the EOF */
284 private boolean zzAtEOF
;
286 /** denotes if the user-EOF-code has already been executed */
287 private boolean zzEOFDone
;
290 public _MacroLexer() {
291 this((java
.io
.Reader
)null);
295 _MacroLexer(java
.io
.Reader in
) {
300 * Creates a new scanner.
301 * There is also java.io.Reader version of this constructor.
303 * @param in the java.io.Inputstream to read input from.
305 _MacroLexer(java
.io
.InputStream in
) {
306 this(new java
.io
.InputStreamReader(in
));
310 * Unpacks the compressed character translation table.
312 * @param packed the packed character translation table
313 * @return the unpacked character translation table
315 private static char [] zzUnpackCMap(String packed
) {
316 char [] map
= new char[0x10000];
317 int i
= 0; /* index in packed string */
318 int j
= 0; /* index in unpacked array */
320 int count
= packed
.charAt(i
++);
321 char value
= packed
.charAt(i
++);
322 do map
[j
++] = value
; while (--count
> 0);
327 public final int getTokenStart(){
331 public final int getTokenEnd(){
332 return getTokenStart() + yylength();
335 public void reset(CharSequence buffer
, int start
, int end
,int initialState
){
337 zzBufferArray
= com
.intellij
.util
.text
.CharArrayUtil
.fromSequenceWithoutCopying(buffer
);
338 zzCurrentPos
= zzMarkedPos
= zzStartRead
= start
;
343 yybegin(initialState
);
346 // For Demetra compatibility
347 public void reset(CharSequence buffer
, int initialState
){
349 zzBufferArray
= null;
350 zzCurrentPos
= zzMarkedPos
= zzStartRead
= 0;
354 zzEndRead
= buffer
.length();
355 yybegin(initialState
);
359 * Refills the input buffer.
361 * @return <code>false</code>, iff there was new input.
363 * @exception java.io.IOException if any I/O-Error occurs
365 private boolean zzRefill() throws java
.io
.IOException
{
371 * Returns the current lexical state.
373 public final int yystate() {
374 return zzLexicalState
;
379 * Enters a new lexical state
381 * @param newState the new lexical state
383 public final void yybegin(int newState
) {
384 zzLexicalState
= newState
;
389 * Returns the text matched by the current regular expression.
391 public final CharSequence
yytext() {
392 return zzBuffer
.subSequence(zzStartRead
, zzMarkedPos
);
397 * Returns the character at position <tt>pos</tt> from the
400 * It is equivalent to yytext().charAt(pos), but faster
402 * @param pos the position of the character to fetch.
403 * A value from 0 to yylength()-1.
405 * @return the character at position pos
407 public final char yycharat(int pos
) {
408 return zzBufferArray
!= null ? zzBufferArray
[zzStartRead
+pos
]:zzBuffer
.charAt(zzStartRead
+pos
);
413 * Returns the length of the matched text region.
415 public final int yylength() {
416 return zzMarkedPos
-zzStartRead
;
421 * Reports an error that occured while scanning.
423 * In a wellformed scanner (no or only correct usage of
424 * yypushback(int) and a match-all fallback rule) this method
425 * will only be called with things that "Can't Possibly Happen".
426 * If this method is called, something is seriously wrong
427 * (e.g. a JFlex bug producing a faulty scanner etc.).
429 * Usual syntax/scanner level error handling should be done
430 * in error fallback rules.
432 * @param errorCode the code of the errormessage to display
434 private void zzScanError(int errorCode
) {
437 message
= ZZ_ERROR_MSG
[errorCode
];
439 catch (ArrayIndexOutOfBoundsException e
) {
440 message
= ZZ_ERROR_MSG
[ZZ_UNKNOWN_ERROR
];
443 throw new Error(message
);
448 * Pushes the specified amount of characters back into the input stream.
450 * They will be read again by then next call of the scanning method
452 * @param number the number of characters to be read again.
453 * This number must not be greater than yylength()!
455 public void yypushback(int number
) {
456 if ( number
> yylength() )
457 zzScanError(ZZ_PUSHBACK_2BIG
);
459 zzMarkedPos
-= number
;
464 * Contains user EOF-code, which will be executed exactly once,
465 * when the end of file is reached
467 private void zzDoEOF() {
476 * Resumes scanning until the next regular expression is matched,
477 * the end of input is encountered or an I/O-Error occurs.
479 * @return the next token
480 * @exception java.io.IOException if any I/O-Error occurs
482 public IElementType
advance() throws java
.io
.IOException
{
489 int zzEndReadL
= zzEndRead
;
490 CharSequence zzBufferL
= zzBuffer
;
491 char[] zzBufferArrayL
= zzBufferArray
;
492 char [] zzCMapL
= ZZ_CMAP
;
494 int [] zzTransL
= ZZ_TRANS
;
495 int [] zzRowMapL
= ZZ_ROWMAP
;
496 int [] zzAttrL
= ZZ_ATTRIBUTE
;
499 zzMarkedPosL
= zzMarkedPos
;
503 zzCurrentPosL
= zzCurrentPos
= zzStartRead
= zzMarkedPosL
;
505 zzState
= zzLexicalState
;
511 if (zzCurrentPosL
< zzEndReadL
)
512 zzInput
= zzBufferArrayL
!= null ? zzBufferArrayL
[zzCurrentPosL
++]:zzBufferL
.charAt(zzCurrentPosL
++);
518 // store back cached positions
519 zzCurrentPos
= zzCurrentPosL
;
520 zzMarkedPos
= zzMarkedPosL
;
521 boolean eof
= zzRefill();
522 // get translated positions and possibly new buffer
523 zzCurrentPosL
= zzCurrentPos
;
524 zzMarkedPosL
= zzMarkedPos
;
525 zzBufferL
= zzBuffer
;
526 zzEndReadL
= zzEndRead
;
532 zzInput
= zzBufferArrayL
!= null ? zzBufferArrayL
[zzCurrentPosL
++]:zzBufferL
.charAt(zzCurrentPosL
++);
535 int zzNext
= zzTransL
[ zzRowMapL
[zzState
] + zzCMapL
[zzInput
] ];
536 if (zzNext
== -1) break zzForAction
;
539 int zzAttributes
= zzAttrL
[zzState
];
540 if ( (zzAttributes
& 1) == 1 ) {
542 zzMarkedPosL
= zzCurrentPosL
;
543 if ( (zzAttributes
& 8) == 8 ) break zzForAction
;
549 // store back cached position
550 zzMarkedPos
= zzMarkedPosL
;
552 switch (zzAction
< 0 ? zzAction
: ZZ_ACTION
[zzAction
]) {
554 { return MacroTokenType
.RPAREN
;
558 { return MacroTokenType
.STRING_LITERAL
;
562 { return MacroTokenType
.IDENTIFIER
;
566 { return TokenType
.BAD_CHARACTER
;
570 { return MacroTokenType
.LPAREN
;
574 { return MacroTokenType
.EQ
;
578 { return MacroTokenType
.COMMA
;
582 { return MacroTokenType
.WHITE_SPACE
;
586 if (zzInput
== YYEOF
&& zzStartRead
== zzCurrentPos
) {
592 zzScanError(ZZ_NO_MATCH
);