1 | /* The following code was generated by JFlex 1.4.2 on 11/01/09 11:14 AM */ |
---|
2 | |
---|
3 | /* |
---|
4 | * This program is free software; you can redistribute it and/or modify |
---|
5 | * it under the terms of the GNU General Public License as published by |
---|
6 | * the Free Software Foundation; either version 2 of the License, or |
---|
7 | * (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
17 | */ |
---|
18 | |
---|
19 | /* |
---|
20 | * Scanner.java |
---|
21 | * Copyright (C) 2008 University of Waikato, Hamilton, New Zealand |
---|
22 | */ |
---|
23 | |
---|
24 | package weka.filters.unsupervised.instance.subsetbyexpression; |
---|
25 | |
---|
26 | import java_cup.runtime.SymbolFactory; |
---|
27 | import java.io.*; |
---|
28 | |
---|
29 | /** |
---|
30 | * A scanner for evaluating whether an Instance is to be included in a subset |
---|
31 | * or not. |
---|
32 | * |
---|
33 | * @author FracPete (fracpete at waikato dot ac dot nz) |
---|
34 | * @version $Revision: 4939 $ |
---|
35 | */ |
---|
36 | |
---|
37 | public class Scanner implements java_cup.runtime.Scanner { |
---|
38 | |
---|
39 | /** This character denotes the end of file */ |
---|
40 | public static final int YYEOF = -1; |
---|
41 | |
---|
42 | /** initial size of the lookahead buffer */ |
---|
43 | private static final int ZZ_BUFFERSIZE = 16384; |
---|
44 | |
---|
45 | /** lexical states */ |
---|
46 | public static final int STRING = 2; |
---|
47 | public static final int YYINITIAL = 0; |
---|
48 | |
---|
49 | /** |
---|
50 | * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l |
---|
51 | * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l |
---|
52 | * at the beginning of a line |
---|
53 | * l is of the form l = 2*k, k a non negative integer |
---|
54 | */ |
---|
55 | private static final int ZZ_LEXSTATE[] = { |
---|
56 | 0, 0, 1, 1 |
---|
57 | }; |
---|
58 | |
---|
59 | /** |
---|
60 | * Translates characters to character classes |
---|
61 | */ |
---|
62 | private static final String ZZ_CMAP_PACKED = |
---|
63 | "\11\0\1\43\1\50\1\0\2\43\22\0\1\43\6\0\1\33\1\45"+ |
---|
64 | "\1\46\1\3\1\2\1\44\1\1\1\35\1\4\12\34\2\0\1\5"+ |
---|
65 | "\1\6\1\7\2\0\1\36\1\0\1\40\10\0\1\41\6\0\1\42"+ |
---|
66 | "\1\37\14\0\1\15\1\24\1\31\1\16\1\21\1\22\1\26\1\0"+ |
---|
67 | "\1\10\2\0\1\23\1\47\1\12\1\13\1\30\1\25\1\17\1\11"+ |
---|
68 | "\1\14\1\20\1\0\1\32\1\27\uff87\0"; |
---|
69 | |
---|
70 | /** |
---|
71 | * Translates characters to character classes |
---|
72 | */ |
---|
73 | private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); |
---|
74 | |
---|
75 | /** |
---|
76 | * Translates DFA states to action switch labels. |
---|
77 | */ |
---|
78 | private static final int [] ZZ_ACTION = zzUnpackAction(); |
---|
79 | |
---|
80 | private static final String ZZ_ACTION_PACKED_0 = |
---|
81 | "\2\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+ |
---|
82 | "\1\10\14\1\1\11\1\12\2\1\1\13\1\14\1\15"+ |
---|
83 | "\1\16\1\17\1\20\1\21\1\22\1\23\3\0\1\24"+ |
---|
84 | "\14\0\1\12\3\0\1\25\1\0\1\26\1\27\1\0"+ |
---|
85 | "\1\30\1\31\1\0\1\32\2\0\1\33\1\34\1\35"+ |
---|
86 | "\4\0\1\36\1\37\1\40\2\0\1\41\1\42\2\0"+ |
---|
87 | "\1\43\1\44\1\45\3\0\1\46"; |
---|
88 | |
---|
89 | private static int [] zzUnpackAction() { |
---|
90 | int [] result = new int[89]; |
---|
91 | int offset = 0; |
---|
92 | offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); |
---|
93 | return result; |
---|
94 | } |
---|
95 | |
---|
96 | private static int zzUnpackAction(String packed, int offset, int [] result) { |
---|
97 | int i = 0; /* index in packed string */ |
---|
98 | int j = offset; /* index in unpacked array */ |
---|
99 | int l = packed.length(); |
---|
100 | while (i < l) { |
---|
101 | int count = packed.charAt(i++); |
---|
102 | int value = packed.charAt(i++); |
---|
103 | do result[j++] = value; while (--count > 0); |
---|
104 | } |
---|
105 | return j; |
---|
106 | } |
---|
107 | |
---|
108 | |
---|
109 | /** |
---|
110 | * Translates a state to a row index in the transition table |
---|
111 | */ |
---|
112 | private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); |
---|
113 | |
---|
114 | private static final String ZZ_ROWMAP_PACKED_0 = |
---|
115 | "\0\0\0\51\0\122\0\173\0\122\0\122\0\122\0\244"+ |
---|
116 | "\0\122\0\315\0\366\0\u011f\0\u0148\0\u0171\0\u019a\0\u01c3"+ |
---|
117 | "\0\u01ec\0\u0215\0\u023e\0\u0267\0\u0290\0\u02b9\0\122\0\u02e2"+ |
---|
118 | "\0\u030b\0\u0334\0\122\0\122\0\122\0\122\0\122\0\122"+ |
---|
119 | "\0\122\0\122\0\u035d\0\u0386\0\u03af\0\u03d8\0\122\0\u0401"+ |
---|
120 | "\0\u042a\0\u0453\0\u047c\0\u04a5\0\u04ce\0\u04f7\0\u0520\0\u0549"+ |
---|
121 | "\0\u0572\0\u059b\0\u05c4\0\u05ed\0\u0616\0\u063f\0\u0668\0\122"+ |
---|
122 | "\0\u0691\0\122\0\122\0\u06ba\0\122\0\122\0\u06e3\0\122"+ |
---|
123 | "\0\u070c\0\u0735\0\122\0\122\0\122\0\u075e\0\u0787\0\u07b0"+ |
---|
124 | "\0\u07d9\0\122\0\122\0\122\0\u0802\0\u082b\0\122\0\u0787"+ |
---|
125 | "\0\u0854\0\u087d\0\122\0\122\0\122\0\u08a6\0\u08cf\0\u08f8"+ |
---|
126 | "\0\122"; |
---|
127 | |
---|
128 | private static int [] zzUnpackRowMap() { |
---|
129 | int [] result = new int[89]; |
---|
130 | int offset = 0; |
---|
131 | offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); |
---|
132 | return result; |
---|
133 | } |
---|
134 | |
---|
135 | private static int zzUnpackRowMap(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(); |
---|
139 | while (i < l) { |
---|
140 | int high = packed.charAt(i++) << 16; |
---|
141 | result[j++] = high | packed.charAt(i++); |
---|
142 | } |
---|
143 | return j; |
---|
144 | } |
---|
145 | |
---|
146 | /** |
---|
147 | * The transition table of the DFA |
---|
148 | */ |
---|
149 | private static final int [] ZZ_TRANS = zzUnpackTrans(); |
---|
150 | |
---|
151 | private static final String ZZ_TRANS_PACKED_0 = |
---|
152 | "\1\3\1\4\1\5\1\6\1\7\1\10\1\11\1\12"+ |
---|
153 | "\1\13\1\14\1\15\1\16\1\17\1\20\1\3\1\21"+ |
---|
154 | "\1\3\1\22\1\23\1\24\4\3\1\25\1\26\1\3"+ |
---|
155 | "\1\27\1\30\1\3\1\31\1\3\1\32\2\3\1\33"+ |
---|
156 | "\1\34\1\35\1\36\1\3\1\33\33\37\1\40\14\37"+ |
---|
157 | "\106\0\1\30\22\0\1\41\50\0\1\42\53\0\1\43"+ |
---|
158 | "\47\0\1\44\14\0\1\45\36\0\1\46\54\0\1\47"+ |
---|
159 | "\46\0\1\50\1\0\1\51\43\0\1\52\11\0\1\53"+ |
---|
160 | "\34\0\1\54\67\0\1\55\36\0\1\56\5\0\1\57"+ |
---|
161 | "\40\0\1\60\50\0\1\61\50\0\1\62\5\0\1\63"+ |
---|
162 | "\63\0\1\30\1\64\52\0\1\65\52\0\1\66\56\0"+ |
---|
163 | "\1\67\13\0\1\70\55\0\1\71\45\0\1\72\46\0"+ |
---|
164 | "\1\73\56\0\1\74\46\0\1\75\43\0\1\76\51\0"+ |
---|
165 | "\1\77\66\0\1\100\43\0\1\101\40\0\1\102\63\0"+ |
---|
166 | "\1\103\54\0\1\104\27\0\1\105\47\0\1\106\74\0"+ |
---|
167 | "\1\64\53\0\1\107\47\0\1\110\22\0\1\111\54\0"+ |
---|
168 | "\1\112\55\0\1\113\43\0\1\114\45\0\1\115\52\0"+ |
---|
169 | "\1\116\60\0\1\117\61\0\1\120\56\0\1\121\17\0"+ |
---|
170 | "\1\122\60\0\1\123\46\0\1\124\73\0\1\125\17\0"+ |
---|
171 | "\1\126\47\0\1\127\52\0\1\130\64\0\1\131\22\0"; |
---|
172 | |
---|
173 | private static int [] zzUnpackTrans() { |
---|
174 | int [] result = new int[2337]; |
---|
175 | int offset = 0; |
---|
176 | offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); |
---|
177 | return result; |
---|
178 | } |
---|
179 | |
---|
180 | private static int zzUnpackTrans(String packed, int offset, int [] result) { |
---|
181 | int i = 0; /* index in packed string */ |
---|
182 | int j = offset; /* index in unpacked array */ |
---|
183 | int l = packed.length(); |
---|
184 | while (i < l) { |
---|
185 | int count = packed.charAt(i++); |
---|
186 | int value = packed.charAt(i++); |
---|
187 | value--; |
---|
188 | do result[j++] = value; while (--count > 0); |
---|
189 | } |
---|
190 | return j; |
---|
191 | } |
---|
192 | |
---|
193 | |
---|
194 | /* error codes */ |
---|
195 | private static final int ZZ_UNKNOWN_ERROR = 0; |
---|
196 | private static final int ZZ_NO_MATCH = 1; |
---|
197 | private static final int ZZ_PUSHBACK_2BIG = 2; |
---|
198 | |
---|
199 | /* error messages for the codes above */ |
---|
200 | private static final String ZZ_ERROR_MSG[] = { |
---|
201 | "Unkown internal scanner error", |
---|
202 | "Error: could not match input", |
---|
203 | "Error: pushback value was too large" |
---|
204 | }; |
---|
205 | |
---|
206 | /** |
---|
207 | * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code> |
---|
208 | */ |
---|
209 | private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); |
---|
210 | |
---|
211 | private static final String ZZ_ATTRIBUTE_PACKED_0 = |
---|
212 | "\2\0\1\11\1\1\3\11\1\1\1\11\15\1\1\11"+ |
---|
213 | "\3\1\10\11\1\1\3\0\1\11\14\0\1\1\3\0"+ |
---|
214 | "\1\11\1\0\2\11\1\0\2\11\1\0\1\11\2\0"+ |
---|
215 | "\3\11\4\0\3\11\2\0\1\11\1\1\2\0\3\11"+ |
---|
216 | "\3\0\1\11"; |
---|
217 | |
---|
218 | private static int [] zzUnpackAttribute() { |
---|
219 | int [] result = new int[89]; |
---|
220 | int offset = 0; |
---|
221 | offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); |
---|
222 | return result; |
---|
223 | } |
---|
224 | |
---|
225 | private static int zzUnpackAttribute(String packed, int offset, int [] result) { |
---|
226 | int i = 0; /* index in packed string */ |
---|
227 | int j = offset; /* index in unpacked array */ |
---|
228 | int l = packed.length(); |
---|
229 | while (i < l) { |
---|
230 | int count = packed.charAt(i++); |
---|
231 | int value = packed.charAt(i++); |
---|
232 | do result[j++] = value; while (--count > 0); |
---|
233 | } |
---|
234 | return j; |
---|
235 | } |
---|
236 | |
---|
237 | /** the input device */ |
---|
238 | private java.io.Reader zzReader; |
---|
239 | |
---|
240 | /** the current state of the DFA */ |
---|
241 | private int zzState; |
---|
242 | |
---|
243 | /** the current lexical state */ |
---|
244 | private int zzLexicalState = YYINITIAL; |
---|
245 | |
---|
246 | /** this buffer contains the current text to be matched and is |
---|
247 | the source of the yytext() string */ |
---|
248 | private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; |
---|
249 | |
---|
250 | /** the textposition at the last accepting state */ |
---|
251 | private int zzMarkedPos; |
---|
252 | |
---|
253 | /** the current text position in the buffer */ |
---|
254 | private int zzCurrentPos; |
---|
255 | |
---|
256 | /** startRead marks the beginning of the yytext() string in the buffer */ |
---|
257 | private int zzStartRead; |
---|
258 | |
---|
259 | /** endRead marks the last character in the buffer, that has been read |
---|
260 | from input */ |
---|
261 | private int zzEndRead; |
---|
262 | |
---|
263 | /** number of newlines encountered up to the start of the matched text */ |
---|
264 | private int yyline; |
---|
265 | |
---|
266 | /** the number of characters up to the start of the matched text */ |
---|
267 | private int yychar; |
---|
268 | |
---|
269 | /** |
---|
270 | * the number of characters from the last newline up to the start of the |
---|
271 | * matched text |
---|
272 | */ |
---|
273 | private int yycolumn; |
---|
274 | |
---|
275 | /** |
---|
276 | * zzAtBOL == true <=> the scanner is currently at the beginning of a line |
---|
277 | */ |
---|
278 | private boolean zzAtBOL = true; |
---|
279 | |
---|
280 | /** zzAtEOF == true <=> the scanner is at the EOF */ |
---|
281 | private boolean zzAtEOF; |
---|
282 | |
---|
283 | /* user code: */ |
---|
284 | // Author: FracPete (fracpete at waikato dot ac dot nz) |
---|
285 | // Version: $Revision: 4939 $ |
---|
286 | protected SymbolFactory m_SymFactory; |
---|
287 | |
---|
288 | protected StringBuffer m_String = new StringBuffer(); |
---|
289 | |
---|
290 | public Scanner(InputStream r, SymbolFactory sf) { |
---|
291 | this(r); |
---|
292 | m_SymFactory = sf; |
---|
293 | } |
---|
294 | |
---|
295 | |
---|
296 | /** |
---|
297 | * Creates a new scanner |
---|
298 | * There is also a java.io.InputStream version of this constructor. |
---|
299 | * |
---|
300 | * @param in the java.io.Reader to read input from. |
---|
301 | */ |
---|
302 | public Scanner(java.io.Reader in) { |
---|
303 | this.zzReader = in; |
---|
304 | } |
---|
305 | |
---|
306 | /** |
---|
307 | * Creates a new scanner. |
---|
308 | * There is also java.io.Reader version of this constructor. |
---|
309 | * |
---|
310 | * @param in the java.io.Inputstream to read input from. |
---|
311 | */ |
---|
312 | public Scanner(java.io.InputStream in) { |
---|
313 | this(new java.io.InputStreamReader(in)); |
---|
314 | } |
---|
315 | |
---|
316 | /** |
---|
317 | * Unpacks the compressed character translation table. |
---|
318 | * |
---|
319 | * @param packed the packed character translation table |
---|
320 | * @return the unpacked character translation table |
---|
321 | */ |
---|
322 | private static char [] zzUnpackCMap(String packed) { |
---|
323 | char [] map = new char[0x10000]; |
---|
324 | int i = 0; /* index in packed string */ |
---|
325 | int j = 0; /* index in unpacked array */ |
---|
326 | while (i < 112) { |
---|
327 | int count = packed.charAt(i++); |
---|
328 | char value = packed.charAt(i++); |
---|
329 | do map[j++] = value; while (--count > 0); |
---|
330 | } |
---|
331 | return map; |
---|
332 | } |
---|
333 | |
---|
334 | |
---|
335 | /** |
---|
336 | * Refills the input buffer. |
---|
337 | * |
---|
338 | * @return <code>false</code>, iff there was new input. |
---|
339 | * |
---|
340 | * @exception java.io.IOException if any I/O-Error occurs |
---|
341 | */ |
---|
342 | private boolean zzRefill() throws java.io.IOException { |
---|
343 | |
---|
344 | /* first: make room (if you can) */ |
---|
345 | if (zzStartRead > 0) { |
---|
346 | System.arraycopy(zzBuffer, zzStartRead, |
---|
347 | zzBuffer, 0, |
---|
348 | zzEndRead-zzStartRead); |
---|
349 | |
---|
350 | /* translate stored positions */ |
---|
351 | zzEndRead-= zzStartRead; |
---|
352 | zzCurrentPos-= zzStartRead; |
---|
353 | zzMarkedPos-= zzStartRead; |
---|
354 | zzStartRead = 0; |
---|
355 | } |
---|
356 | |
---|
357 | /* is the buffer big enough? */ |
---|
358 | if (zzCurrentPos >= zzBuffer.length) { |
---|
359 | /* if not: blow it up */ |
---|
360 | char newBuffer[] = new char[zzCurrentPos*2]; |
---|
361 | System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); |
---|
362 | zzBuffer = newBuffer; |
---|
363 | } |
---|
364 | |
---|
365 | /* finally: fill the buffer with new input */ |
---|
366 | int numRead = zzReader.read(zzBuffer, zzEndRead, |
---|
367 | zzBuffer.length-zzEndRead); |
---|
368 | |
---|
369 | if (numRead > 0) { |
---|
370 | zzEndRead+= numRead; |
---|
371 | return false; |
---|
372 | } |
---|
373 | // unlikely but not impossible: read 0 characters, but not at end of stream |
---|
374 | if (numRead == 0) { |
---|
375 | int c = zzReader.read(); |
---|
376 | if (c == -1) { |
---|
377 | return true; |
---|
378 | } else { |
---|
379 | zzBuffer[zzEndRead++] = (char) c; |
---|
380 | return false; |
---|
381 | } |
---|
382 | } |
---|
383 | |
---|
384 | // numRead < 0 |
---|
385 | return true; |
---|
386 | } |
---|
387 | |
---|
388 | |
---|
389 | /** |
---|
390 | * Closes the input stream. |
---|
391 | */ |
---|
392 | public final void yyclose() throws java.io.IOException { |
---|
393 | zzAtEOF = true; /* indicate end of file */ |
---|
394 | zzEndRead = zzStartRead; /* invalidate buffer */ |
---|
395 | |
---|
396 | if (zzReader != null) |
---|
397 | zzReader.close(); |
---|
398 | } |
---|
399 | |
---|
400 | |
---|
401 | /** |
---|
402 | * Resets the scanner to read from a new input stream. |
---|
403 | * Does not close the old reader. |
---|
404 | * |
---|
405 | * All internal variables are reset, the old input stream |
---|
406 | * <b>cannot</b> be reused (internal buffer is discarded and lost). |
---|
407 | * Lexical state is set to <tt>ZZ_INITIAL</tt>. |
---|
408 | * |
---|
409 | * @param reader the new input stream |
---|
410 | */ |
---|
411 | public final void yyreset(java.io.Reader reader) { |
---|
412 | zzReader = reader; |
---|
413 | zzAtBOL = true; |
---|
414 | zzAtEOF = false; |
---|
415 | zzEndRead = zzStartRead = 0; |
---|
416 | zzCurrentPos = zzMarkedPos = 0; |
---|
417 | yyline = yychar = yycolumn = 0; |
---|
418 | zzLexicalState = YYINITIAL; |
---|
419 | } |
---|
420 | |
---|
421 | |
---|
422 | /** |
---|
423 | * Returns the current lexical state. |
---|
424 | */ |
---|
425 | public final int yystate() { |
---|
426 | return zzLexicalState; |
---|
427 | } |
---|
428 | |
---|
429 | |
---|
430 | /** |
---|
431 | * Enters a new lexical state |
---|
432 | * |
---|
433 | * @param newState the new lexical state |
---|
434 | */ |
---|
435 | public final void yybegin(int newState) { |
---|
436 | zzLexicalState = newState; |
---|
437 | } |
---|
438 | |
---|
439 | |
---|
440 | /** |
---|
441 | * Returns the text matched by the current regular expression. |
---|
442 | */ |
---|
443 | public final String yytext() { |
---|
444 | return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); |
---|
445 | } |
---|
446 | |
---|
447 | |
---|
448 | /** |
---|
449 | * Returns the character at position <tt>pos</tt> from the |
---|
450 | * matched text. |
---|
451 | * |
---|
452 | * It is equivalent to yytext().charAt(pos), but faster |
---|
453 | * |
---|
454 | * @param pos the position of the character to fetch. |
---|
455 | * A value from 0 to yylength()-1. |
---|
456 | * |
---|
457 | * @return the character at position pos |
---|
458 | */ |
---|
459 | public final char yycharat(int pos) { |
---|
460 | return zzBuffer[zzStartRead+pos]; |
---|
461 | } |
---|
462 | |
---|
463 | |
---|
464 | /** |
---|
465 | * Returns the length of the matched text region. |
---|
466 | */ |
---|
467 | public final int yylength() { |
---|
468 | return zzMarkedPos-zzStartRead; |
---|
469 | } |
---|
470 | |
---|
471 | |
---|
472 | /** |
---|
473 | * Reports an error that occured while scanning. |
---|
474 | * |
---|
475 | * In a wellformed scanner (no or only correct usage of |
---|
476 | * yypushback(int) and a match-all fallback rule) this method |
---|
477 | * will only be called with things that "Can't Possibly Happen". |
---|
478 | * If this method is called, something is seriously wrong |
---|
479 | * (e.g. a JFlex bug producing a faulty scanner etc.). |
---|
480 | * |
---|
481 | * Usual syntax/scanner level error handling should be done |
---|
482 | * in error fallback rules. |
---|
483 | * |
---|
484 | * @param errorCode the code of the errormessage to display |
---|
485 | */ |
---|
486 | private void zzScanError(int errorCode) { |
---|
487 | String message; |
---|
488 | try { |
---|
489 | message = ZZ_ERROR_MSG[errorCode]; |
---|
490 | } |
---|
491 | catch (ArrayIndexOutOfBoundsException e) { |
---|
492 | message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; |
---|
493 | } |
---|
494 | |
---|
495 | throw new Error(message); |
---|
496 | } |
---|
497 | |
---|
498 | |
---|
499 | /** |
---|
500 | * Pushes the specified amount of characters back into the input stream. |
---|
501 | * |
---|
502 | * They will be read again by then next call of the scanning method |
---|
503 | * |
---|
504 | * @param number the number of characters to be read again. |
---|
505 | * This number must not be greater than yylength()! |
---|
506 | */ |
---|
507 | public void yypushback(int number) { |
---|
508 | if ( number > yylength() ) |
---|
509 | zzScanError(ZZ_PUSHBACK_2BIG); |
---|
510 | |
---|
511 | zzMarkedPos -= number; |
---|
512 | } |
---|
513 | |
---|
514 | |
---|
515 | /** |
---|
516 | * Resumes scanning until the next regular expression is matched, |
---|
517 | * the end of input is encountered or an I/O-Error occurs. |
---|
518 | * |
---|
519 | * @return the next token |
---|
520 | * @exception java.io.IOException if any I/O-Error occurs |
---|
521 | */ |
---|
522 | public java_cup.runtime.Symbol next_token() throws java.io.IOException { |
---|
523 | int zzInput; |
---|
524 | int zzAction; |
---|
525 | |
---|
526 | // cached fields: |
---|
527 | int zzCurrentPosL; |
---|
528 | int zzMarkedPosL; |
---|
529 | int zzEndReadL = zzEndRead; |
---|
530 | char [] zzBufferL = zzBuffer; |
---|
531 | char [] zzCMapL = ZZ_CMAP; |
---|
532 | |
---|
533 | int [] zzTransL = ZZ_TRANS; |
---|
534 | int [] zzRowMapL = ZZ_ROWMAP; |
---|
535 | int [] zzAttrL = ZZ_ATTRIBUTE; |
---|
536 | |
---|
537 | while (true) { |
---|
538 | zzMarkedPosL = zzMarkedPos; |
---|
539 | |
---|
540 | yychar+= zzMarkedPosL-zzStartRead; |
---|
541 | |
---|
542 | zzAction = -1; |
---|
543 | |
---|
544 | zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; |
---|
545 | |
---|
546 | zzState = ZZ_LEXSTATE[zzLexicalState]; |
---|
547 | |
---|
548 | |
---|
549 | zzForAction: { |
---|
550 | while (true) { |
---|
551 | |
---|
552 | if (zzCurrentPosL < zzEndReadL) |
---|
553 | zzInput = zzBufferL[zzCurrentPosL++]; |
---|
554 | else if (zzAtEOF) { |
---|
555 | zzInput = YYEOF; |
---|
556 | break zzForAction; |
---|
557 | } |
---|
558 | else { |
---|
559 | // store back cached positions |
---|
560 | zzCurrentPos = zzCurrentPosL; |
---|
561 | zzMarkedPos = zzMarkedPosL; |
---|
562 | boolean eof = zzRefill(); |
---|
563 | // get translated positions and possibly new buffer |
---|
564 | zzCurrentPosL = zzCurrentPos; |
---|
565 | zzMarkedPosL = zzMarkedPos; |
---|
566 | zzBufferL = zzBuffer; |
---|
567 | zzEndReadL = zzEndRead; |
---|
568 | if (eof) { |
---|
569 | zzInput = YYEOF; |
---|
570 | break zzForAction; |
---|
571 | } |
---|
572 | else { |
---|
573 | zzInput = zzBufferL[zzCurrentPosL++]; |
---|
574 | } |
---|
575 | } |
---|
576 | int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; |
---|
577 | if (zzNext == -1) break zzForAction; |
---|
578 | zzState = zzNext; |
---|
579 | |
---|
580 | int zzAttributes = zzAttrL[zzState]; |
---|
581 | if ( (zzAttributes & 1) == 1 ) { |
---|
582 | zzAction = zzState; |
---|
583 | zzMarkedPosL = zzCurrentPosL; |
---|
584 | if ( (zzAttributes & 8) == 8 ) break zzForAction; |
---|
585 | } |
---|
586 | |
---|
587 | } |
---|
588 | } |
---|
589 | |
---|
590 | // store back cached position |
---|
591 | zzMarkedPos = zzMarkedPosL; |
---|
592 | |
---|
593 | switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { |
---|
594 | case 9: |
---|
595 | { yybegin(STRING); m_String.setLength(0); |
---|
596 | } |
---|
597 | case 39: break; |
---|
598 | case 25: |
---|
599 | { return m_SymFactory.newSymbol("Abs", sym.ABS); |
---|
600 | } |
---|
601 | case 40: break; |
---|
602 | case 1: |
---|
603 | { System.err.println("Illegal character: " + yytext()); |
---|
604 | } |
---|
605 | case 41: break; |
---|
606 | case 15: |
---|
607 | { m_String.append(yytext()); |
---|
608 | } |
---|
609 | case 42: break; |
---|
610 | case 21: |
---|
611 | { return m_SymFactory.newSymbol("Sin", sym.SIN); |
---|
612 | } |
---|
613 | case 43: break; |
---|
614 | case 14: |
---|
615 | { return m_SymFactory.newSymbol("Right Bracket", sym.RPAREN); |
---|
616 | } |
---|
617 | case 44: break; |
---|
618 | case 11: |
---|
619 | { /* ignore white space. */ |
---|
620 | } |
---|
621 | case 45: break; |
---|
622 | case 17: |
---|
623 | { return m_SymFactory.newSymbol("Less or equal than", sym.LE); |
---|
624 | } |
---|
625 | case 46: break; |
---|
626 | case 28: |
---|
627 | { return m_SymFactory.newSymbol("Pow", sym.POW); |
---|
628 | } |
---|
629 | case 47: break; |
---|
630 | case 8: |
---|
631 | { return m_SymFactory.newSymbol("Greater than", sym.GT); |
---|
632 | } |
---|
633 | case 48: break; |
---|
634 | case 16: |
---|
635 | { yybegin(YYINITIAL); return m_SymFactory.newSymbol("String", sym.STRING, new String(m_String.toString())); |
---|
636 | } |
---|
637 | case 49: break; |
---|
638 | case 23: |
---|
639 | { return m_SymFactory.newSymbol("Tan", sym.TAN); |
---|
640 | } |
---|
641 | case 50: break; |
---|
642 | case 12: |
---|
643 | { return m_SymFactory.newSymbol("Comma", sym.COMMA); |
---|
644 | } |
---|
645 | case 51: break; |
---|
646 | case 19: |
---|
647 | { return m_SymFactory.newSymbol("Is", sym.IS); |
---|
648 | } |
---|
649 | case 52: break; |
---|
650 | case 13: |
---|
651 | { return m_SymFactory.newSymbol("Left Bracket", sym.LPAREN); |
---|
652 | } |
---|
653 | case 53: break; |
---|
654 | case 29: |
---|
655 | { return m_SymFactory.newSymbol("Cos", sym.COS); |
---|
656 | } |
---|
657 | case 54: break; |
---|
658 | case 33: |
---|
659 | { return m_SymFactory.newSymbol("Ceil", sym.CEIL); |
---|
660 | } |
---|
661 | case 55: break; |
---|
662 | case 6: |
---|
663 | { return m_SymFactory.newSymbol("Less than", sym.LT); |
---|
664 | } |
---|
665 | case 56: break; |
---|
666 | case 4: |
---|
667 | { return m_SymFactory.newSymbol("Times", sym.TIMES); |
---|
668 | } |
---|
669 | case 57: break; |
---|
670 | case 37: |
---|
671 | { return m_SymFactory.newSymbol("Class", sym.ATTRIBUTE, new String(yytext())); |
---|
672 | } |
---|
673 | case 58: break; |
---|
674 | case 36: |
---|
675 | { return m_SymFactory.newSymbol("Floor", sym.FLOOR); |
---|
676 | } |
---|
677 | case 59: break; |
---|
678 | case 27: |
---|
679 | { return m_SymFactory.newSymbol("Log", sym.LOG); |
---|
680 | } |
---|
681 | case 60: break; |
---|
682 | case 35: |
---|
683 | { return m_SymFactory.newSymbol("False", sym.FALSE); |
---|
684 | } |
---|
685 | case 61: break; |
---|
686 | case 31: |
---|
687 | { return m_SymFactory.newSymbol("True", sym.TRUE); |
---|
688 | } |
---|
689 | case 62: break; |
---|
690 | case 7: |
---|
691 | { return m_SymFactory.newSymbol("Equals", sym.EQ); |
---|
692 | } |
---|
693 | case 63: break; |
---|
694 | case 18: |
---|
695 | { return m_SymFactory.newSymbol("Greater or equal than", sym.GE); |
---|
696 | } |
---|
697 | case 64: break; |
---|
698 | case 26: |
---|
699 | { return m_SymFactory.newSymbol("Exp", sym.EXP); |
---|
700 | } |
---|
701 | case 65: break; |
---|
702 | case 20: |
---|
703 | { return m_SymFactory.newSymbol("Or", sym.OR); |
---|
704 | } |
---|
705 | case 66: break; |
---|
706 | case 34: |
---|
707 | { return m_SymFactory.newSymbol("Attribute", sym.ATTRIBUTE, new String(yytext())); |
---|
708 | } |
---|
709 | case 67: break; |
---|
710 | case 30: |
---|
711 | { return m_SymFactory.newSymbol("Sqrt", sym.SQRT); |
---|
712 | } |
---|
713 | case 68: break; |
---|
714 | case 5: |
---|
715 | { return m_SymFactory.newSymbol("Division", sym.DIVISION); |
---|
716 | } |
---|
717 | case 69: break; |
---|
718 | case 22: |
---|
719 | { return m_SymFactory.newSymbol("Not", sym.NOT); |
---|
720 | } |
---|
721 | case 70: break; |
---|
722 | case 10: |
---|
723 | { return m_SymFactory.newSymbol("Number", sym.NUMBER, new Double(yytext())); |
---|
724 | } |
---|
725 | case 71: break; |
---|
726 | case 3: |
---|
727 | { return m_SymFactory.newSymbol("Plus", sym.PLUS); |
---|
728 | } |
---|
729 | case 72: break; |
---|
730 | case 38: |
---|
731 | { return m_SymFactory.newSymbol("Missing", sym.ISMISSING); |
---|
732 | } |
---|
733 | case 73: break; |
---|
734 | case 32: |
---|
735 | { return m_SymFactory.newSymbol("Rint", sym.RINT); |
---|
736 | } |
---|
737 | case 74: break; |
---|
738 | case 24: |
---|
739 | { return m_SymFactory.newSymbol("And", sym.AND); |
---|
740 | } |
---|
741 | case 75: break; |
---|
742 | case 2: |
---|
743 | { return m_SymFactory.newSymbol("Minus", sym.MINUS); |
---|
744 | } |
---|
745 | case 76: break; |
---|
746 | default: |
---|
747 | if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { |
---|
748 | zzAtEOF = true; |
---|
749 | { return m_SymFactory.newSymbol("EOF",sym.EOF); |
---|
750 | } |
---|
751 | } |
---|
752 | else { |
---|
753 | zzScanError(ZZ_NO_MATCH); |
---|
754 | } |
---|
755 | } |
---|
756 | } |
---|
757 | } |
---|
758 | |
---|
759 | |
---|
760 | } |
---|