KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ppg > lex > Lexer


1 /* The following code was generated by JFlex 1.3.5 on 7/1/05 5:49 PM */
2
3 package ppg.lex;
4
5 import java.io.InputStream JavaDoc;
6 import ppg.parse.*;
7
8
9 /**
10  * This class is a scanner generated by
11  * <a HREF="http://www.jflex.de/">JFlex</a> 1.3.5
12  * on 7/1/05 5:49 PM from the specification file
13  * <tt>file:/Users/nystrom/Research/eclipse/polyglot/src/ppg/lex/ppg.flex</tt>
14  */

15 public class Lexer {
16
17   /** This character denotes the end of file */
18   final public static int YYEOF = -1;
19
20   /** initial size of the lookahead buffer */
21   final private static int YY_BUFFERSIZE = 16384;
22
23   /** lexical states */
24   final public static int CODE = 3;
25   final public static int STRING = 2;
26   final public static int YYINITIAL = 0;
27   final public static int COMMENT = 1;
28
29   /**
30    * Translates characters to character classes
31    */

32   final private static char [] yycmap = {
33      0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 0, 3, 3, 0, 0,
34      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
35     10, 9, 18, 9, 9, 46, 9, 9, 9, 9, 6, 9, 41, 9, 40, 4,
36      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 39, 9, 38, 9, 9,
37     17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 1,
38      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 43, 11, 44, 15, 16,
39     17, 30, 1, 20, 23, 24, 32, 34, 37, 19, 1, 33, 21, 35, 13, 27,
40     28, 1, 26, 31, 14, 22, 29, 36, 25, 1, 1, 42, 45, 8, 17, 0
41   };
42
43   /**
44    * Translates a state to a row index in the transition table
45    */

46   final private static int yy_rowMap [] = {
47         0, 47, 94, 141, 188, 235, 282, 329, 188, 376,
48       188, 423, 470, 188, 517, 564, 611, 658, 705, 752,
49       799, 846, 893, 940, 987, 188, 188, 188, 1034, 188,
50       188, 188, 1081, 1128, 1128, 1175, 188, 1222, 1269, 188,
51      1316, 1316, 1363, 1410, 188, 1457, 1504, 1551, 1598, 235,
52      1645, 1692, 1739, 1786, 1833, 1880, 1927, 1974, 2021, 2068,
53      2115, 2162, 2209, 2256, 188, 2303, 1175, 188, 2350, 2397,
54      2444, 1363, 188, 188, 2491, 2538, 2585, 2632, 2679, 2726,
55      2773, 2820, 2867, 2914, 2961, 3008, 3055, 3102, 3149, 3196,
56      3243, 3290, 3337, 3384, 3431, 3478, 3525, 3572, 3619, 235,
57      3666, 3713, 3760, 235, 235, 235, 3807, 3854, 3901, 3948,
58      3995, 4042, 4089, 4136, 235, 235, 4183, 4230, 4277, 4324,
59      4371, 4418, 4465, 4512, 4559, 235, 4606, 4653, 4700, 4747,
60      4794, 235, 188, 4841, 4888, 4935, 4982, 5029, 5076, 235,
61      5123, 5170, 5217, 5264, 235, 235, 5311, 5358, 5405, 5452,
62       235, 5499, 235, 5546, 5593, 235, 5640, 235, 235, 235,
63      5687, 235, 5734, 5781, 5828, 5875, 5922, 235, 235, 235
64   };
65
66   /**
67    * The packed transition table of the DFA (part 0)
68    */

69   final private static String JavaDoc yy_packed0 =
70     "\1\5\1\6\1\5\1\7\1\10\1\7\1\11\1\12"+
71     "\1\13\1\5\1\7\1\5\1\6\1\14\1\15\3\5"+
72     "\1\16\1\17\1\20\1\21\1\6\1\22\1\23\1\6"+
73     "\1\24\1\25\1\26\1\6\1\27\1\30\4\6\1\31"+
74     "\1\6\1\5\1\32\1\33\1\34\1\35\1\36\1\37"+
75     "\1\40\1\41\5\42\1\43\1\44\50\42\1\45\2\46"+
76     "\1\45\1\46\1\0\5\46\1\47\6\46\1\50\34\46"+
77     "\5\51\1\52\1\51\1\53\47\51\60\0\2\6\11\0"+
78     "\3\6\1\0\1\6\2\0\23\6\14\0\1\7\1\0"+
79     "\1\7\4\0\1\7\50\0\1\54\1\0\1\55\57\0"+
80     "\1\56\50\0\2\6\11\0\3\6\1\0\1\6\2\0"+
81     "\10\6\1\57\12\6\12\0\2\6\11\0\3\6\1\0"+
82     "\1\6\2\0\5\6\1\60\1\6\1\61\1\62\12\6"+
83     "\12\0\2\6\11\0\1\6\1\63\1\6\1\0\1\6"+
84     "\2\0\20\6\1\64\2\6\12\0\2\6\11\0\3\6"+
85     "\1\0\1\6\2\0\10\6\1\65\12\6\12\0\2\6"+
86     "\11\0\3\6\1\0\1\6\2\0\5\6\1\66\15\6"+
87     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\7\6"+
88     "\1\67\13\6\12\0\2\6\11\0\3\6\1\0\1\6"+
89     "\2\0\6\6\1\70\14\6\12\0\2\6\11\0\3\6"+
90     "\1\0\1\6\2\0\1\71\22\6\12\0\2\6\11\0"+
91     "\3\6\1\0\1\6\2\0\12\6\1\72\10\6\12\0"+
92     "\2\6\11\0\3\6\1\0\1\6\2\0\7\6\1\73"+
93     "\3\6\1\74\7\6\12\0\2\6\11\0\3\6\1\0"+
94     "\1\6\2\0\1\6\1\75\21\6\12\0\2\6\11\0"+
95     "\2\6\1\76\1\0\1\6\2\0\1\6\1\77\21\6"+
96     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\1\100"+
97     "\22\6\20\0\1\101\103\0\1\102\22\0\6\43\1\103"+
98     "\54\43\1\104\1\43\1\103\50\43\1\0\2\46\1\0"+
99     "\1\46\1\0\5\46\1\47\6\46\1\50\34\46\2\0"+
100     "\1\105\1\106\1\0\1\106\4\0\1\106\4\46\1\107"+
101     "\2\0\1\46\34\0\7\52\1\110\56\52\1\110\1\111"+
102     "\46\52\5\54\1\0\51\54\46\0\1\112\11\0\2\6"+
103     "\11\0\1\6\1\113\1\6\1\0\1\6\2\0\23\6"+
104     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\7\6"+
105     "\1\114\13\6\12\0\2\6\11\0\3\6\1\0\1\6"+
106     "\2\0\13\6\1\115\7\6\12\0\2\6\11\0\3\6"+
107     "\1\0\1\6\2\0\1\116\1\117\21\6\12\0\2\6"+
108     "\11\0\3\6\1\0\1\6\2\0\11\6\1\120\11\6"+
109     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\4\6"+
110     "\1\121\16\6\12\0\2\6\11\0\3\6\1\0\1\6"+
111     "\2\0\15\6\1\122\5\6\12\0\2\6\11\0\3\6"+
112     "\1\0\1\6\2\0\10\6\1\123\12\6\12\0\2\6"+
113     "\11\0\2\6\1\124\1\0\1\6\2\0\23\6\12\0"+
114     "\2\6\11\0\3\6\1\0\1\6\2\0\17\6\1\125"+
115     "\3\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
116     "\5\6\1\126\15\6\12\0\2\6\11\0\3\6\1\0"+
117     "\1\6\2\0\5\6\1\127\15\6\12\0\2\6\11\0"+
118     "\3\6\1\0\1\6\2\0\1\6\1\130\5\6\1\131"+
119     "\13\6\12\0\2\6\11\0\2\6\1\132\1\0\1\6"+
120     "\2\0\23\6\12\0\2\6\11\0\3\6\1\0\1\6"+
121     "\2\0\13\6\1\133\7\6\12\0\2\6\11\0\3\6"+
122     "\1\0\1\6\2\0\13\6\1\134\7\6\12\0\2\6"+
123     "\11\0\2\6\1\135\1\0\1\6\2\0\23\6\43\0"+
124     "\1\136\26\0\1\137\57\0\1\106\1\0\1\106\4\0"+
125     "\1\106\1\46\44\0\1\46\6\0\1\46\2\0\7\46"+
126     "\1\0\23\46\4\0\4\46\2\0\2\6\11\0\2\6"+
127     "\1\140\1\0\1\6\2\0\13\6\1\141\7\6\12\0"+
128     "\2\6\11\0\3\6\1\0\1\6\2\0\20\6\1\142"+
129     "\2\6\12\0\2\6\11\0\1\6\1\143\1\6\1\0"+
130     "\1\6\2\0\23\6\12\0\2\6\11\0\2\6\1\144"+
131     "\1\0\1\6\2\0\23\6\12\0\2\6\11\0\3\6"+
132     "\1\0\1\6\2\0\2\6\1\145\20\6\12\0\2\6"+
133     "\11\0\3\6\1\0\1\6\2\0\2\6\1\146\5\6"+
134     "\1\147\12\6\12\0\2\6\11\0\3\6\1\0\1\6"+
135     "\2\0\5\6\1\150\15\6\12\0\2\6\11\0\2\6"+
136     "\1\151\1\0\1\6\2\0\23\6\12\0\2\6\11\0"+
137     "\3\6\1\0\1\6\2\0\11\6\1\152\11\6\12\0"+
138     "\2\6\11\0\3\6\1\0\1\6\2\0\5\6\1\153"+
139     "\15\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
140     "\22\6\1\154\12\0\2\6\11\0\3\6\1\0\1\6"+
141     "\2\0\7\6\1\155\13\6\12\0\2\6\11\0\3\6"+
142     "\1\0\1\6\2\0\1\6\1\156\21\6\12\0\2\6"+
143     "\11\0\3\6\1\0\1\6\2\0\16\6\1\157\4\6"+
144     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\14\6"+
145     "\1\160\6\6\12\0\2\6\11\0\3\6\1\0\1\6"+
146     "\2\0\1\161\22\6\12\0\2\6\11\0\3\6\1\0"+
147     "\1\6\2\0\7\6\1\162\13\6\12\0\2\6\11\0"+
148     "\1\6\1\163\1\6\1\0\1\6\2\0\23\6\12\0"+
149     "\2\6\11\0\3\6\1\0\1\6\2\0\22\6\1\164"+
150     "\41\0\1\165\30\0\1\46\55\0\2\6\11\0\3\6"+
151     "\1\0\1\6\2\0\5\6\1\166\15\6\12\0\2\6"+
152     "\11\0\3\6\1\0\1\6\2\0\14\6\1\167\6\6"+
153     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\1\170"+
154     "\22\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
155     "\14\6\1\171\6\6\12\0\2\6\11\0\3\6\1\0"+
156     "\1\6\2\0\3\6\1\172\17\6\12\0\2\6\11\0"+
157     "\3\6\1\0\1\6\2\0\5\6\1\173\15\6\12\0"+
158     "\2\6\11\0\3\6\1\0\1\6\2\0\7\6\1\174"+
159     "\13\6\12\0\2\6\11\0\1\6\1\175\1\6\1\0"+
160     "\1\6\2\0\23\6\12\0\2\6\11\0\2\6\1\176"+
161     "\1\0\1\6\2\0\23\6\12\0\2\6\11\0\3\6"+
162     "\1\0\1\6\2\0\7\6\1\177\13\6\12\0\2\6"+
163     "\11\0\3\6\1\0\1\6\2\0\5\6\1\200\15\6"+
164     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\13\6"+
165     "\1\201\7\6\12\0\2\6\11\0\3\6\1\0\1\6"+
166     "\2\0\5\6\1\202\15\6\12\0\2\6\11\0\3\6"+
167     "\1\0\1\6\2\0\10\6\1\203\12\6\12\0\2\6"+
168     "\11\0\2\6\1\204\1\0\1\6\2\0\23\6\35\0"+
169     "\1\205\33\0\2\6\11\0\3\6\1\0\1\6\2\0"+
170     "\7\6\1\206\13\6\12\0\2\6\11\0\3\6\1\0"+
171     "\1\6\2\0\14\6\1\207\6\6\12\0\2\6\11\0"+
172     "\1\6\1\210\1\6\1\0\1\6\2\0\23\6\12\0"+
173     "\2\6\11\0\3\6\1\0\1\6\2\0\15\6\1\211"+
174     "\5\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
175     "\4\6\1\212\16\6\12\0\2\6\11\0\3\6\1\0"+
176     "\1\6\2\0\20\6\1\213\2\6\12\0\2\6\11\0"+
177     "\2\6\1\214\1\0\1\6\2\0\23\6\12\0\2\6"+
178     "\11\0\3\6\1\0\1\6\2\0\4\6\1\215\16\6"+
179     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\1\216"+
180     "\22\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
181     "\4\6\1\217\16\6\12\0\2\6\11\0\3\6\1\0"+
182     "\1\6\2\0\17\6\1\220\3\6\12\0\2\6\11\0"+
183     "\3\6\1\0\1\6\2\0\7\6\1\221\13\6\12\0"+
184     "\2\6\11\0\1\6\1\222\1\6\1\0\1\6\2\0"+
185     "\23\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
186     "\20\6\1\223\2\6\12\0\2\6\11\0\3\6\1\0"+
187     "\1\6\2\0\10\6\1\224\12\6\12\0\2\6\11\0"+
188     "\3\6\1\0\1\6\2\0\13\6\1\225\7\6\12\0"+
189     "\2\6\11\0\3\6\1\0\1\6\2\0\5\6\1\226"+
190     "\15\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
191     "\5\6\1\227\15\6\12\0\2\6\11\0\3\6\1\0"+
192     "\1\6\2\0\5\6\1\230\15\6\12\0\2\6\11\0"+
193     "\3\6\1\0\1\6\2\0\14\6\1\231\6\6\12\0"+
194     "\2\6\11\0\3\6\1\0\1\6\2\0\4\6\1\232"+
195     "\16\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
196     "\5\6\1\233\15\6\12\0\2\6\11\0\3\6\1\0"+
197     "\1\6\2\0\5\6\1\234\15\6\12\0\2\6\11\0"+
198     "\3\6\1\0\1\6\2\0\1\235\22\6\12\0\2\6"+
199     "\11\0\3\6\1\0\1\6\2\0\1\6\1\236\21\6"+
200     "\12\0\2\6\11\0\3\6\1\0\1\6\2\0\2\6"+
201     "\1\237\20\6\12\0\2\6\11\0\3\6\1\0\1\6"+
202     "\2\0\7\6\1\240\13\6\12\0\2\6\11\0\1\6"+
203     "\1\241\1\6\1\0\1\6\2\0\23\6\12\0\2\6"+
204     "\11\0\3\6\1\0\1\6\2\0\5\6\1\242\15\6"+
205     "\12\0\2\6\11\0\1\6\1\243\1\6\1\0\1\6"+
206     "\2\0\23\6\12\0\2\6\11\0\1\6\1\244\1\6"+
207     "\1\0\1\6\2\0\23\6\12\0\2\6\11\0\2\6"+
208     "\1\245\1\0\1\6\2\0\23\6\12\0\2\6\11\0"+
209     "\3\6\1\0\1\6\2\0\1\6\1\246\21\6\12\0"+
210     "\2\6\11\0\3\6\1\0\1\6\2\0\13\6\1\247"+
211     "\7\6\12\0\2\6\11\0\3\6\1\0\1\6\2\0"+
212     "\14\6\1\250\6\6\12\0\2\6\11\0\3\6\1\0"+
213     "\1\6\2\0\5\6\1\251\15\6\12\0\2\6\11\0"+
214     "\3\6\1\0\1\6\2\0\2\6\1\252\20\6\11\0";
215
216   /**
217    * The transition table of the DFA
218    */

219   final private static int yytrans [] = yy_unpack();
220
221
222   /* error codes */
223   final private static int YY_UNKNOWN_ERROR = 0;
224   final private static int YY_ILLEGAL_STATE = 1;
225   final private static int YY_NO_MATCH = 2;
226   final private static int YY_PUSHBACK_2BIG = 3;
227
228   /* error messages for the codes above */
229   final private static String JavaDoc YY_ERROR_MSG[] = {
230     "Unkown internal scanner error",
231     "Internal error: unknown state",
232     "Error: could not match input",
233     "Error: pushback value was too large"
234   };
235
236   /**
237    * YY_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
238    */

239   private final static byte YY_ATTRIBUTE[] = {
240      0, 0, 1, 0, 9, 1, 1, 1, 9, 1, 9, 1, 1, 9, 1, 1,
241      1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 1, 9, 9, 9,
242      1, 1, 0, 1, 9, 1, 1, 9, 1, 0, 1, 1, 9, 0, 1, 1,
243      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
244      9, 0, 0, 9, 0, 0, 0, 0, 9, 9, 1, 1, 1, 1, 1, 1,
245      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1,
246      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
247      1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
248      1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
249      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
250      1, 1, 1, 1, 1, 1, 1, 1, 1, 1
251   };
252
253   /** the input device */
254   private java.io.Reader JavaDoc yy_reader;
255
256   /** the current state of the DFA */
257   private int yy_state;
258
259   /** the current lexical state */
260   private int yy_lexical_state = YYINITIAL;
261
262   /** this buffer contains the current text to be matched and is
263       the source of the yytext() string */

264   private char yy_buffer[] = new char[YY_BUFFERSIZE];
265
266   /** the textposition at the last accepting state */
267   private int yy_markedPos;
268
269   /** the textposition at the last state to be included in yytext */
270   private int yy_pushbackPos;
271
272   /** the current text position in the buffer */
273   private int yy_currentPos;
274
275   /** startRead marks the beginning of the yytext() string in the buffer */
276   private int yy_startRead;
277
278   /** endRead marks the last character in the buffer, that has been read
279       from input */

280   private int yy_endRead;
281
282   /** number of newlines encountered up to the start of the matched text */
283   private int yyline;
284
285   /** the number of characters up to the start of the matched text */
286   private int yychar;
287
288   /**
289    * the number of characters from the last newline up to the start of the
290    * matched text
291    */

292   private int yycolumn;
293
294   /**
295    * yy_atBOL == true <=> the scanner is currently at the beginning of a line
296    */

297   private boolean yy_atBOL = true;
298
299   /** yy_atEOF == true <=> the scanner is at the EOF */
300   private boolean yy_atEOF;
301
302   /* user code: */
303
304     private int lastId = -1;
305     private String JavaDoc filename = "";
306     private String JavaDoc lineSeparator;
307 /*
308     private Position pos() {
309         return new Position(filename, yyline+1, yycolumn);
310     }
311 */

312     public Lexer(InputStream JavaDoc in, String JavaDoc filename) {
313         this(in);
314         this.filename = filename;
315     }
316
317     private void error(String JavaDoc message) throws LexicalError {
318         throw new LexicalError(filename, yyline+1, message);
319     }
320
321     private Token t(int id, Object JavaDoc value) {
322         lastId = id;
323         return new Token(id, filename, yyline + 1, yychar, yychar + yylength(), value);
324     }
325
326     private Token t(int id) {
327         return t(id, yytext());
328     }
329
330
331
332   /**
333    * Creates a new scanner
334    * There is also a java.io.InputStream version of this constructor.
335    *
336    * @param in the java.io.Reader to read input from.
337    */

338   public Lexer(java.io.Reader JavaDoc in) {
339       lineSeparator = System.getProperty("line.separator", "\n");
340     this.yy_reader = in;
341   }
342
343   /**
344    * Creates a new scanner.
345    * There is also java.io.Reader version of this constructor.
346    *
347    * @param in the java.io.Inputstream to read input from.
348    */

349   public Lexer(java.io.InputStream JavaDoc in) {
350     this(new java.io.InputStreamReader JavaDoc(in));
351   }
352
353   /**
354    * Unpacks the split, compressed DFA transition table.
355    *
356    * @return the unpacked transition table
357    */

358   private static int [] yy_unpack() {
359     int [] trans = new int[5969];
360     int offset = 0;
361     offset = yy_unpack(yy_packed0, offset, trans);
362     return trans;
363   }
364
365   /**
366    * Unpacks the compressed DFA transition table.
367    *
368    * @param packed the packed transition table
369    * @return the index of the last entry
370    */

371   private static int yy_unpack(String JavaDoc packed, int offset, int [] trans) {
372     int i = 0; /* index in packed string */
373     int j = offset; /* index in unpacked array */
374     int l = packed.length();
375     while (i < l) {
376       int count = packed.charAt(i++);
377       int value = packed.charAt(i++);
378       value--;
379       do trans[j++] = value; while (--count > 0);
380     }
381     return j;
382   }
383
384
385   /**
386    * Refills the input buffer.
387    *
388    * @return <code>false</code>, iff there was new input.
389    *
390    * @exception IOException if any I/O-Error occurs
391    */

392   private boolean yy_refill() throws java.io.IOException JavaDoc {
393
394     /* first: make room (if you can) */
395     if (yy_startRead > 0) {
396       System.arraycopy(yy_buffer, yy_startRead,
397                        yy_buffer, 0,
398                        yy_endRead-yy_startRead);
399
400       /* translate stored positions */
401       yy_endRead-= yy_startRead;
402       yy_currentPos-= yy_startRead;
403       yy_markedPos-= yy_startRead;
404       yy_pushbackPos-= yy_startRead;
405       yy_startRead = 0;
406     }
407
408     /* is the buffer big enough? */
409     if (yy_currentPos >= yy_buffer.length) {
410       /* if not: blow it up */
411       char newBuffer[] = new char[yy_currentPos*2];
412       System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
413       yy_buffer = newBuffer;
414     }
415
416     /* finally: fill the buffer with new input */
417     int numRead = yy_reader.read(yy_buffer, yy_endRead,
418                                             yy_buffer.length-yy_endRead);
419
420     if (numRead < 0) {
421       return true;
422     }
423     else {
424       yy_endRead+= numRead;
425       return false;
426     }
427   }
428
429
430   /**
431    * Closes the input stream.
432    */

433   final public void yyclose() throws java.io.IOException JavaDoc {
434     yy_atEOF = true; /* indicate end of file */
435     yy_endRead = yy_startRead; /* invalidate buffer */
436
437     if (yy_reader != null)
438       yy_reader.close();
439   }
440
441
442   /**
443    * Closes the current stream, and resets the
444    * scanner to read from a new input stream.
445    *
446    * All internal variables are reset, the old input stream
447    * <b>cannot</b> be reused (internal buffer is discarded and lost).
448    * Lexical state is set to <tt>YY_INITIAL</tt>.
449    *
450    * @param reader the new input stream
451    */

452   final public void yyreset(java.io.Reader JavaDoc reader) throws java.io.IOException JavaDoc {
453     yyclose();
454     yy_reader = reader;
455     yy_atBOL = true;
456     yy_atEOF = false;
457     yy_endRead = yy_startRead = 0;
458     yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
459     yyline = yychar = yycolumn = 0;
460     yy_lexical_state = YYINITIAL;
461   }
462
463
464   /**
465    * Returns the current lexical state.
466    */

467   final public int yystate() {
468     return yy_lexical_state;
469   }
470
471
472   /**
473    * Enters a new lexical state
474    *
475    * @param newState the new lexical state
476    */

477   final public void yybegin(int newState) {
478     yy_lexical_state = newState;
479   }
480
481
482   /**
483    * Returns the text matched by the current regular expression.
484    */

485   final public String JavaDoc yytext() {
486     return new String JavaDoc( yy_buffer, yy_startRead, yy_markedPos-yy_startRead );
487   }
488
489
490   /**
491    * Returns the character at position <tt>pos</tt> from the
492    * matched text.
493    *
494    * It is equivalent to yytext().charAt(pos), but faster
495    *
496    * @param pos the position of the character to fetch.
497    * A value from 0 to yylength()-1.
498    *
499    * @return the character at position pos
500    */

501   final public char yycharat(int pos) {
502     return yy_buffer[yy_startRead+pos];
503   }
504
505
506   /**
507    * Returns the length of the matched text region.
508    */

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

528   private void yy_ScanError(int errorCode) {
529     String JavaDoc message;
530     try {
531       message = YY_ERROR_MSG[errorCode];
532     }
533     catch (ArrayIndexOutOfBoundsException JavaDoc e) {
534       message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
535     }
536
537     throw new Error JavaDoc(message);
538   }
539
540
541   /**
542    * Pushes the specified amount of characters back into the input stream.
543    *
544    * They will be read again by then next call of the scanning method
545    *
546    * @param number the number of characters to be read again.
547    * This number must not be greater than yylength()!
548    */

549   private void yypushback(int number) {
550     if ( number > yylength() )
551       yy_ScanError(YY_PUSHBACK_2BIG);
552
553     yy_markedPos -= number;
554   }
555
556
557   /**
558    * Resumes scanning until the next regular expression is matched,
559    * the end of input is encountered or an I/O-Error occurs.
560    *
561    * @return the next token
562    * @exception IOException if any I/O-Error occurs
563    */

564   public Token getToken() throws java.io.IOException JavaDoc, LexicalError
565  {
566     int yy_input;
567     int yy_action;
568
569     // cached fields:
570
int yy_currentPos_l;
571     int yy_startRead_l;
572     int yy_markedPos_l;
573     int yy_endRead_l = yy_endRead;
574     char [] yy_buffer_l = yy_buffer;
575     char [] yycmap_l = yycmap;
576
577     int [] yytrans_l = yytrans;
578     int [] yy_rowMap_l = yy_rowMap;
579     byte [] yy_attr_l = YY_ATTRIBUTE;
580
581     while (true) {
582       yy_markedPos_l = yy_markedPos;
583
584       yychar+= yy_markedPos_l-yy_startRead;
585
586       boolean yy_r = false;
587       for (yy_currentPos_l = yy_startRead; yy_currentPos_l < yy_markedPos_l;
588                                                              yy_currentPos_l++) {
589         switch (yy_buffer_l[yy_currentPos_l]) {
590         case '\u000B':
591         case '\u000C':
592         case '\u0085':
593         case '\u2028':
594         case '\u2029':
595           yyline++;
596           yy_r = false;
597           break;
598         case '\r':
599           yyline++;
600           yy_r = true;
601           break;
602         case '\n':
603           if (yy_r)
604             yy_r = false;
605           else {
606             yyline++;
607           }
608           break;
609         default:
610           yy_r = false;
611         }
612       }
613
614       if (yy_r) {
615         // peek one character ahead if it is \n (if we have counted one line too much)
616
boolean yy_peek;
617         if (yy_markedPos_l < yy_endRead_l)
618           yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
619         else if (yy_atEOF)
620           yy_peek = false;
621         else {
622           boolean eof = yy_refill();
623           yy_markedPos_l = yy_markedPos;
624           yy_buffer_l = yy_buffer;
625           if (eof)
626             yy_peek = false;
627           else
628             yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
629         }
630         if (yy_peek) yyline--;
631       }
632       yy_action = -1;
633
634       yy_startRead_l = yy_currentPos_l = yy_currentPos =
635                        yy_startRead = yy_markedPos_l;
636
637       yy_state = yy_lexical_state;
638
639
640       yy_forAction: {
641         while (true) {
642
643           if (yy_currentPos_l < yy_endRead_l)
644             yy_input = yy_buffer_l[yy_currentPos_l++];
645           else if (yy_atEOF) {
646             yy_input = YYEOF;
647             break yy_forAction;
648           }
649           else {
650             // store back cached positions
651
yy_currentPos = yy_currentPos_l;
652             yy_markedPos = yy_markedPos_l;
653             boolean eof = yy_refill();
654             // get translated positions and possibly new buffer
655
yy_currentPos_l = yy_currentPos;
656             yy_markedPos_l = yy_markedPos;
657             yy_buffer_l = yy_buffer;
658             yy_endRead_l = yy_endRead;
659             if (eof) {
660               yy_input = YYEOF;
661               break yy_forAction;
662             }
663             else {
664               yy_input = yy_buffer_l[yy_currentPos_l++];
665             }
666           }
667           int yy_next = yytrans_l[ yy_rowMap_l[yy_state] + yycmap_l[yy_input] ];
668           if (yy_next == -1) break yy_forAction;
669           yy_state = yy_next;
670
671           int yy_attributes = yy_attr_l[yy_state];
672           if ( (yy_attributes & 1) == 1 ) {
673             yy_action = yy_state;
674             yy_markedPos_l = yy_currentPos_l;
675             if ( (yy_attributes & 8) == 8 ) break yy_forAction;
676           }
677
678         }
679       }
680
681       // store back cached position
682
yy_markedPos = yy_markedPos_l;
683
684       switch (yy_action) {
685
686         case 5:
687         case 11:
688         case 12:
689         case 14:
690         case 15:
691         case 16:
692         case 17:
693         case 18:
694         case 19:
695         case 20:
696         case 21:
697         case 22:
698         case 23:
699         case 24:
700         case 46:
701         case 47:
702         case 48:
703         case 50:
704         case 51:
705         case 52:
706         case 53:
707         case 54:
708         case 55:
709         case 56:
710         case 57:
711         case 58:
712         case 59:
713         case 60:
714         case 61:
715         case 62:
716         case 63:
717         case 75:
718         case 76:
719         case 77:
720         case 78:
721         case 79:
722         case 80:
723         case 81:
724         case 82:
725         case 83:
726         case 84:
727         case 85:
728         case 86:
729         case 87:
730         case 88:
731         case 89:
732         case 90:
733         case 91:
734         case 92:
735         case 95:
736         case 96:
737         case 97:
738         case 98:
739         case 100:
740         case 101:
741         case 102:
742         case 106:
743         case 107:
744         case 108:
745         case 109:
746         case 110:
747         case 111:
748         case 112:
749         case 113:
750         case 117:
751         case 118:
752         case 119:
753         case 120:
754         case 121:
755         case 122:
756         case 123:
757         case 124:
758         case 126:
759         case 127:
760         case 128:
761         case 129:
762         case 130:
763         case 133:
764         case 134:
765         case 135:
766         case 136:
767         case 137:
768         case 138:
769         case 141:
770         case 142:
771         case 143:
772         case 146:
773         case 147:
774         case 148:
775         case 149:
776         case 151:
777         case 153:
778         case 154:
779         case 156:
780         case 160:
781         case 162:
782         case 163:
783         case 164:
784         case 165:
785         case 166:
786           { return t(Constant.ID, yytext().intern()); }
787         case 171: break;
788         case 64:
789           { yybegin (CODE); }
790         case 172: break;
791         case 155:
792           { return t(Constant.PACKAGE); }
793         case 173: break;
794         case 152:
795           { return t(Constant.EXTENDS); }
796         case 174: break;
797         case 150:
798           { return t(Constant.INCLUDE); }
799         case 175: break;
800         case 145:
801           { return t(Constant.ACTION); }
802         case 176: break;
803         case 144:
804           { return t(Constant.PARSER); }
805         case 177: break;
806         case 140:
807           { return t(Constant.EXTEND); }
808         case 178: break;
809         case 139:
810           { return t(Constant.IMPORT); }
811         case 179: break;
812         case 132:
813           { return t(Constant.PERCENT_PREC); }
814         case 180: break;
815         case 30:
816           { return t(Constant.RBRACK); }
817         case 181: break;
818         case 29:
819           { return t(Constant.LBRACK); }
820         case 182: break;
821         case 28:
822           { return t(Constant.LBRACE); }
823         case 183: break;
824         case 10:
825           { return t(Constant.RBRACE); }
826         case 184: break;
827         case 39:
828           {
829     yybegin(YYINITIAL);
830     String JavaDoc literal = yytext();
831     return t(Constant.STRING_CONST, literal.substring(0, literal.length()-1));
832  }
833         case 185: break;
834         case 131:
835           { return t(Constant.START); }
836         case 186: break;
837         case 27:
838           { return t(Constant.COMMA); }
839         case 187: break;
840         case 25:
841           { return t(Constant.SEMI); }
842         case 188: break;
843         case 8:
844           { return t(Constant.STAR); }
845         case 189: break;
846         case 9:
847           { return t(Constant.COLON); }
848         case 190: break;
849         case 99:
850           { return t(Constant.INIT); }
851         case 191: break;
852         case 103:
853           { return t(Constant.CODE); }
854         case 192: break;
855         case 104:
856           { return t(Constant.LEFT); }
857         case 193: break;
858         case 105:
859           { return t(Constant.DROP); }
860         case 194: break;
861         case 114:
862           { return t(Constant.SCAN); }
863         case 195: break;
864         case 115:
865           { return t(Constant.WITH); }
866         case 196: break;
867         case 125:
868           { return t(Constant.RIGHT); }
869         case 197: break;
870         case 169:
871           { return t(Constant.NONTERMINAL); }
872         case 198: break;
873         case 168:
874           { return t(Constant.PRECEDENCE); }
875         case 199: break;
876         case 167:
877           { return t(Constant.IMPLEMENTS); }
878         case 200: break;
879         case 31:
880           { return t(Constant.BAR); }
881         case 201: break;
882         case 26:
883           { return t(Constant.DOT); }
884         case 202: break;
885         case 49:
886           { return t(Constant.TO); }
887         case 203: break;
888         case 74:
889           { return t(Constant.NON); }
890         case 204: break;
891         case 36:
892           {
893     error("Illegal character in string literal: " + yytext());
894  }
895         case 205: break;
896         case 72:
897           {
898     yybegin(YYINITIAL);
899     String JavaDoc codeStr = yytext();
900     // cut off ":}" from the end of the code string
901
return t(Constant.CODE_STR, codeStr.substring(0, codeStr.length()-2));
902  }
903         case 206: break;
904         case 161:
905           { return t(Constant.OVERRIDE); }
906         case 207: break;
907         case 159:
908           { return t(Constant.TRANSFER); }
909         case 208: break;
910         case 158:
911           { return t(Constant.TERMINAL); }
912         case 209: break;
913         case 157:
914           { return t(Constant.NONASSOC); }
915         case 210: break;
916         case 4:
917         case 7:
918         case 32:
919           {
920     error("Invalid character: " + yytext());
921  }
922         case 211: break;
923         case 67:
924           { yybegin (YYINITIAL); }
925         case 212: break;
926         case 33:
927         case 35:
928           {
929     error("Illegal comment");
930  }
931         case 213: break;
932         case 38:
933           {
934     error("Illegal escape character");
935  }
936         case 214: break;
937         case 73:
938           { return t(Constant.COLON_COLON_EQUALS); }
939         case 215: break;
940         case 2:
941         case 37:
942           {
943     error("Unclosed string literal");
944  }
945         case 216: break;
946         case 40:
947         case 42:
948           {
949     error("Invalid character in code block: '" + yytext() + "'");
950  }
951         case 217: break;
952         case 13:
953           { yybegin(STRING); }
954         case 218: break;
955         case 44:
956           { yybegin (COMMENT); }
957         case 219: break;
958         case 6:
959           { }
960         case 220: break;
961         case 43:
962           { }
963         case 221: break;
964         default:
965           if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
966             yy_atEOF = true;
967               { return t(Constant.EOF, "EOF");
968     //return Constant.EOF;
969
}
970           }
971           else {
972             yy_ScanError(YY_NO_MATCH);
973           }
974       }
975     }
976   }
977
978
979 }
980
Popular Tags