1 /* The following code was generated by JFlex 1.4 on 3/26/05 7:57 PM */
3 /* It's an automatically generated code. Do not modify it. */
4 package com
.intellij
.codeInsight
.template
.impl
;
6 import com
.intellij
.lexer
.FlexLexer
;
7 import com
.intellij
.psi
.tree
.IElementType
;
11 * This class is a scanner generated by
12 * <a href="http://www.jflex.de/">JFlex</a> 1.4
13 * on 3/26/05 7:57 PM from the specification file
14 * <tt>C:/Irida/tools/lexer/TemplateTextLexer.flex</tt>
16 class _TemplateTextLexer
implements FlexLexer
{
17 /** initial size of the lookahead buffer */
18 private static final int ZZ_BUFFERSIZE
= 16384;
21 public static final int YYINITIAL
= 0;
24 * Translates characters to character classes
26 private static final String ZZ_CMAP_PACKED
=
27 "\44\0\1\2\13\0\12\1\7\0\32\1\4\0\1\1\1\0\32\1"+
31 * Translates characters to character classes
33 private static final char [] ZZ_CMAP
= zzUnpackCMap(ZZ_CMAP_PACKED
);
36 * Translates DFA states to action switch labels.
38 private static final int [] ZZ_ACTION
= zzUnpackAction();
40 private static final String ZZ_ACTION_PACKED_0
=
41 "\1\0\2\1\1\0\1\2\1\3";
43 private static int [] zzUnpackAction() {
44 int [] result
= new int[6];
46 offset
= zzUnpackAction(ZZ_ACTION_PACKED_0
, offset
, result
);
50 private static int zzUnpackAction(String packed
, int offset
, int [] result
) {
51 int i
= 0; /* index in packed string */
52 int j
= offset
; /* index in unpacked array */
53 int l
= packed
.length();
55 int count
= packed
.charAt(i
++);
56 int value
= packed
.charAt(i
++);
57 do result
[j
++] = value
; while (--count
> 0);
64 * Translates a state to a row index in the transition table
66 private static final int [] ZZ_ROWMAP
= zzUnpackRowMap();
68 private static final String ZZ_ROWMAP_PACKED_0
=
69 "\0\0\0\3\0\6\0\11\0\3\0\3";
71 private static int [] zzUnpackRowMap() {
72 int [] result
= new int[6];
74 offset
= zzUnpackRowMap(ZZ_ROWMAP_PACKED_0
, offset
, result
);
78 private static int zzUnpackRowMap(String packed
, int offset
, int [] result
) {
79 int i
= 0; /* index in packed string */
80 int j
= offset
; /* index in unpacked array */
81 int l
= packed
.length();
83 int high
= packed
.charAt(i
++) << 16;
84 result
[j
++] = high
| packed
.charAt(i
++);
90 * The transition table of the DFA
92 private static final int [] ZZ_TRANS
= zzUnpackTrans();
94 private static final String ZZ_TRANS_PACKED_0
=
95 "\2\2\1\3\4\0\1\4\1\5\1\0\1\4\1\6";
97 private static int [] zzUnpackTrans() {
98 int [] result
= new int[12];
100 offset
= zzUnpackTrans(ZZ_TRANS_PACKED_0
, offset
, result
);
104 private static int zzUnpackTrans(String packed
, int offset
, int [] result
) {
105 int i
= 0; /* index in packed string */
106 int j
= offset
; /* index in unpacked array */
107 int l
= packed
.length();
109 int count
= packed
.charAt(i
++);
110 int value
= packed
.charAt(i
++);
112 do result
[j
++] = value
; while (--count
> 0);
119 private static final int ZZ_UNKNOWN_ERROR
= 0;
120 private static final int ZZ_NO_MATCH
= 1;
121 private static final int ZZ_PUSHBACK_2BIG
= 2;
122 private static final char[] EMPTY_BUFFER
= new char[0];
123 private static final int YYEOF
= -1;
124 private static java
.io
.Reader zzReader
= null; // Fake
126 /* error messages for the codes above */
127 private static final String ZZ_ERROR_MSG
[] = {
128 "Unkown internal scanner error",
129 "Error: could not match input",
130 "Error: pushback value was too large"
134 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
136 private static final int [] ZZ_ATTRIBUTE
= zzUnpackAttribute();
138 private static final String ZZ_ATTRIBUTE_PACKED_0
=
139 "\1\0\1\11\1\1\1\0\2\11";
141 private static int [] zzUnpackAttribute() {
142 int [] result
= new int[6];
144 offset
= zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0
, offset
, result
);
148 private static int zzUnpackAttribute(String packed
, int offset
, int [] result
) {
149 int i
= 0; /* index in packed string */
150 int j
= offset
; /* index in unpacked array */
151 int l
= packed
.length();
153 int count
= packed
.charAt(i
++);
154 int value
= packed
.charAt(i
++);
155 do result
[j
++] = value
; while (--count
> 0);
160 /** the current state of the DFA */
163 /** the current lexical state */
164 private int zzLexicalState
= YYINITIAL
;
166 /** this buffer contains the current text to be matched and is
167 the source of the yytext() string */
168 private CharSequence zzBuffer
= "";
170 /** the textposition at the last accepting state */
171 private int zzMarkedPos
;
173 /** the textposition at the last state to be included in yytext */
174 private int zzPushbackPos
;
176 /** the current text position in the buffer */
177 private int zzCurrentPos
;
179 /** startRead marks the beginning of the yytext() string in the buffer */
180 private int zzStartRead
;
182 /** endRead marks the last character in the buffer, that has been read
184 private int zzEndRead
;
187 * zzAtBOL == true <=> the scanner is currently at the beginning of a line
189 private boolean zzAtBOL
= true;
191 /** zzAtEOF == true <=> the scanner is at the EOF */
192 private boolean zzAtEOF
;
194 /** denotes if the user-EOF-code has already been executed */
195 private boolean zzEOFDone
;
198 public _TemplateTextLexer() {
199 this((java
.io
.Reader
)null);
203 _TemplateTextLexer(java
.io
.Reader in
) {
208 * Creates a new scanner.
209 * There is also java.io.Reader version of this constructor.
211 * @param in the java.io.Inputstream to read input from.
213 _TemplateTextLexer(java
.io
.InputStream in
) {
214 this(new java
.io
.InputStreamReader(in
));
218 * Unpacks the compressed character translation table.
220 * @param packed the packed character translation table
221 * @return the unpacked character translation table
223 private static char [] zzUnpackCMap(String packed
) {
224 char [] map
= new char[0x10000];
225 int i
= 0; /* index in packed string */
226 int j
= 0; /* index in unpacked array */
228 int count
= packed
.charAt(i
++);
229 char value
= packed
.charAt(i
++);
230 do map
[j
++] = value
; while (--count
> 0);
235 public final int getTokenStart(){
236 return zzStartRead
- zzPushbackPos
;
239 public final int getTokenEnd(){
240 return getTokenStart() + yylength();
243 public void reset(CharSequence buffer
, int start
, int end
, int initialState
){
245 zzCurrentPos
= zzMarkedPos
= zzStartRead
= start
;
249 yybegin(initialState
);
252 public void reset(CharSequence buffer
, int initialState
){
253 reset(buffer
, 0, buffer
.length(), initialState
);
257 * Refills the input buffer.
259 * @return <code>false</code>, iff there was new input.
261 * @exception java.io.IOException if any I/O-Error occurs
263 private boolean zzRefill() throws java
.io
.IOException
{
269 * Returns the current lexical state.
271 public final int yystate() {
272 return zzLexicalState
;
277 * Enters a new lexical state
279 * @param newState the new lexical state
281 public final void yybegin(int newState
) {
282 zzLexicalState
= newState
;
287 * Returns the text matched by the current regular expression.
289 public final CharSequence
yytext() {
290 return zzBuffer
.subSequence(zzStartRead
, zzMarkedPos
);
295 * Returns the character at position <tt>pos</tt> from the
298 * It is equivalent to yytext().charAt(pos), but faster
300 * @param pos the position of the character to fetch.
301 * A value from 0 to yylength()-1.
303 * @return the character at position pos
305 public final char yycharat(int pos
) {
306 return zzBuffer
.charAt(zzStartRead
+pos
);
311 * Returns the length of the matched text region.
313 public final int yylength() {
314 return zzMarkedPos
-zzStartRead
;
319 * Reports an error that occured while scanning.
321 * In a wellformed scanner (no or only correct usage of
322 * yypushback(int) and a match-all fallback rule) this method
323 * will only be called with things that "Can't Possibly Happen".
324 * If this method is called, something is seriously wrong
325 * (e.g. a JFlex bug producing a faulty scanner etc.).
327 * Usual syntax/scanner level error handling should be done
328 * in error fallback rules.
330 * @param errorCode the code of the errormessage to display
332 private void zzScanError(int errorCode
) {
335 message
= ZZ_ERROR_MSG
[errorCode
];
337 catch (ArrayIndexOutOfBoundsException e
) {
338 message
= ZZ_ERROR_MSG
[ZZ_UNKNOWN_ERROR
];
341 throw new Error(message
);
346 * Pushes the specified amount of characters back into the input stream.
348 * They will be read again by then next call of the scanning method
350 * @param number the number of characters to be read again.
351 * This number must not be greater than yylength()!
353 public void yypushback(int number
) {
354 if ( number
> yylength() )
355 zzScanError(ZZ_PUSHBACK_2BIG
);
357 zzMarkedPos
-= number
;
362 * Contains user EOF-code, which will be executed exactly once,
363 * when the end of file is reached
365 private void zzDoEOF() {
374 * Resumes scanning until the next regular expression is matched,
375 * the end of input is encountered or an I/O-Error occurs.
377 * @return the next token
378 * @exception java.io.IOException if any I/O-Error occurs
380 public IElementType
advance() throws java
.io
.IOException
{
387 int zzEndReadL
= zzEndRead
;
388 CharSequence zzBufferL
= zzBuffer
;
389 char [] zzCMapL
= ZZ_CMAP
;
391 int [] zzTransL
= ZZ_TRANS
;
392 int [] zzRowMapL
= ZZ_ROWMAP
;
393 int [] zzAttrL
= ZZ_ATTRIBUTE
;
396 zzMarkedPosL
= zzMarkedPos
;
400 zzCurrentPosL
= zzCurrentPos
= zzStartRead
= zzMarkedPosL
;
402 zzState
= zzLexicalState
;
408 if (zzCurrentPosL
< zzEndReadL
)
409 zzInput
= zzBufferL
.charAt(zzCurrentPosL
++);
415 // store back cached positions
416 zzCurrentPos
= zzCurrentPosL
;
417 zzMarkedPos
= zzMarkedPosL
;
418 boolean eof
= zzRefill();
419 // get translated positions and possibly new buffer
420 zzCurrentPosL
= zzCurrentPos
;
421 zzMarkedPosL
= zzMarkedPos
;
422 zzBufferL
= zzBuffer
;
423 zzEndReadL
= zzEndRead
;
429 zzInput
= zzBufferL
.charAt(zzCurrentPosL
++);
432 int zzNext
= zzTransL
[ zzRowMapL
[zzState
] + zzCMapL
[zzInput
] ];
433 if (zzNext
== -1) break zzForAction
;
436 int zzAttributes
= zzAttrL
[zzState
];
437 if ( (zzAttributes
& 1) == 1 ) {
439 zzMarkedPosL
= zzCurrentPosL
;
440 if ( (zzAttributes
& 8) == 8 ) break zzForAction
;
446 // store back cached position
447 zzMarkedPos
= zzMarkedPosL
;
449 switch (zzAction
< 0 ? zzAction
: ZZ_ACTION
[zzAction
]) {
451 { return TemplateTokenType
.ESCAPE_DOLLAR
;
455 { return TemplateTokenType
.TEXT
;
459 { return TemplateTokenType
.VARIABLE
;
463 if (zzInput
== YYEOF
&& zzStartRead
== zzCurrentPos
) {
469 zzScanError(ZZ_NO_MATCH
);