44 * Text up to the first is copied verbatim into the created source file.
55 * Used for package and import statements. (we don't need any here)
66 */
7+ import java_cup.runtime.Symbol;
8+
79
810/**
911 * This class is a scanner generated by
1012 * <a href="http://www.jflex.de/">JFlex</a> 1.7.0
11- * from the specification file <tt>test.flex</tt>
13+ * from the specification file <tt>src/jflex/ test.flex</tt>
1214 */
13- class TestLexer {
15+ class TestLexer implements java_cup.runtime.Scanner {
1416
1517 /** This character denotes the end of file */
1618 public static final int YYEOF = -1;
@@ -36,9 +38,9 @@ class TestLexer {
3638 * Translates characters to character classes
3739 */
3840 private static final String ZZ_CMAP_PACKED =
39- "\11\0\1\12 \1\11 \1\0\1\12 \1\10 \22\0\1\12 \11\0\1\3"+
40- "\5\0\1\2\11\13 \2\0\1\7 \1\0\1\6 \2\0\32\4\6\0"+
41- "\10\1\1\14 \11\1\1\15 \7\1\1\5\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\uff94 \0";
41+ "\11\0\1\13 \1\12 \1\0\1\13 \1\11 \22\0\1\13 \11\0\1\3"+
42+ "\5\0\1\2\11\14 \2\0\1\10 \1\0\1\7 \2\0\32\4\6\0"+
43+ "\10\1\1\15 \11\1\1\16 \7\1\1\5\1\0\1\6\ 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\uff92 \0";
4244
4345 /**
4446 * Translates characters to character classes
@@ -51,8 +53,8 @@ class TestLexer {
5153 private static final int [] ZZ_ACTION = zzUnpackAction();
5254
5355 private static final String ZZ_ACTION_PACKED_0 =
54- "\2\0\1\1\1\2\1\1\1\3\1\4\1\5\2 \6"+
55- "\1\1\ 2\2\1\0\1\7 \1\10\1\11 ";
56+ "\2\0\1\1\1\2\1\1\1\3\1\4\1\5\1 \6"+
57+ "\2\7\1\10\ 2\2\1\0\1\11 \1\12 ";
5658
5759 private static int [] zzUnpackAction() {
5860 int [] result = new int[17];
@@ -80,9 +82,9 @@ class TestLexer {
8082 private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
8183
8284 private static final String ZZ_ROWMAP_PACKED_0 =
83- "\0\0\0\16 \0\34 \0\52 \0\70 \0\34 \0\34 \0\34 "+
84- "\0\106 \0\34 \0\124 \0\142 \0\160 \0\176 \0\124 \0\52 "+
85- "\0\34 ";
85+ "\0\0\0\17 \0\36 \0\55 \0\74 \0\36 \0\36 \0\36 "+
86+ "\0\36 \0\113 \0\36 \0\132 \0\151 \0\170 \0\207 \0\55 "+
87+ "\0\36 ";
8688
8789 private static int [] zzUnpackRowMap() {
8890 int [] result = new int[17];
@@ -109,14 +111,14 @@ class TestLexer {
109111
110112 private static final String ZZ_TRANS_PACKED_0 =
111113 "\1\3\1\4\1\3\1\5\1\3\1\6\1\7\1\10"+
112- "\1\11\2 \12\1 \13\1\14\1\4\16\3 \17\0\1\4 "+
113- "\1\15\10\ 0\1\15 \2\4\4\0\1\16\22\0\1\12 "+
114- "\6\0\1\17\10 \0\1\17 \3\0\1\4\1\15\10\0 "+
115- "\1\15 \1\4\1\20\2\0\1\15\10 \0\1\15\5\0 "+
116- "\1\21\1\16\11 \0";
114+ "\1\11\1 \12\2 \13\1\14\1\15\1\4 \17\3\20\0 "+
115+ "\1\4\1\16\11\ 0\1\16 \2\4\4\0\1\17\24\0 "+
116+ "\1\13\ 6\0\1\14\11 \0\1\14 \3\0\1\4\1\16 "+
117+ "\11\0\1\16 \1\4\1\20\2\0\1\16\11 \0\1\16 "+
118+ "\5\0\ 1\21\1\17\12 \0";
117119
118120 private static int [] zzUnpackTrans() {
119- int [] result = new int[140 ];
121+ int [] result = new int[150 ];
120122 int offset = 0;
121123 offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
122124 return result;
@@ -154,8 +156,8 @@ class TestLexer {
154156 private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
155157
156158 private static final String ZZ_ATTRIBUTE_PACKED_0 =
157- "\2\0\1\11\2\1\3 \11\1\1\1\11\3\1\1\0"+
158- "\2 \1\1\11";
159+ "\2\0\1\11\2\1\4 \11\1\1\1\11\3\1\1\0"+
160+ "\1 \1\1\11";
159161
160162 private static int [] zzUnpackAttribute() {
161163 int [] result = new int[17];
@@ -256,7 +258,7 @@ class TestLexer {
256258 char [] map = new char[0x110000];
257259 int i = 0; /* index in packed string */
258260 int j = 0; /* index in unpacked array */
259- while (i < 86 ) {
261+ while (i < 90 ) {
260262 int count = packed.charAt(i++);
261263 char value = packed.charAt(i++);
262264 do map[j++] = value; while (--count > 0);
@@ -459,14 +461,26 @@ class TestLexer {
459461 }
460462
461463
464+ /**
465+ * Contains user EOF-code, which will be executed exactly once,
466+ * when the end of file is reached
467+ */
468+ private void zzDoEOF() throws java.io.IOException {
469+ if (!zzEOFDone) {
470+ zzEOFDone = true;
471+ yyclose();
472+ }
473+ }
474+
475+
462476 /**
463477 * Resumes scanning until the next regular expression is matched,
464478 * the end of input is encountered or an I/O-Error occurs.
465479 *
466480 * @return the next token
467481 * @exception java.io.IOException if any I/O-Error occurs
468482 */
469- public String yylex () throws java.io.IOException, RuntimeException {
483+ public java_cup.runtime.Symbol next_token () throws java.io.IOException, RuntimeException {
470484 int zzInput;
471485 int zzAction;
472486
@@ -546,55 +560,61 @@ class TestLexer {
546560
547561 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
548562 zzAtEOF = true;
549- return null;
563+ zzDoEOF();
564+ { return new java_cup.runtime.Symbol(sym.EOF); }
550565 }
551566 else {
552567 switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
553568 case 1:
554569 { throw new RuntimeException("Illegal character <" + yytext() + ">");
555570 }
556571 // fall through
557- case 10 : break;
572+ case 11 : break;
558573 case 2:
559- { System.out.println("VARIABLE "+ yytext()); return " VAR" ;
574+ { System.out.println("VARIABLE "+ yytext()); return new Symbol(sym. VAR, yytext()) ;
560575 }
561576 // fall through
562- case 11 : break;
577+ case 12 : break;
563578 case 3:
564- { return " L_BRA" ;
579+ { return new Symbol(sym. L_BRA) ;
565580 }
566581 // fall through
567- case 12 : break;
582+ case 13 : break;
568583 case 4:
569- { return "GT" ;
584+ { return new Symbol(sym.R_BRA) ;
570585 }
571586 // fall through
572- case 13 : break;
587+ case 14 : break;
573588 case 5:
574- { return "LT" ;
589+ { return new Symbol(sym.GT) ;
575590 }
576591 // fall through
577- case 14 : break;
592+ case 15 : break;
578593 case 6:
579- { /*ignore*/
594+ { return new Symbol(sym.LT);
580595 }
581596 // fall through
582- case 15 : break;
597+ case 16 : break;
583598 case 7:
584- { return Integer.parseInt(yytext());
599+ { /*ignore*/
585600 }
586601 // fall through
587- case 16 : break;
602+ case 17 : break;
588603 case 8:
589- { System.out.println("IS"); return "IS" ;
604+ { return new Symbol(sym.NUMBER, Integer.parseInt(yytext())) ;
590605 }
591606 // fall through
592- case 17 : break;
607+ case 18 : break;
593608 case 9:
594- { System.out.println("RELATION "+ yytext()) ; return "REL" ;
609+ { System.out.println("IS") ; return new Symbol(sym.IS) ;
595610 }
596611 // fall through
597- case 18: break;
612+ case 19: break;
613+ case 10:
614+ { System.out.println("RELATION "+ yytext()); return new Symbol(sym.REL, yytext());
615+ }
616+ // fall through
617+ case 20: break;
598618 default:
599619 zzScanError(ZZ_NO_MATCH);
600620 }
0 commit comments