0e9d534c17bcaa30e1d1a01cda8f6f6f7eb9ec1f
[iot2.git] / iotjava / iotpolicy / parser / Lexer.java
1 /* The following code was generated by JFlex 1.6.1 */
2
3 // JFlex parser specification written by
4 // Rahmadi Trimananda
5 // for Sentinel system
6 // University of California, Irvine
7
8 // Technische Universitaet Muenchen 
9 // Fakultaet fuer Informatik 
10 package iotpolicy.parser;
11
12 import java_cup.runtime.Symbol;
13 import java_cup.runtime.ComplexSymbolFactory;
14 import java_cup.runtime.ComplexSymbolFactory.Location;
15
16
17 /**
18  * This class is a scanner generated by 
19  * <a href="http://www.jflex.de/">JFlex</a> 1.6.1
20  * from the specification file <tt>iotparser.jflex</tt>
21  */
22 public class Lexer implements java_cup.runtime.Scanner, sym {
23
24   /** This character denotes the end of file */
25   public static final int YYEOF = -1;
26
27   /** initial size of the lookahead buffer */
28   private static final int ZZ_BUFFERSIZE = 16384;
29
30   /** lexical states */
31   public static final int YYINITIAL = 0;
32   public static final int STRING = 2;
33
34   /**
35    * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
36    * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
37    *                  at the beginning of a line
38    * l is of the form l = 2*k, k a non negative integer
39    */
40   private static final int ZZ_LEXSTATE[] = { 
41      0,  0,  1, 1
42   };
43
44   /** 
45    * Translates characters to character classes
46    */
47   private static final String ZZ_CMAP_PACKED = 
48     "\11\0\1\6\1\4\1\46\1\6\1\3\22\0\1\6\1\0\1\36"+
49     "\1\0\1\1\3\0\1\40\1\41\2\0\1\37\3\0\12\2\1\0"+
50     "\1\5\1\2\1\44\1\2\2\0\22\1\1\30\7\1\1\0\1\45"+
51     "\2\0\1\1\1\0\1\24\1\16\1\27\1\25\1\20\1\23\1\22"+
52     "\1\13\1\7\2\1\1\21\1\33\1\10\1\14\1\32\1\34\1\15"+
53     "\1\12\1\11\1\26\1\31\1\35\1\1\1\17\1\1\1\42\1\0"+
54     "\1\43\7\0\1\46\u1fa2\0\1\46\1\46\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\udfe6\0";
55
56   /** 
57    * Translates characters to character classes
58    */
59   private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
60
61   /** 
62    * Translates DFA states to action switch labels.
63    */
64   private static final int [] ZZ_ACTION = zzUnpackAction();
65
66   private static final String ZZ_ACTION_PACKED_0 =
67     "\2\0\1\1\1\2\2\3\1\4\16\2\1\5\1\6"+
68     "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16"+
69     "\1\0\10\2\1\17\11\2\1\20\1\21\1\22\1\23"+
70     "\1\24\25\2\1\25\1\26\3\2\1\27\2\2\1\30"+
71     "\2\2\1\31\2\2\1\32\2\2\1\33\7\2\1\34"+
72     "\2\2\1\35\2\2\1\36\1\37\1\40\2\2\1\41"+
73     "\3\2\1\42\2\2\1\43\3\2\1\44\1\45";
74
75   private static int [] zzUnpackAction() {
76     int [] result = new int[125];
77     int offset = 0;
78     offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
79     return result;
80   }
81
82   private static int zzUnpackAction(String packed, int offset, int [] result) {
83     int i = 0;       /* index in packed string  */
84     int j = offset;  /* index in unpacked array */
85     int l = packed.length();
86     while (i < l) {
87       int count = packed.charAt(i++);
88       int value = packed.charAt(i++);
89       do result[j++] = value; while (--count > 0);
90     }
91     return j;
92   }
93
94
95   /** 
96    * Translates a state to a row index in the transition table
97    */
98   private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
99
100   private static final String ZZ_ROWMAP_PACKED_0 =
101     "\0\0\0\47\0\116\0\165\0\234\0\116\0\116\0\303"+
102     "\0\352\0\u0111\0\u0138\0\u015f\0\u0186\0\u01ad\0\u01d4\0\u01fb"+
103     "\0\u0222\0\u0249\0\u0270\0\u0297\0\u02be\0\116\0\116\0\116"+
104     "\0\116\0\116\0\116\0\116\0\u02e5\0\116\0\u030c\0\u0333"+
105     "\0\u035a\0\u0381\0\u03a8\0\u03cf\0\u03f6\0\u041d\0\u0444\0\u046b"+
106     "\0\165\0\u0492\0\u04b9\0\u04e0\0\u0507\0\u052e\0\u0555\0\u057c"+
107     "\0\u05a3\0\u05ca\0\116\0\116\0\116\0\116\0\u05f1\0\u0618"+
108     "\0\u063f\0\u0666\0\u068d\0\u06b4\0\u06db\0\u0702\0\u0729\0\u0750"+
109     "\0\u0777\0\u079e\0\u07c5\0\u07ec\0\u0813\0\u083a\0\u0861\0\u0888"+
110     "\0\u08af\0\u08d6\0\u08fd\0\u0924\0\165\0\165\0\u094b\0\u0972"+
111     "\0\u0999\0\165\0\u09c0\0\u09e7\0\165\0\u0a0e\0\u0a35\0\165"+
112     "\0\u0a5c\0\u0a83\0\165\0\u0aaa\0\u0ad1\0\165\0\u0af8\0\u0b1f"+
113     "\0\u0b46\0\u0b6d\0\u0b94\0\u0bbb\0\u0be2\0\165\0\u0c09\0\u0c30"+
114     "\0\165\0\u0c57\0\u0c7e\0\165\0\165\0\165\0\u0ca5\0\u0ccc"+
115     "\0\165\0\u0cf3\0\u0d1a\0\u0d41\0\165\0\u0d68\0\u0d8f\0\165"+
116     "\0\u0db6\0\u0ddd\0\u0e04\0\165\0\165";
117
118   private static int [] zzUnpackRowMap() {
119     int [] result = new int[125];
120     int offset = 0;
121     offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
122     return result;
123   }
124
125   private static int zzUnpackRowMap(String packed, int offset, int [] result) {
126     int i = 0;  /* index in packed string  */
127     int j = offset;  /* index in unpacked array */
128     int l = packed.length();
129     while (i < l) {
130       int high = packed.charAt(i++) << 16;
131       result[j++] = high | packed.charAt(i++);
132     }
133     return j;
134   }
135
136   /** 
137    * The transition table of the DFA
138    */
139   private static final int [] ZZ_TRANS = zzUnpackTrans();
140
141   private static final String ZZ_TRANS_PACKED_0 =
142     "\1\3\1\4\1\3\1\5\1\6\1\7\1\6\1\10"+
143     "\2\4\1\11\2\4\1\12\1\13\2\4\1\14\1\4"+
144     "\1\15\1\16\1\17\1\4\1\20\1\21\1\22\1\23"+
145     "\1\24\1\4\1\25\1\26\1\27\1\30\1\31\1\32"+
146     "\1\33\1\34\1\3\1\0\3\35\1\0\1\3\31\35"+
147     "\1\36\6\35\1\37\1\35\50\0\2\4\4\0\27\4"+
148     "\15\0\1\40\43\0\2\4\4\0\1\4\1\41\25\4"+
149     "\12\0\2\4\4\0\2\4\1\42\1\4\1\43\22\4"+
150     "\12\0\2\4\4\0\11\4\1\44\15\4\12\0\2\4"+
151     "\4\0\5\4\1\45\2\4\1\46\16\4\12\0\2\4"+
152     "\4\0\5\4\1\47\21\4\12\0\2\4\4\0\12\4"+
153     "\1\50\14\4\12\0\2\4\4\0\3\4\1\51\23\4"+
154     "\12\0\2\4\4\0\5\4\1\52\3\4\1\53\15\4"+
155     "\12\0\2\4\4\0\4\4\1\54\10\4\1\55\11\4"+
156     "\12\0\2\4\4\0\2\4\1\56\24\4\12\0\2\4"+
157     "\4\0\5\4\1\57\21\4\12\0\2\4\4\0\17\4"+
158     "\1\60\7\4\12\0\2\4\4\0\11\4\1\61\15\4"+
159     "\12\0\2\4\4\0\1\62\26\4\11\0\3\35\2\0"+
160     "\31\35\1\0\6\35\1\0\1\35\10\0\1\63\1\64"+
161     "\3\0\1\65\20\0\1\66\15\0\1\6\42\0\2\4"+
162     "\4\0\2\4\1\67\24\4\12\0\2\4\4\0\6\4"+
163     "\1\70\20\4\12\0\2\4\4\0\5\4\1\71\21\4"+
164     "\12\0\2\4\4\0\25\4\1\72\1\4\12\0\2\4"+
165     "\4\0\5\4\1\73\21\4\12\0\2\4\4\0\2\4"+
166     "\1\74\24\4\12\0\2\4\4\0\1\4\1\75\25\4"+
167     "\12\0\2\4\4\0\5\4\1\76\21\4\12\0\2\4"+
168     "\4\0\17\4\1\77\7\4\12\0\2\4\4\0\3\4"+
169     "\1\100\23\4\12\0\2\4\4\0\15\4\1\101\11\4"+
170     "\12\0\2\4\4\0\23\4\1\102\3\4\12\0\2\4"+
171     "\4\0\6\4\1\103\20\4\12\0\2\4\4\0\1\104"+
172     "\26\4\12\0\2\4\4\0\7\4\1\105\17\4\12\0"+
173     "\2\4\4\0\2\4\1\106\24\4\12\0\2\4\4\0"+
174     "\2\4\1\107\24\4\12\0\2\4\4\0\11\4\1\110"+
175     "\15\4\12\0\2\4\4\0\1\111\26\4\12\0\2\4"+
176     "\4\0\6\4\1\112\20\4\12\0\2\4\4\0\17\4"+
177     "\1\113\7\4\12\0\2\4\4\0\12\4\1\114\14\4"+
178     "\12\0\2\4\4\0\11\4\1\115\15\4\12\0\2\4"+
179     "\4\0\13\4\1\116\13\4\12\0\2\4\4\0\15\4"+
180     "\1\117\11\4\12\0\2\4\4\0\7\4\1\120\17\4"+
181     "\12\0\2\4\4\0\20\4\1\121\6\4\12\0\2\4"+
182     "\4\0\6\4\1\122\20\4\12\0\2\4\4\0\15\4"+
183     "\1\123\11\4\12\0\2\4\4\0\1\124\26\4\12\0"+
184     "\2\4\4\0\16\4\1\125\10\4\12\0\2\4\4\0"+
185     "\12\4\1\126\14\4\12\0\2\4\4\0\4\4\1\127"+
186     "\22\4\12\0\2\4\4\0\4\4\1\130\22\4\12\0"+
187     "\2\4\4\0\6\4\1\131\20\4\12\0\2\4\4\0"+
188     "\1\4\1\132\25\4\12\0\2\4\4\0\2\4\1\133"+
189     "\24\4\12\0\2\4\4\0\1\134\26\4\12\0\2\4"+
190     "\4\0\11\4\1\135\15\4\12\0\2\4\4\0\2\4"+
191     "\1\136\24\4\12\0\2\4\4\0\12\4\1\137\14\4"+
192     "\12\0\2\4\4\0\6\4\1\140\20\4\12\0\2\4"+
193     "\4\0\7\4\1\141\17\4\12\0\2\4\4\0\1\4"+
194     "\1\142\25\4\12\0\2\4\4\0\1\143\26\4\12\0"+
195     "\2\4\4\0\5\4\1\144\21\4\12\0\2\4\4\0"+
196     "\14\4\1\145\12\4\12\0\2\4\4\0\13\4\1\146"+
197     "\13\4\12\0\2\4\4\0\6\4\1\147\20\4\12\0"+
198     "\2\4\4\0\15\4\1\150\11\4\12\0\2\4\4\0"+
199     "\11\4\1\151\15\4\12\0\2\4\4\0\1\152\26\4"+
200     "\12\0\2\4\4\0\1\153\26\4\12\0\2\4\4\0"+
201     "\13\4\1\154\13\4\12\0\2\4\4\0\20\4\1\155"+
202     "\6\4\12\0\2\4\4\0\16\4\1\156\10\4\12\0"+
203     "\2\4\4\0\15\4\1\157\11\4\12\0\2\4\4\0"+
204     "\11\4\1\160\15\4\12\0\2\4\4\0\1\4\1\161"+
205     "\25\4\12\0\2\4\4\0\23\4\1\162\3\4\12\0"+
206     "\2\4\4\0\12\4\1\163\14\4\12\0\2\4\4\0"+
207     "\20\4\1\164\6\4\12\0\2\4\4\0\3\4\1\165"+
208     "\23\4\12\0\2\4\4\0\2\4\1\166\24\4\12\0"+
209     "\2\4\4\0\1\167\26\4\12\0\2\4\4\0\11\4"+
210     "\1\170\15\4\12\0\2\4\4\0\1\171\26\4\12\0"+
211     "\2\4\4\0\2\4\1\172\24\4\12\0\2\4\4\0"+
212     "\5\4\1\173\21\4\12\0\2\4\4\0\10\4\1\174"+
213     "\16\4\12\0\2\4\4\0\1\4\1\175\25\4\11\0";
214
215   private static int [] zzUnpackTrans() {
216     int [] result = new int[3627];
217     int offset = 0;
218     offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
219     return result;
220   }
221
222   private static int zzUnpackTrans(String packed, int offset, int [] result) {
223     int i = 0;       /* index in packed string  */
224     int j = offset;  /* index in unpacked array */
225     int l = packed.length();
226     while (i < l) {
227       int count = packed.charAt(i++);
228       int value = packed.charAt(i++);
229       value--;
230       do result[j++] = value; while (--count > 0);
231     }
232     return j;
233   }
234
235
236   /* error codes */
237   private static final int ZZ_UNKNOWN_ERROR = 0;
238   private static final int ZZ_NO_MATCH = 1;
239   private static final int ZZ_PUSHBACK_2BIG = 2;
240
241   /* error messages for the codes above */
242   private static final String ZZ_ERROR_MSG[] = {
243     "Unknown internal scanner error",
244     "Error: could not match input",
245     "Error: pushback value was too large"
246   };
247
248   /**
249    * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
250    */
251   private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
252
253   private static final String ZZ_ATTRIBUTE_PACKED_0 =
254     "\2\0\1\11\2\1\2\11\16\1\7\11\1\1\1\11"+
255     "\1\1\1\0\22\1\4\11\107\1";
256
257   private static int [] zzUnpackAttribute() {
258     int [] result = new int[125];
259     int offset = 0;
260     offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
261     return result;
262   }
263
264   private static int zzUnpackAttribute(String packed, int offset, int [] result) {
265     int i = 0;       /* index in packed string  */
266     int j = offset;  /* index in unpacked array */
267     int l = packed.length();
268     while (i < l) {
269       int count = packed.charAt(i++);
270       int value = packed.charAt(i++);
271       do result[j++] = value; while (--count > 0);
272     }
273     return j;
274   }
275
276   /** the input device */
277   private java.io.Reader zzReader;
278
279   /** the current state of the DFA */
280   private int zzState;
281
282   /** the current lexical state */
283   private int zzLexicalState = YYINITIAL;
284
285   /** this buffer contains the current text to be matched and is
286       the source of the yytext() string */
287   private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
288
289   /** the textposition at the last accepting state */
290   private int zzMarkedPos;
291
292   /** the current text position in the buffer */
293   private int zzCurrentPos;
294
295   /** startRead marks the beginning of the yytext() string in the buffer */
296   private int zzStartRead;
297
298   /** endRead marks the last character in the buffer, that has been read
299       from input */
300   private int zzEndRead;
301
302   /** number of newlines encountered up to the start of the matched text */
303   private int yyline;
304
305   /** the number of characters up to the start of the matched text */
306   private int yychar;
307
308   /**
309    * the number of characters from the last newline up to the start of the 
310    * matched text
311    */
312   private int yycolumn;
313
314   /** 
315    * zzAtBOL == true <=> the scanner is currently at the beginning of a line
316    */
317   private boolean zzAtBOL = true;
318
319   /** zzAtEOF == true <=> the scanner is at the EOF */
320   private boolean zzAtEOF;
321
322   /** denotes if the user-EOF-code has already been executed */
323   private boolean zzEOFDone;
324   
325   /** 
326    * The number of occupied positions in zzBuffer beyond zzEndRead.
327    * When a lead/high surrogate has been read from the input stream
328    * into the final zzBuffer position, this will have a value of 1;
329    * otherwise, it will have a value of 0.
330    */
331   private int zzFinalHighSurrogate = 0;
332
333   /* user code: */
334     StringBuffer string = new StringBuffer();
335     public Lexer(java.io.Reader in, ComplexSymbolFactory sf){
336         this(in);
337         symbolFactory = sf;
338     }
339     ComplexSymbolFactory symbolFactory;
340
341   private Symbol symbol(String name, int sym) {
342       return symbolFactory.newSymbol(name, sym, new Location(yyline+1,yycolumn+1,yychar), new Location(yyline+1,yycolumn+yylength(),yychar+yylength()));
343   }
344   
345   private Symbol symbol(String name, int sym, Object val) {
346       Location left = new Location(yyline+1,yycolumn+1,yychar);
347       Location right= new Location(yyline+1,yycolumn+yylength(), yychar+yylength());
348       return symbolFactory.newSymbol(name, sym, left, right,val);
349   } 
350   private Symbol symbol(String name, int sym, Object val,int buflength) {
351       Location left = new Location(yyline+1,yycolumn+yylength()-buflength,yychar+yylength()-buflength);
352       Location right= new Location(yyline+1,yycolumn+yylength(), yychar+yylength());
353       return symbolFactory.newSymbol(name, sym, left, right,val);
354   }       
355   private void error(String message) {
356     System.out.println("Error at line "+(yyline+1)+", column "+(yycolumn+1)+" : "+message);
357   }
358
359
360   /**
361    * Creates a new scanner
362    *
363    * @param   in  the java.io.Reader to read input from.
364    */
365   public Lexer(java.io.Reader in) {
366     this.zzReader = in;
367   }
368
369
370   /** 
371    * Unpacks the compressed character translation table.
372    *
373    * @param packed   the packed character translation table
374    * @return         the unpacked character translation table
375    */
376   private static char [] zzUnpackCMap(String packed) {
377     char [] map = new char[0x110000];
378     int i = 0;  /* index in packed string  */
379     int j = 0;  /* index in unpacked array */
380     while (i < 166) {
381       int  count = packed.charAt(i++);
382       char value = packed.charAt(i++);
383       do map[j++] = value; while (--count > 0);
384     }
385     return map;
386   }
387
388
389   /**
390    * Refills the input buffer.
391    *
392    * @return      <code>false</code>, iff there was new input.
393    * 
394    * @exception   java.io.IOException  if any I/O-Error occurs
395    */
396   private boolean zzRefill() throws java.io.IOException {
397
398     /* first: make room (if you can) */
399     if (zzStartRead > 0) {
400       zzEndRead += zzFinalHighSurrogate;
401       zzFinalHighSurrogate = 0;
402       System.arraycopy(zzBuffer, zzStartRead,
403                        zzBuffer, 0,
404                        zzEndRead-zzStartRead);
405
406       /* translate stored positions */
407       zzEndRead-= zzStartRead;
408       zzCurrentPos-= zzStartRead;
409       zzMarkedPos-= zzStartRead;
410       zzStartRead = 0;
411     }
412
413     /* is the buffer big enough? */
414     if (zzCurrentPos >= zzBuffer.length - zzFinalHighSurrogate) {
415       /* if not: blow it up */
416       char newBuffer[] = new char[zzBuffer.length*2];
417       System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
418       zzBuffer = newBuffer;
419       zzEndRead += zzFinalHighSurrogate;
420       zzFinalHighSurrogate = 0;
421     }
422
423     /* fill the buffer with new input */
424     int requested = zzBuffer.length - zzEndRead;
425     int numRead = zzReader.read(zzBuffer, zzEndRead, requested);
426
427     /* not supposed to occur according to specification of java.io.Reader */
428     if (numRead == 0) {
429       throw new java.io.IOException("Reader returned 0 characters. See JFlex examples for workaround.");
430     }
431     if (numRead > 0) {
432       zzEndRead += numRead;
433       /* If numRead == requested, we might have requested to few chars to
434          encode a full Unicode character. We assume that a Reader would
435          otherwise never return half characters. */
436       if (numRead == requested) {
437         if (Character.isHighSurrogate(zzBuffer[zzEndRead - 1])) {
438           --zzEndRead;
439           zzFinalHighSurrogate = 1;
440         }
441       }
442       /* potentially more input available */
443       return false;
444     }
445
446     /* numRead < 0 ==> end of stream */
447     return true;
448   }
449
450     
451   /**
452    * Closes the input stream.
453    */
454   public final void yyclose() throws java.io.IOException {
455     zzAtEOF = true;            /* indicate end of file */
456     zzEndRead = zzStartRead;  /* invalidate buffer    */
457
458     if (zzReader != null)
459       zzReader.close();
460   }
461
462
463   /**
464    * Resets the scanner to read from a new input stream.
465    * Does not close the old reader.
466    *
467    * All internal variables are reset, the old input stream 
468    * <b>cannot</b> be reused (internal buffer is discarded and lost).
469    * Lexical state is set to <tt>ZZ_INITIAL</tt>.
470    *
471    * Internal scan buffer is resized down to its initial length, if it has grown.
472    *
473    * @param reader   the new input stream 
474    */
475   public final void yyreset(java.io.Reader reader) {
476     zzReader = reader;
477     zzAtBOL  = true;
478     zzAtEOF  = false;
479     zzEOFDone = false;
480     zzEndRead = zzStartRead = 0;
481     zzCurrentPos = zzMarkedPos = 0;
482     zzFinalHighSurrogate = 0;
483     yyline = yychar = yycolumn = 0;
484     zzLexicalState = YYINITIAL;
485     if (zzBuffer.length > ZZ_BUFFERSIZE)
486       zzBuffer = new char[ZZ_BUFFERSIZE];
487   }
488
489
490   /**
491    * Returns the current lexical state.
492    */
493   public final int yystate() {
494     return zzLexicalState;
495   }
496
497
498   /**
499    * Enters a new lexical state
500    *
501    * @param newState the new lexical state
502    */
503   public final void yybegin(int newState) {
504     zzLexicalState = newState;
505   }
506
507
508   /**
509    * Returns the text matched by the current regular expression.
510    */
511   public final String yytext() {
512     return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
513   }
514
515
516   /**
517    * Returns the character at position <tt>pos</tt> from the 
518    * matched text. 
519    * 
520    * It is equivalent to yytext().charAt(pos), but faster
521    *
522    * @param pos the position of the character to fetch. 
523    *            A value from 0 to yylength()-1.
524    *
525    * @return the character at position pos
526    */
527   public final char yycharat(int pos) {
528     return zzBuffer[zzStartRead+pos];
529   }
530
531
532   /**
533    * Returns the length of the matched text region.
534    */
535   public final int yylength() {
536     return zzMarkedPos-zzStartRead;
537   }
538
539
540   /**
541    * Reports an error that occured while scanning.
542    *
543    * In a wellformed scanner (no or only correct usage of 
544    * yypushback(int) and a match-all fallback rule) this method 
545    * will only be called with things that "Can't Possibly Happen".
546    * If this method is called, something is seriously wrong
547    * (e.g. a JFlex bug producing a faulty scanner etc.).
548    *
549    * Usual syntax/scanner level error handling should be done
550    * in error fallback rules.
551    *
552    * @param   errorCode  the code of the errormessage to display
553    */
554   private void zzScanError(int errorCode) {
555     String message;
556     try {
557       message = ZZ_ERROR_MSG[errorCode];
558     }
559     catch (ArrayIndexOutOfBoundsException e) {
560       message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
561     }
562
563     throw new Error(message);
564   } 
565
566
567   /**
568    * Pushes the specified amount of characters back into the input stream.
569    *
570    * They will be read again by then next call of the scanning method
571    *
572    * @param number  the number of characters to be read again.
573    *                This number must not be greater than yylength()!
574    */
575   public void yypushback(int number)  {
576     if ( number > yylength() )
577       zzScanError(ZZ_PUSHBACK_2BIG);
578
579     zzMarkedPos -= number;
580   }
581
582
583   /**
584    * Contains user EOF-code, which will be executed exactly once,
585    * when the end of file is reached
586    */
587   private void zzDoEOF() throws java.io.IOException {
588     if (!zzEOFDone) {
589       zzEOFDone = true;
590       yyclose();
591     }
592   }
593
594
595   /**
596    * Resumes scanning until the next regular expression is matched,
597    * the end of input is encountered or an I/O-Error occurs.
598    *
599    * @return      the next token
600    * @exception   java.io.IOException  if any I/O-Error occurs
601    */
602   public java_cup.runtime.Symbol next_token() throws java.io.IOException {
603     int zzInput;
604     int zzAction;
605
606     // cached fields:
607     int zzCurrentPosL;
608     int zzMarkedPosL;
609     int zzEndReadL = zzEndRead;
610     char [] zzBufferL = zzBuffer;
611     char [] zzCMapL = ZZ_CMAP;
612
613     int [] zzTransL = ZZ_TRANS;
614     int [] zzRowMapL = ZZ_ROWMAP;
615     int [] zzAttrL = ZZ_ATTRIBUTE;
616
617     while (true) {
618       zzMarkedPosL = zzMarkedPos;
619
620       yychar+= zzMarkedPosL-zzStartRead;
621
622       boolean zzR = false;
623       int zzCh;
624       int zzCharCount;
625       for (zzCurrentPosL = zzStartRead  ;
626            zzCurrentPosL < zzMarkedPosL ;
627            zzCurrentPosL += zzCharCount ) {
628         zzCh = Character.codePointAt(zzBufferL, zzCurrentPosL, zzMarkedPosL);
629         zzCharCount = Character.charCount(zzCh);
630         switch (zzCh) {
631         case '\u000B':
632         case '\u000C':
633         case '\u0085':
634         case '\u2028':
635         case '\u2029':
636           yyline++;
637           yycolumn = 0;
638           zzR = false;
639           break;
640         case '\r':
641           yyline++;
642           yycolumn = 0;
643           zzR = true;
644           break;
645         case '\n':
646           if (zzR)
647             zzR = false;
648           else {
649             yyline++;
650             yycolumn = 0;
651           }
652           break;
653         default:
654           zzR = false;
655           yycolumn += zzCharCount;
656         }
657       }
658
659       if (zzR) {
660         // peek one character ahead if it is \n (if we have counted one line too much)
661         boolean zzPeek;
662         if (zzMarkedPosL < zzEndReadL)
663           zzPeek = zzBufferL[zzMarkedPosL] == '\n';
664         else if (zzAtEOF)
665           zzPeek = false;
666         else {
667           boolean eof = zzRefill();
668           zzEndReadL = zzEndRead;
669           zzMarkedPosL = zzMarkedPos;
670           zzBufferL = zzBuffer;
671           if (eof) 
672             zzPeek = false;
673           else 
674             zzPeek = zzBufferL[zzMarkedPosL] == '\n';
675         }
676         if (zzPeek) yyline--;
677       }
678       zzAction = -1;
679
680       zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
681   
682       zzState = ZZ_LEXSTATE[zzLexicalState];
683
684       // set up zzAction for empty match case:
685       int zzAttributes = zzAttrL[zzState];
686       if ( (zzAttributes & 1) == 1 ) {
687         zzAction = zzState;
688       }
689
690
691       zzForAction: {
692         while (true) {
693     
694           if (zzCurrentPosL < zzEndReadL) {
695             zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
696             zzCurrentPosL += Character.charCount(zzInput);
697           }
698           else if (zzAtEOF) {
699             zzInput = YYEOF;
700             break zzForAction;
701           }
702           else {
703             // store back cached positions
704             zzCurrentPos  = zzCurrentPosL;
705             zzMarkedPos   = zzMarkedPosL;
706             boolean eof = zzRefill();
707             // get translated positions and possibly new buffer
708             zzCurrentPosL  = zzCurrentPos;
709             zzMarkedPosL   = zzMarkedPos;
710             zzBufferL      = zzBuffer;
711             zzEndReadL     = zzEndRead;
712             if (eof) {
713               zzInput = YYEOF;
714               break zzForAction;
715             }
716             else {
717               zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
718               zzCurrentPosL += Character.charCount(zzInput);
719             }
720           }
721           int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
722           if (zzNext == -1) break zzForAction;
723           zzState = zzNext;
724
725           zzAttributes = zzAttrL[zzState];
726           if ( (zzAttributes & 1) == 1 ) {
727             zzAction = zzState;
728             zzMarkedPosL = zzCurrentPosL;
729             if ( (zzAttributes & 8) == 8 ) break zzForAction;
730           }
731
732         }
733       }
734
735       // store back cached position
736       zzMarkedPos = zzMarkedPosL;
737
738       if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
739         zzAtEOF = true;
740             zzDoEOF();
741           {      return symbolFactory.newSymbol("EOF", EOF, new Location(yyline+1,yycolumn+1,yychar), new Location(yyline+1,yycolumn+1,yychar+1));
742  }
743       }
744       else {
745         switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
746           case 1: 
747             { /* throw new Error("Illegal character <"+ yytext()+">");*/
748                     error("Illegal character <"+ yytext()+">");
749             }
750           case 38: break;
751           case 2: 
752             { return symbol("Identifier",IDENT, yytext());
753             }
754           case 39: break;
755           case 3: 
756             { /* ignore */
757             }
758           case 40: break;
759           case 4: 
760             { return symbol("semicolon",SEMICOLON);
761             }
762           case 41: break;
763           case 5: 
764             { string.setLength(0); yybegin(STRING);
765             }
766           case 42: break;
767           case 6: 
768             { return symbol("comma",COMMA);
769             }
770           case 43: break;
771           case 7: 
772             { return symbol("(",LPAR);
773             }
774           case 44: break;
775           case 8: 
776             { return symbol(")",RPAR);
777             }
778           case 45: break;
779           case 9: 
780             { return symbol("{",BEGIN);
781             }
782           case 46: break;
783           case 10: 
784             { return symbol("}",END);
785             }
786           case 47: break;
787           case 11: 
788             { return symbol("=",ASSIGN);
789             }
790           case 48: break;
791           case 12: 
792             { string.append( yytext() );
793             }
794           case 49: break;
795           case 13: 
796             { yybegin(YYINITIAL); 
797       return symbol("StringConst",STRINGCONST,string.toString(),string.length());
798             }
799           case 50: break;
800           case 14: 
801             { string.append('\\');
802             }
803           case 51: break;
804           case 15: 
805             { return symbol("as",AS);
806             }
807           case 52: break;
808           case 16: 
809             { string.append('\n');
810             }
811           case 53: break;
812           case 17: 
813             { string.append('\t');
814             }
815           case 54: break;
816           case 18: 
817             { string.append('\r');
818             }
819           case 55: break;
820           case 19: 
821             { string.append('\"');
822             }
823           case 56: break;
824           case 20: 
825             { return symbol("int",TYPE, "int" );
826             }
827           case 57: break;
828           case 21: 
829             { return symbol("byte",TYPE, "byte" );
830             }
831           case 58: break;
832           case 22: 
833             { return symbol("long",TYPE, "long" );
834             }
835           case 59: break;
836           case 23: 
837             { return symbol("char",TYPE, "char" );
838             }
839           case 60: break;
840           case 24: 
841             { return symbol("void",TYPE, "void" );
842             }
843           case 61: break;
844           case 25: 
845             { return symbol("with",WITH);
846             }
847           case 62: break;
848           case 26: 
849             { return symbol("short",TYPE, "short" );
850             }
851           case 63: break;
852           case 27: 
853             { return symbol("float",TYPE, "float" );
854             }
855           case 64: break;
856           case 28: 
857             { return symbol("string",TYPE, "String" );
858             }
859           case 65: break;
860           case 29: 
861             { return symbol("double",TYPE, "double" );
862             }
863           case 66: break;
864           case 30: 
865             { return symbol("String",TYPE, "String" );
866             }
867           case 67: break;
868           case 31: 
869             { return symbol("public",PUBLIC);
870             }
871           case 68: break;
872           case 32: 
873             { return symbol("method",METHOD);
874             }
875           case 69: break;
876           case 33: 
877             { return symbol("boolean",TYPE, "boolean" );
878             }
879           case 70: break;
880           case 34: 
881             { return symbol("requires",REQUIRES);
882             }
883           case 71: break;
884           case 35: 
885             { return symbol("interface",INTERFACE);
886             }
887           case 72: break;
888           case 36: 
889             { return symbol("capability",CAPABILITY);
890             }
891           case 73: break;
892           case 37: 
893             { return symbol("description",DESCRIPTION);
894             }
895           case 74: break;
896           default:
897             zzScanError(ZZ_NO_MATCH);
898         }
899       }
900     }
901   }
902
903
904 }