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