removed out.println() usages
[fedora-idea.git] / lang-impl / src / com / intellij / codeInsight / template / impl / _TemplateTextLexer.java
blob06fe59a84419537cbd451a586959e2e792d50439
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;
10 /**
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;
20 /** lexical states */
21 public static final int YYINITIAL = 0;
23 /**
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"+
28 "\uff85\0";
30 /**
31 * Translates characters to character classes
33 private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
35 /**
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];
45 int offset = 0;
46 offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
47 return 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();
54 while (i < l) {
55 int count = packed.charAt(i++);
56 int value = packed.charAt(i++);
57 do result[j++] = value; while (--count > 0);
59 return j;
63 /**
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];
73 int offset = 0;
74 offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
75 return 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();
82 while (i < l) {
83 int high = packed.charAt(i++) << 16;
84 result[j++] = high | packed.charAt(i++);
86 return j;
89 /**
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];
99 int offset = 0;
100 offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
101 return 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();
108 while (i < l) {
109 int count = packed.charAt(i++);
110 int value = packed.charAt(i++);
111 value--;
112 do result[j++] = value; while (--count > 0);
114 return j;
118 /* error codes */
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];
143 int offset = 0;
144 offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
145 return 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();
152 while (i < l) {
153 int count = packed.charAt(i++);
154 int value = packed.charAt(i++);
155 do result[j++] = value; while (--count > 0);
157 return j;
160 /** the current state of the DFA */
161 private int zzState;
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
183 from input */
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;
197 /* user code: */
198 public _TemplateTextLexer() {
199 this((java.io.Reader)null);
203 _TemplateTextLexer(java.io.Reader in) {
204 this.zzReader = 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));
217 /**
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 */
227 while (i < 22) {
228 int count = packed.charAt(i++);
229 char value = packed.charAt(i++);
230 do map[j++] = value; while (--count > 0);
232 return map;
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){
244 zzBuffer = buffer;
245 zzCurrentPos = zzMarkedPos = zzStartRead = start;
246 zzPushbackPos = 0;
247 zzAtEOF = false;
248 zzEndRead = end;
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 {
264 return true;
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
296 * matched text.
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) {
333 String message;
334 try {
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() {
366 if (!zzEOFDone) {
367 zzEOFDone = true;
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 {
381 int zzInput;
382 int zzAction;
384 // cached fields:
385 int zzCurrentPosL;
386 int zzMarkedPosL;
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;
395 while (true) {
396 zzMarkedPosL = zzMarkedPos;
398 zzAction = -1;
400 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
402 zzState = zzLexicalState;
405 zzForAction: {
406 while (true) {
408 if (zzCurrentPosL < zzEndReadL)
409 zzInput = zzBufferL.charAt(zzCurrentPosL++);
410 else if (zzAtEOF) {
411 zzInput = YYEOF;
412 break zzForAction;
414 else {
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;
424 if (eof) {
425 zzInput = YYEOF;
426 break zzForAction;
428 else {
429 zzInput = zzBufferL.charAt(zzCurrentPosL++);
432 int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
433 if (zzNext == -1) break zzForAction;
434 zzState = zzNext;
436 int zzAttributes = zzAttrL[zzState];
437 if ( (zzAttributes & 1) == 1 ) {
438 zzAction = zzState;
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]) {
450 case 2:
451 { return TemplateTokenType.ESCAPE_DOLLAR;
453 case 4: break;
454 case 1:
455 { return TemplateTokenType.TEXT;
457 case 5: break;
458 case 3:
459 { return TemplateTokenType.VARIABLE;
461 case 6: break;
462 default:
463 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
464 zzAtEOF = true;
465 zzDoEOF();
466 return null;
468 else {
469 zzScanError(ZZ_NO_MATCH);