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