KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > beaver > spec > parser > GrammarScanner


1 /* The following code was generated by JFlex 1.4.1 on 11/6/05 1:57 AM */
2
3 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4  * This file is part of Beaver Parser Generator. *
5  * Copyright (C) 2003,2005 Alexander Demenchuk <alder@softanvil.com>. *
6  * All rights reserved. *
7  * See the file "LICENSE" for the terms and conditions for copying, *
8  * distribution and modification of Beaver. *
9  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

10
11 package beaver.spec.parser;
12
13 import beaver.Symbol;
14 import beaver.Scanner;
15 import beaver.spec.parser.GrammarParser.Terminals;
16
17
18 /**
19  * This class is a scanner generated by
20  * <a HREF="http://www.jflex.de/">JFlex</a> 1.4.1
21  * on 11/6/05 1:57 AM from the specification file
22  * <tt>C:/Documents and Settings/ademenchuk/workspace/Beaver 0.9/etc/GrammarScanner.flex</tt>
23  */

24 public class GrammarScanner extends Scanner {
25
26   /** This character denotes the end of file */
27   public static final int YYEOF = -1;
28
29   /** initial size of the lookahead buffer */
30   private static final int ZZ_BUFFERSIZE = 16384;
31
32   /** lexical states */
33   public static final int CODE = 1;
34   public static final int EOL_COMMENT = 4;
35   public static final int EOF_MLN_COMMENT = 7;
36   public static final int EOF_CODE = 6;
37   public static final int CODE_END = 5;
38   public static final int MLN_COMMENT = 3;
39   public static final int YYINITIAL = 0;
40   public static final int EOF_EOL_COMMENT = 8;
41   public static final int TEXT = 2;
42
43   /**
44    * Translates characters to character classes
45    */

46   private static final String JavaDoc ZZ_CMAP_PACKED =
47     "\11\0\1\3\1\2\1\0\1\3\1\1\22\0\1\3\1\0\1\6"+
48     "\2\0\1\7\4\0\1\43\1\42\1\33\1\0\1\37\1\46\12\5"+
49     "\1\45\1\35\1\0\1\34\1\0\1\41\1\36\32\4\4\0\1\5"+
50     "\1\0\1\12\1\27\1\16\1\13\1\11\1\32\1\20\1\10\1\21"+
51     "\1\4\1\17\1\25\1\22\1\30\1\23\1\15\1\4\1\14\1\26"+
52     "\1\24\4\4\1\31\1\4\1\44\1\40\1\47\54\0\1\4\12\0"+
53     "\1\4\4\0\1\4\5\0\27\4\1\0\37\4\1\0\u013f\4\31\0"+
54     "\162\4\4\0\14\4\16\0\5\4\11\0\1\4\213\0\1\4\13\0"+
55     "\1\4\1\0\3\4\1\0\1\4\1\0\24\4\1\0\54\4\1\0"+
56     "\46\4\1\0\5\4\4\0\202\4\10\0\105\4\1\0\46\4\2\0"+
57     "\2\4\6\0\20\4\41\0\46\4\2\0\1\4\7\0\47\4\110\0"+
58     "\33\4\5\0\3\4\56\0\32\4\5\0\13\4\25\0\12\5\4\0"+
59     "\2\4\1\0\143\4\1\0\1\4\17\0\2\4\7\0\2\4\12\5"+
60     "\3\4\2\0\1\4\20\0\1\4\1\0\36\4\35\0\3\4\60\0"+
61     "\46\4\13\0\1\4\u0152\0\66\4\3\0\1\4\22\0\1\4\7\0"+
62     "\12\4\4\0\12\5\25\0\10\4\2\0\2\4\2\0\26\4\1\0"+
63     "\7\4\1\0\1\4\3\0\4\4\3\0\1\4\36\0\2\4\1\0"+
64     "\3\4\4\0\12\5\2\4\23\0\6\4\4\0\2\4\2\0\26\4"+
65     "\1\0\7\4\1\0\2\4\1\0\2\4\1\0\2\4\37\0\4\4"+
66     "\1\0\1\4\7\0\12\5\2\0\3\4\20\0\11\4\1\0\3\4"+
67     "\1\0\26\4\1\0\7\4\1\0\2\4\1\0\5\4\3\0\1\4"+
68     "\22\0\1\4\17\0\2\4\4\0\12\5\25\0\10\4\2\0\2\4"+
69     "\2\0\26\4\1\0\7\4\1\0\2\4\1\0\5\4\3\0\1\4"+
70     "\36\0\2\4\1\0\3\4\4\0\12\5\1\0\1\4\21\0\1\4"+
71     "\1\0\6\4\3\0\3\4\1\0\4\4\3\0\2\4\1\0\1\4"+
72     "\1\0\2\4\3\0\2\4\3\0\3\4\3\0\10\4\1\0\3\4"+
73     "\55\0\11\5\25\0\10\4\1\0\3\4\1\0\27\4\1\0\12\4"+
74     "\1\0\5\4\46\0\2\4\4\0\12\5\25\0\10\4\1\0\3\4"+
75     "\1\0\27\4\1\0\12\4\1\0\5\4\3\0\1\4\40\0\1\4"+
76     "\1\0\2\4\4\0\12\5\25\0\10\4\1\0\3\4\1\0\27\4"+
77     "\1\0\20\4\46\0\2\4\4\0\12\5\25\0\22\4\3\0\30\4"+
78     "\1\0\11\4\1\0\1\4\2\0\7\4\72\0\60\4\1\0\2\4"+
79     "\14\0\7\4\11\0\12\5\47\0\2\4\1\0\1\4\2\0\2\4"+
80     "\1\0\1\4\2\0\1\4\6\0\4\4\1\0\7\4\1\0\3\4"+
81     "\1\0\1\4\1\0\1\4\2\0\2\4\1\0\4\4\1\0\2\4"+
82     "\11\0\1\4\2\0\5\4\1\0\1\4\11\0\12\5\2\0\2\4"+
83     "\42\0\1\4\37\0\12\5\26\0\10\4\1\0\42\4\35\0\4\4"+
84     "\164\0\42\4\1\0\5\4\1\0\2\4\25\0\12\5\6\0\6\4"+
85     "\112\0\46\4\12\0\51\4\7\0\132\4\5\0\104\4\5\0\122\4"+
86     "\6\0\7\4\1\0\77\4\1\0\1\4\1\0\4\4\2\0\7\4"+
87     "\1\0\1\4\1\0\4\4\2\0\47\4\1\0\1\4\1\0\4\4"+
88     "\2\0\37\4\1\0\1\4\1\0\4\4\2\0\7\4\1\0\1\4"+
89     "\1\0\4\4\2\0\7\4\1\0\7\4\1\0\27\4\1\0\37\4"+
90     "\1\0\1\4\1\0\4\4\2\0\7\4\1\0\47\4\1\0\23\4"+
91     "\16\0\11\5\56\0\125\4\14\0\u026c\4\2\0\10\4\12\0\32\4"+
92     "\5\0\113\4\25\0\15\4\1\0\4\4\16\0\22\4\16\0\22\4"+
93     "\16\0\15\4\1\0\3\4\17\0\64\4\43\0\1\4\4\0\1\4"+
94     "\3\0\12\5\46\0\12\5\6\0\130\4\10\0\51\4\127\0\35\4"+
95     "\51\0\12\5\36\4\2\0\5\4\u038b\0\154\4\224\0\234\4\4\0"+
96     "\132\4\6\0\26\4\2\0\6\4\2\0\46\4\2\0\6\4\2\0"+
97     "\10\4\1\0\1\4\1\0\1\4\1\0\1\4\1\0\37\4\2\0"+
98     "\65\4\1\0\7\4\1\0\1\4\3\0\3\4\1\0\7\4\3\0"+
99     "\4\4\2\0\6\4\4\0\15\4\5\0\3\4\1\0\7\4\164\0"+
100     "\1\4\15\0\1\4\202\0\1\4\4\0\1\4\2\0\12\4\1\0"+
101     "\1\4\3\0\5\4\6\0\1\4\1\0\1\4\1\0\1\4\1\0"+
102     "\4\4\1\0\3\4\1\0\7\4\3\0\3\4\5\0\5\4\u0ebb\0"+
103     "\2\4\52\0\5\4\5\0\2\4\4\0\126\4\6\0\3\4\1\0"+
104     "\132\4\1\0\4\4\5\0\50\4\4\0\136\4\21\0\30\4\70\0"+
105     "\20\4\u0200\0\u19b6\4\112\0\u51a6\4\132\0\u048d\4\u0773\0\u2ba4\4\u215c\0"+
106     "\u012e\4\2\0\73\4\225\0\7\4\14\0\5\4\5\0\1\4\1\0"+
107     "\12\4\1\0\15\4\1\0\5\4\1\0\1\4\1\0\2\4\1\0"+
108     "\2\4\1\0\154\4\41\0\u016b\4\22\0\100\4\2\0\66\4\50\0"+
109     "\14\4\164\0\5\4\1\0\207\4\23\0\12\5\7\0\32\4\6\0"+
110     "\32\4\13\0\131\4\3\0\6\4\2\0\6\4\2\0\6\4\2\0"+
111     "\3\4\43\0";
112
113   /**
114    * Translates characters to character classes
115    */

116   private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
117
118   /**
119    * Translates DFA states to action switch labels.
120    */

121   private static final int [] ZZ_ACTION = zzUnpackAction();
122
123   private static final String JavaDoc ZZ_ACTION_PACKED_0 =
124     "\1\0\1\1\1\2\1\3\1\4\1\1\1\5\1\6"+
125     "\1\7\1\10\2\11\1\12\1\13\1\10\1\14\1\15"+
126     "\1\16\1\17\1\20\1\21\1\22\1\23\1\24\2\10"+
127     "\2\1\1\25\1\2\1\26\2\3\1\4\2\7\2\1"+
128     "\12\0\1\27\1\30\1\31\2\0\1\32\3\0\1\33"+
129     "\35\0\1\34\1\0\1\35\2\0\1\36\2\0\1\37"+
130     "\1\40\1\0\1\41\4\0\1\42\1\0\1\43\1\0"+
131     "\1\44\1\0\1\45\3\0\1\46\1\47";
132
133   private static int [] zzUnpackAction() {
134     int [] result = new int[115];
135     int offset = 0;
136     offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
137     return result;
138   }
139
140   private static int zzUnpackAction(String JavaDoc packed, int offset, int [] result) {
141     int i = 0; /* index in packed string */
142     int j = offset; /* index in unpacked array */
143     int l = packed.length();
144     while (i < l) {
145       int count = packed.charAt(i++);
146       int value = packed.charAt(i++);
147       do result[j++] = value; while (--count > 0);
148     }
149     return j;
150   }
151
152
153   /**
154    * Translates a state to a row index in the transition table
155    */

156   private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
157
158   private static final String JavaDoc ZZ_ROWMAP_PACKED_0 =
159     "\0\0\0\50\0\120\0\170\0\240\0\310\0\360\0\u0118"+
160     "\0\u0140\0\u0168\0\u0190\0\u0168\0\u01b8\0\u0168\0\u01e0\0\u0168"+
161     "\0\u0168\0\u0168\0\u0168\0\u0168\0\u0168\0\u0168\0\u0168\0\u0168"+
162     "\0\u0208\0\u0230\0\u0258\0\u0280\0\u02a8\0\u0168\0\u0168\0\u02d0"+
163     "\0\u02f8\0\u0320\0\u0348\0\u0168\0\u0168\0\u0370\0\u0398\0\u03c0"+
164     "\0\u03e8\0\u0410\0\u0438\0\u0460\0\u0488\0\u04b0\0\u04d8\0\u0500"+
165     "\0\u0168\0\u0168\0\u0168\0\u0258\0\u0280\0\u0168\0\u02d0\0\u02f8"+
166     "\0\u0320\0\u0168\0\u0528\0\u0550\0\u0578\0\u05a0\0\u05c8\0\u05f0"+
167     "\0\u0618\0\u0640\0\u0668\0\u0690\0\u06b8\0\u06e0\0\u0708\0\u0730"+
168     "\0\u0758\0\u0780\0\u07a8\0\u07d0\0\u07f8\0\u0820\0\u0848\0\u0870"+
169     "\0\u0898\0\u08c0\0\u08e8\0\u0910\0\u0938\0\u0960\0\u0988\0\u0168"+
170     "\0\u09b0\0\u0168\0\u09d8\0\u0a00\0\u0168\0\u0a28\0\u0a50\0\u0168"+
171     "\0\u0168\0\u0a78\0\u0168\0\u0aa0\0\u0ac8\0\u0af0\0\u0b18\0\u0168"+
172     "\0\u0b40\0\u0168\0\u0b68\0\u0168\0\u0b90\0\u0168\0\u0bb8\0\u0be0"+
173     "\0\u0c08\0\u0168\0\u0168";
174
175   private static int [] zzUnpackRowMap() {
176     int [] result = new int[115];
177     int offset = 0;
178     offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
179     return result;
180   }
181
182   private static int zzUnpackRowMap(String JavaDoc packed, int offset, int [] result) {
183     int i = 0; /* index in packed string */
184     int j = offset; /* index in unpacked array */
185     int l = packed.length();
186     while (i < l) {
187       int high = packed.charAt(i++) << 16;
188       result[j++] = high | packed.charAt(i++);
189     }
190     return j;
191   }
192
193   /**
194    * The transition table of the DFA
195    */

196   private static final int [] ZZ_TRANS = zzUnpackTrans();
197
198   private static final String JavaDoc ZZ_TRANS_PACKED_0 =
199     "\1\12\1\13\2\14\1\15\1\12\1\16\1\17\23\15"+
200     "\1\20\1\21\1\22\1\23\1\24\1\25\1\26\1\27"+
201     "\1\30\1\31\1\12\1\32\1\12\45\33\1\34\2\33"+
202     "\1\35\2\36\3\35\1\37\41\35\43\40\1\41\4\40"+
203     "\1\42\1\43\1\44\45\42\45\45\1\46\2\45\50\7"+
204     "\50\10\50\11\52\0\1\14\51\0\2\15\2\0\23\15"+
205     "\25\0\1\47\1\50\2\0\1\51\1\52\1\53\1\0"+
206     "\1\54\1\55\2\0\1\56\1\57\2\0\1\60\64\0"+
207     "\1\61\45\0\1\62\2\0\1\63\1\0\45\64\1\65"+
208     "\47\64\1\65\1\64\1\66\1\35\2\0\3\35\1\0"+
209     "\41\35\43\67\1\70\47\67\1\70\2\67\1\44\1\67"+
210     "\1\71\1\43\1\44\45\71\2\0\1\44\114\0\1\72"+
211     "\11\0\1\73\60\0\1\74\46\0\1\75\40\0\1\76"+
212     "\62\0\1\77\45\0\1\100\46\0\1\101\5\0\1\102"+
213     "\30\0\1\103\17\0\1\104\27\0\1\105\61\0\1\106"+
214     "\36\0\1\107\64\0\1\110\40\0\1\111\45\0\1\112"+
215     "\43\0\1\113\47\0\1\114\52\0\1\115\53\0\1\116"+
216     "\42\0\1\117\50\0\1\120\64\0\1\121\45\0\1\122"+
217     "\32\0\1\123\45\0\1\124\46\0\1\125\56\0\1\126"+
218     "\56\0\1\127\46\0\1\130\45\0\1\131\50\0\1\132"+
219     "\45\0\1\133\36\0\1\134\62\0\1\135\35\0\1\136"+
220     "\46\0\1\137\51\0\1\140\60\0\1\141\35\0\1\142"+
221     "\63\0\1\143\35\0\1\144\54\0\1\145\51\0\1\146"+
222     "\52\0\1\147\35\0\1\150\53\0\1\151\53\0\1\152"+
223     "\53\0\1\153\51\0\1\154\43\0\1\155\32\0\1\156"+
224     "\50\0\1\157\60\0\1\160\51\0\1\161\40\0\1\162"+
225     "\57\0\1\163\21\0";
226
227   private static int [] zzUnpackTrans() {
228     int [] result = new int[3120];
229     int offset = 0;
230     offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
231     return result;
232   }
233
234   private static int zzUnpackTrans(String JavaDoc packed, int offset, int [] result) {
235     int i = 0; /* index in packed string */
236     int j = offset; /* index in unpacked array */
237     int l = packed.length();
238     while (i < l) {
239       int count = packed.charAt(i++);
240       int value = packed.charAt(i++);
241       value--;
242       do result[j++] = value; while (--count > 0);
243     }
244     return j;
245   }
246
247
248   /* error codes */
249   private static final int ZZ_UNKNOWN_ERROR = 0;
250   private static final int ZZ_NO_MATCH = 1;
251   private static final int ZZ_PUSHBACK_2BIG = 2;
252
253   /* error messages for the codes above */
254   private static final String JavaDoc ZZ_ERROR_MSG[] = {
255     "Unkown internal scanner error",
256     "Error: could not match input",
257     "Error: pushback value was too large"
258   };
259
260   /**
261    * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
262    */

263   private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
264
265   private static final String JavaDoc ZZ_ATTRIBUTE_PACKED_0 =
266     "\1\0\10\1\1\11\1\1\1\11\1\1\1\11\1\1"+
267     "\11\11\5\1\2\11\4\1\2\11\1\1\12\0\3\11"+
268     "\2\0\1\11\3\0\1\11\35\0\1\11\1\0\1\11"+
269     "\2\0\1\11\2\0\2\11\1\0\1\11\4\0\1\11"+
270     "\1\0\1\11\1\0\1\11\1\0\1\11\3\0\2\11";
271
272   private static int [] zzUnpackAttribute() {
273     int [] result = new int[115];
274     int offset = 0;
275     offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
276     return result;
277   }
278
279   private static int zzUnpackAttribute(String JavaDoc packed, int offset, int [] result) {
280     int i = 0; /* index in packed string */
281     int j = offset; /* index in unpacked array */
282     int l = packed.length();
283     while (i < l) {
284       int count = packed.charAt(i++);
285       int value = packed.charAt(i++);
286       do result[j++] = value; while (--count > 0);
287     }
288     return j;
289   }
290
291   /** the input device */
292   private java.io.Reader JavaDoc zzReader;
293
294   /** the current state of the DFA */
295   private int zzState;
296
297   /** the current lexical state */
298   private int zzLexicalState = YYINITIAL;
299
300   /** this buffer contains the current text to be matched and is
301       the source of the yytext() string */

302   private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
303
304   /** the textposition at the last accepting state */
305   private int zzMarkedPos;
306
307   /** the textposition at the last state to be included in yytext */
308   private int zzPushbackPos;
309
310   /** the current text position in the buffer */
311   private int zzCurrentPos;
312
313   /** startRead marks the beginning of the yytext() string in the buffer */
314   private int zzStartRead;
315
316   /** endRead marks the last character in the buffer, that has been read
317       from input */

318   private int zzEndRead;
319
320   /** number of newlines encountered up to the start of the matched text */
321   private int yyline;
322
323   /** the number of characters up to the start of the matched text */
324   //private int yychar;
325

326   /**
327    * the number of characters from the last newline up to the start of the
328    * matched text
329    */

330   private int yycolumn;
331
332   /**
333    * zzAtBOL == true <=> the scanner is currently at the beginning of a line
334    */

335   //private boolean zzAtBOL = true;
336

337   /** zzAtEOF == true <=> the scanner is at the EOF */
338   private boolean zzAtEOF;
339
340   /* user code: */
341     private int token_line;
342     private int token_column;
343
344     private String JavaDoc matched_text;
345
346     private Symbol newSymbol(short id)
347     {
348         return new Symbol(id, yyline + 1, yycolumn + 1, yylength(), yytext());
349     }
350
351     private Symbol newSymbol(short id, Object JavaDoc value)
352     {
353         return new Symbol(id, yyline + 1, yycolumn + 1, yylength(), value);
354     }
355
356
357   /**
358    * Creates a new scanner
359    * There is also a java.io.InputStream version of this constructor.
360    *
361    * @param in the java.io.Reader to read input from.
362    */

363   public GrammarScanner(java.io.Reader JavaDoc in) {
364     this.zzReader = in;
365   }
366
367   /**
368    * Creates a new scanner.
369    * There is also java.io.Reader version of this constructor.
370    *
371    * @param in the java.io.Inputstream to read input from.
372    */

373   public GrammarScanner(java.io.InputStream JavaDoc in) {
374     this(new java.io.InputStreamReader JavaDoc(in));
375   }
376
377   /**
378    * Unpacks the compressed character translation table.
379    *
380    * @param packed the packed character translation table
381    * @return the unpacked character translation table
382    */

383   private static char [] zzUnpackCMap(String JavaDoc packed) {
384     char [] map = new char[0x10000];
385     int i = 0; /* index in packed string */
386     int j = 0; /* index in unpacked array */
387     while (i < 1284) {
388       int count = packed.charAt(i++);
389       char value = packed.charAt(i++);
390       do map[j++] = value; while (--count > 0);
391     }
392     return map;
393   }
394
395
396   /**
397    * Refills the input buffer.
398    *
399    * @return <code>false</code>, iff there was new input.
400    *
401    * @exception java.io.IOException if any I/O-Error occurs
402    */

403   private boolean zzRefill() throws java.io.IOException JavaDoc {
404
405     /* first: make room (if you can) */
406     if (zzStartRead > 0) {
407       System.arraycopy(zzBuffer, zzStartRead,
408                        zzBuffer, 0,
409                        zzEndRead-zzStartRead);
410
411       /* translate stored positions */
412       zzEndRead-= zzStartRead;
413       zzCurrentPos-= zzStartRead;
414       zzMarkedPos-= zzStartRead;
415       zzPushbackPos-= zzStartRead;
416       zzStartRead = 0;
417     }
418
419     /* is the buffer big enough? */
420     if (zzCurrentPos >= zzBuffer.length) {
421       /* if not: blow it up */
422       char newBuffer[] = new char[zzCurrentPos*2];
423       System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
424       zzBuffer = newBuffer;
425     }
426
427     /* finally: fill the buffer with new input */
428     int numRead = zzReader.read(zzBuffer, zzEndRead,
429                                             zzBuffer.length-zzEndRead);
430
431     if (numRead < 0) {
432       return true;
433     }
434     else {
435       zzEndRead+= numRead;
436       return false;
437     }
438   }
439
440     
441   /**
442    * Closes the input stream.
443    */

444   public final void yyclose() throws java.io.IOException JavaDoc {
445     zzAtEOF = true; /* indicate end of file */
446     zzEndRead = zzStartRead; /* invalidate buffer */
447
448     if (zzReader != null)
449       zzReader.close();
450   }
451
452
453   /**
454    * Resets the scanner to read from a new input stream.
455    * Does not close the old reader.
456    *
457    * All internal variables are reset, the old input stream
458    * <b>cannot</b> be reused (internal buffer is discarded and lost).
459    * Lexical state is set to <tt>ZZ_INITIAL</tt>.
460    *
461    * @param reader the new input stream
462    */

463   public final void yyreset(java.io.Reader JavaDoc reader) {
464     zzReader = reader;
465     zzAtEOF = false;
466     zzEndRead = zzStartRead = 0;
467     zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
468     yyline = yycolumn = 0;
469     zzLexicalState = YYINITIAL;
470   }
471
472
473   /**
474    * Returns the current lexical state.
475    */

476   public final int yystate() {
477     return zzLexicalState;
478   }
479
480
481   /**
482    * Enters a new lexical state
483    *
484    * @param newState the new lexical state
485    */

486   public final void yybegin(int newState) {
487     zzLexicalState = newState;
488   }
489
490
491   /**
492    * Returns the text matched by the current regular expression.
493    */

494   public final String JavaDoc yytext() {
495     return new String JavaDoc( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
496   }
497
498
499   /**
500    * Returns the character at position <tt>pos</tt> from the
501    * matched text.
502    *
503    * It is equivalent to yytext().charAt(pos), but faster
504    *
505    * @param pos the position of the character to fetch.
506    * A value from 0 to yylength()-1.
507    *
508    * @return the character at position pos
509    */

510   public final char yycharat(int pos) {
511     return zzBuffer[zzStartRead+pos];
512   }
513
514
515   /**
516    * Returns the length of the matched text region.
517    */

518   public final int yylength() {
519     return zzMarkedPos-zzStartRead;
520   }
521
522
523   /**
524    * Reports an error that occured while scanning.
525    *
526    * In a wellformed scanner (no or only correct usage of
527    * yypushback(int) and a match-all fallback rule) this method
528    * will only be called with things that "Can't Possibly Happen".
529    * If this method is called, something is seriously wrong
530    * (e.g. a JFlex bug producing a faulty scanner etc.).
531    *
532    * Usual syntax/scanner level error handling should be done
533    * in error fallback rules.
534    *
535    * @param errorCode the code of the errormessage to display
536    */

537   private void zzScanError(int errorCode) {
538     String JavaDoc message;
539     try {
540       message = ZZ_ERROR_MSG[errorCode];
541     }
542     catch (ArrayIndexOutOfBoundsException JavaDoc e) {
543       message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
544     }
545
546     throw new Error JavaDoc(message);
547   }
548
549
550   /**
551    * Pushes the specified amount of characters back into the input stream.
552    *
553    * They will be read again by then next call of the scanning method
554    *
555    * @param number the number of characters to be read again.
556    * This number must not be greater than yylength()!
557    */

558   public void yypushback(int number) {
559     if ( number > yylength() )
560       zzScanError(ZZ_PUSHBACK_2BIG);
561
562     zzMarkedPos -= number;
563   }
564
565
566   /**
567    * Resumes scanning until the next regular expression is matched,
568    * the end of input is encountered or an I/O-Error occurs.
569    *
570    * @return the next token
571    * @exception java.io.IOException if any I/O-Error occurs
572    */

573   public Symbol nextToken() throws java.io.IOException JavaDoc, Scanner.Exception {
574     int zzInput;
575     int zzAction;
576
577     // cached fields:
578
int zzCurrentPosL;
579     int zzMarkedPosL;
580     int zzEndReadL = zzEndRead;
581     char [] zzBufferL = zzBuffer;
582     char [] zzCMapL = ZZ_CMAP;
583
584     int [] zzTransL = ZZ_TRANS;
585     int [] zzRowMapL = ZZ_ROWMAP;
586     int [] zzAttrL = ZZ_ATTRIBUTE;
587
588     while (true) {
589       zzMarkedPosL = zzMarkedPos;
590
591       boolean zzR = false;
592       for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL;
593                                                              zzCurrentPosL++) {
594         switch (zzBufferL[zzCurrentPosL]) {
595         case '\u000B':
596         case '\u000C':
597         case '\u0085':
598         case '\u2028':
599         case '\u2029':
600           yyline++;
601           yycolumn = 0;
602           zzR = false;
603           break;
604         case '\r':
605           yyline++;
606           yycolumn = 0;
607           zzR = true;
608           break;
609         case '\n':
610           if (zzR)
611             zzR = false;
612           else {
613             yyline++;
614             yycolumn = 0;
615           }
616           break;
617         default:
618           zzR = false;
619           yycolumn++;
620         }
621       }
622
623       if (zzR) {
624         // peek one character ahead if it is \n (if we have counted one line too much)
625
boolean zzPeek;
626         if (zzMarkedPosL < zzEndReadL)
627           zzPeek = zzBufferL[zzMarkedPosL] == '\n';
628         else if (zzAtEOF)
629           zzPeek = false;
630         else {
631           boolean eof = zzRefill();
632           zzEndReadL = zzEndRead;
633           zzMarkedPosL = zzMarkedPos;
634           zzBufferL = zzBuffer;
635           if (eof)
636             zzPeek = false;
637           else
638             zzPeek = zzBufferL[zzMarkedPosL] == '\n';
639         }
640         if (zzPeek) yyline--;
641       }
642       zzAction = -1;
643
644       zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
645   
646       zzState = zzLexicalState;
647
648
649       zzForAction: {
650         while (true) {
651     
652           if (zzCurrentPosL < zzEndReadL)
653             zzInput = zzBufferL[zzCurrentPosL++];
654           else if (zzAtEOF) {
655             zzInput = YYEOF;
656             break zzForAction;
657           }
658           else {
659             // store back cached positions
660
zzCurrentPos = zzCurrentPosL;
661             zzMarkedPos = zzMarkedPosL;
662             boolean eof = zzRefill();
663             // get translated positions and possibly new buffer
664
zzCurrentPosL = zzCurrentPos;
665             zzMarkedPosL = zzMarkedPos;
666             zzBufferL = zzBuffer;
667             zzEndReadL = zzEndRead;
668             if (eof) {
669               zzInput = YYEOF;
670               break zzForAction;
671             }
672             else {
673               zzInput = zzBufferL[zzCurrentPosL++];
674             }
675           }
676           int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
677           if (zzNext == -1) break zzForAction;
678           zzState = zzNext;
679
680           int zzAttributes = zzAttrL[zzState];
681           if ( (zzAttributes & 1) == 1 ) {
682             zzAction = zzState;
683             zzMarkedPosL = zzCurrentPosL;
684             if ( (zzAttributes & 8) == 8 ) break zzForAction;
685           }
686
687         }
688       }
689
690       // store back cached position
691
zzMarkedPos = zzMarkedPosL;
692
693       switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
694         case 9:
695           { /* ignore */
696           }
697         case 40: break;
698         case 28:
699           { return newSymbol(Terminals.GOAL );
700           }
701         case 41: break;
702         case 10:
703           { return newSymbol(Terminals.IDENT, yytext());
704           }
705         case 42: break;
706         case 3:
707           { yybegin(EOF_MLN_COMMENT);
708           }
709         case 43: break;
710         case 35:
711           { return newSymbol(Terminals.IMPORT );
712           }
713         case 44: break;
714         case 14:
715           { return newSymbol(Terminals.SEMI );
716           }
717         case 45: break;
718         case 18:
719           { return newSymbol(Terminals.QUESTION );
720           }
721         case 46: break;
722         case 13:
723           { return newSymbol(Terminals.IS );
724           }
725         case 47: break;
726         case 4:
727           { yybegin(EOF_EOL_COMMENT);
728           }
729         case 48: break;
730         case 5:
731           { throw new Scanner.Exception(token_line + 1, token_column + 1, "end of file in Java code");
732           }
733         case 49: break;
734         case 6:
735           { throw new Scanner.Exception(token_line + 1, token_column + 1, "end of file in comment");
736           }
737         case 50: break;
738         case 2:
739           { yybegin(YYINITIAL); matched_text = null; throw new Scanner.Exception(token_line + 1, token_column + 1, "unterminated string");
740           }
741         case 51: break;
742         case 7:
743           { yybegin(YYINITIAL);
744           }
745         case 52: break;
746         case 1:
747           { yybegin(EOF_CODE);
748           }
749         case 53: break;
750         case 33:
751           { return newSymbol(Terminals.CLASS );
752           }
753         case 54: break;
754         case 36:
755           { return newSymbol(Terminals.TYPEOF );
756           }
757         case 55: break;
758         case 16:
759           { return newSymbol(Terminals.DOT );
760           }
761         case 56: break;
762         case 19:
763           { return newSymbol(Terminals.PLUS );
764           }
765         case 57: break;
766         case 11:
767           { token_line = yyline; token_column = yycolumn; yybegin(TEXT);
768           }
769         case 58: break;
770         case 23:
771           { token_line = yyline; token_column = yycolumn; yybegin(CODE);
772           }
773         case 59: break;
774         case 24:
775           { token_line = yyline; token_column = yycolumn; yybegin(MLN_COMMENT);
776           }
777         case 60: break;
778         case 12:
779           { return newSymbol(Terminals.COMMA );
780           }
781         case 61: break;
782         case 21:
783           { matched_text = yytext();
784           }
785         case 62: break;
786         case 22:
787           { yybegin(YYINITIAL); String JavaDoc txt = matched_text; matched_text = null; return new Symbol(Terminals.TEXT, Symbol.makePosition(token_line + 1, token_column + 1), Symbol.makePosition(yyline + 1, yycolumn + 1), txt);
788           }
789         case 63: break;
790         case 25:
791           { token_line = yyline; token_column = yycolumn; yybegin(EOL_COMMENT);
792           }
793         case 64: break;
794         case 34:
795           { return newSymbol(Terminals.HEADER );
796           }
797         case 65: break;
798         case 27:
799           { yybegin(YYINITIAL); return new Symbol(Terminals.CODE, Symbol.makePosition(token_line + 1, token_column + 1), Symbol.makePosition(yyline + 1, yycolumn + 3), matched_text);
800           }
801         case 66: break;
802         case 31:
803           { return newSymbol(Terminals.EMBED );
804           }
805         case 67: break;
806         case 38:
807           { return newSymbol(Terminals.NONASSOC );
808           }
809         case 68: break;
810         case 29:
811           { return newSymbol(Terminals.INIT );
812           }
813         case 69: break;
814         case 17:
815           { return newSymbol(Terminals.BAR );
816           }
817         case 70: break;
818         case 20:
819           { return newSymbol(Terminals.STAR );
820           }
821         case 71: break;
822         case 26:
823           { yypushback(2); matched_text = yytext(); yybegin(CODE_END);
824           }
825         case 72: break;
826         case 30:
827           { return newSymbol(Terminals.LEFT );
828           }
829         case 73: break;
830         case 8:
831           { throw new Scanner.Exception(yyline + 1, yycolumn + 1, "unrecognized character '" + yytext() + "'");
832           }
833         case 74: break;
834         case 39:
835           { return newSymbol(Terminals.TERMINALS);
836           }
837         case 75: break;
838         case 37:
839           { return newSymbol(Terminals.PACKAGE );
840           }
841         case 76: break;
842         case 15:
843           { return newSymbol(Terminals.AT );
844           }
845         case 77: break;
846         case 32:
847           { return newSymbol(Terminals.RIGHT );
848           }
849         case 78: break;
850         default:
851           if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
852             zzAtEOF = true;
853               { return newSymbol(Terminals.EOF, "end-of-file");
854  }
855           }
856           else {
857             zzScanError(ZZ_NO_MATCH);
858           }
859       }
860     }
861   }
862
863
864 }
865
Popular Tags