Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Yylex.java

00001 package edu.ksu.cis.bandera.specification.nnf.ltl;
00002 
00003 import java_cup.runtime.Symbol;
00004 
00005 
00006 public class Yylex implements java_cup.runtime.Scanner {
00007     private final int YY_BUFFER_SIZE = 512;
00008     private final int YY_F = -1;
00009     private final int YY_NO_STATE = -1;
00010     private final int YY_NOT_ACCEPT = 0;
00011     private final int YY_START = 1;
00012     private final int YY_END = 2;
00013     private final int YY_NO_ANCHOR = 4;
00014     private final int YY_BOL = 128;
00015     private final int YY_EOF = 129;
00016 
00017     private java.io.BufferedReader yy_reader;
00018     private int yy_buffer_index;
00019     private int yy_buffer_read;
00020     private int yy_buffer_start;
00021     private int yy_buffer_end;
00022     private char yy_buffer[];
00023     private int yyline;
00024     private boolean yy_at_bol;
00025     private int yy_lexical_state;
00026 
00027     private boolean yy_eof_done = false;
00028     private final int YYINITIAL = 0;
00029     private final int yy_state_dtrans[] = {
00030         0
00031     };
00032     private boolean yy_last_was_cr=false;
00033     private final int YY_E_INTERNAL = 0;
00034     private final int YY_E_MATCH = 1;
00035     private java.lang.String yy_error_string[] = {
00036         "Error: Internal error.\n",
00037         "Error: Unmatched input.\n"
00038     };
00039     private int yy_acpt[] = {
00040         /* 0 */ YY_NOT_ACCEPT,
00041         /* 1 */ YY_NO_ANCHOR,
00042         /* 2 */ YY_NO_ANCHOR,
00043         /* 3 */ YY_NO_ANCHOR,
00044         /* 4 */ YY_NO_ANCHOR,
00045         /* 5 */ YY_NO_ANCHOR,
00046         /* 6 */ YY_NO_ANCHOR,
00047         /* 7 */ YY_NO_ANCHOR,
00048         /* 8 */ YY_NO_ANCHOR,
00049         /* 9 */ YY_NO_ANCHOR,
00050         /* 10 */ YY_NO_ANCHOR,
00051         /* 11 */ YY_NO_ANCHOR,
00052         /* 12 */ YY_NO_ANCHOR,
00053         /* 13 */ YY_NO_ANCHOR,
00054         /* 14 */ YY_NO_ANCHOR,
00055         /* 15 */ YY_NO_ANCHOR,
00056         /* 16 */ YY_NO_ANCHOR,
00057         /* 17 */ YY_NO_ANCHOR,
00058         /* 18 */ YY_NO_ANCHOR,
00059         /* 19 */ YY_NO_ANCHOR
00060     };
00061     private int yy_cmap[] = unpackFromString(1,130,
00062 "16:9,1:2,16:2,0,16:18,1,13,16:4,12,16,8,9,16:3,10,16:2,15:10,16:2,4,16,5,16" +
00063 ":2,14:20,7,14:2,6,14:2,2,16,3,16,14,16,14:26,16,11,16:3,17:2")[0];
00064 
00065     private int yy_rmap[] = unpackFromString(1,20,
00066 "0,1,2,3:2,1:3,3,1:7,4,5,6,7")[0];
00067 
00068     private int yy_nxt[][] = unpackFromString(8,18,
00069 "-1,1,2,15,16,15,3,4,5,6,17,18,19,7,8,15:2,9,-1:21,10,-1:20,8:2,-1:6,8:2,-1:" +
00070 "7,11,-1:17,12,-1:23,13,-1:18,14,-1:5");
00071 
00072     private Yylex () {
00073         yy_buffer = new char[YY_BUFFER_SIZE];
00074         yy_buffer_read = 0;
00075         yy_buffer_index = 0;
00076         yy_buffer_start = 0;
00077         yy_buffer_end = 0;
00078         yyline = 0;
00079         yy_at_bol = true;
00080         yy_lexical_state = YYINITIAL;
00081     }
00082     public Yylex (java.io.InputStream instream) {
00083         this ();
00084         if (null == instream) {
00085             throw (new Error("Error: Bad input stream initializer."));
00086         }
00087         yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
00088     }
00089     public Yylex (java.io.Reader reader) {
00090         this ();
00091         if (null == reader) {
00092             throw (new Error("Error: Bad input stream initializer."));
00093         }
00094         yy_reader = new java.io.BufferedReader(reader);
00095     }
00096 public int line() {return yyline;}
00097     public java_cup.runtime.Symbol next_token ()
00098         throws java.io.IOException {
00099         int yy_lookahead;
00100         int yy_anchor = YY_NO_ANCHOR;
00101         int yy_state = yy_state_dtrans[yy_lexical_state];
00102         int yy_next_state = YY_NO_STATE;
00103         int yy_last_accept_state = YY_NO_STATE;
00104         boolean yy_initial = true;
00105         int yy_this_accept;
00106 
00107         yy_mark_start();
00108         yy_this_accept = yy_acpt[yy_state];
00109         if (YY_NOT_ACCEPT != yy_this_accept) {
00110             yy_last_accept_state = yy_state;
00111             yy_mark_end();
00112         }
00113         while (true) {
00114             if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
00115             else yy_lookahead = yy_advance();
00116             yy_next_state = YY_F;
00117             yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
00118             if (YY_EOF == yy_lookahead && true == yy_initial) {
00119                 return null;
00120             }
00121             if (YY_F != yy_next_state) {
00122                 yy_state = yy_next_state;
00123                 yy_initial = false;
00124                 yy_this_accept = yy_acpt[yy_state];
00125                 if (YY_NOT_ACCEPT != yy_this_accept) {
00126                     yy_last_accept_state = yy_state;
00127                     yy_mark_end();
00128                 }
00129             }
00130             else {
00131                 if (YY_NO_STATE == yy_last_accept_state) {
00132                     throw (new Error("Lexical Error: Unmatched Input."));
00133                 }
00134                 else {
00135                     yy_anchor = yy_acpt[yy_last_accept_state];
00136                     if (0 != (YY_END & yy_anchor)) {
00137                         yy_move_end();
00138                     }
00139                     yy_to_mark();
00140                     switch (yy_last_accept_state) {
00141                     case 1:
00142                         { /* ignore white space. */ }
00143                     case -2:
00144                         break;
00145                     case 2:
00146                         { throw new RuntimeException("Error! Unexpected token: "+yytext()); }
00147                     case -3:
00148                         break;
00149                     case 3:
00150                         { return new Symbol(sym.X); }
00151                     case -4:
00152                         break;
00153                     case 4:
00154                         { return new Symbol(sym.UNTIL); }
00155                     case -5:
00156                         break;
00157                     case 5:
00158                         { return new Symbol(sym.LP); }
00159                     case -6:
00160                         break;
00161                     case 6:
00162                         { return new Symbol(sym.RP);}
00163                     case -7:
00164                         break;
00165                     case 7:
00166                         { return new Symbol(sym.NOT);}
00167                     case -8:
00168                         break;
00169                     case 8:
00170                         { return new Symbol(sym.ATOM,yytext());}
00171                     case -9:
00172                         break;
00173                     case 9:
00174                         
00175                     case -10:
00176                         break;
00177                     case 10:
00178                         { return new Symbol(sym.G); }
00179                     case -11:
00180                         break;
00181                     case 11:
00182                         { return new Symbol(sym.F); }
00183                     case -12:
00184                         break;
00185                     case 12:
00186                         { return new Symbol(sym.IMPLIES);}
00187                     case -13:
00188                         break;
00189                     case 13:
00190                         { return new Symbol(sym.OR);}
00191                     case -14:
00192                         break;
00193                     case 14:
00194                         { return new Symbol(sym.AND);}
00195                     case -15:
00196                         break;
00197                     case 15:
00198                         { throw new RuntimeException("Error! Unexpected token: "+yytext()); }
00199                     case -16:
00200                         break;
00201                     case 16:
00202                         { throw new RuntimeException("Error! Unexpected token: "+yytext()); }
00203                     case -17:
00204                         break;
00205                     case 17:
00206                         { throw new RuntimeException("Error! Unexpected token: "+yytext()); }
00207                     case -18:
00208                         break;
00209                     case 18:
00210                         { throw new RuntimeException("Error! Unexpected token: "+yytext()); }
00211                     case -19:
00212                         break;
00213                     case 19:
00214                         { throw new RuntimeException("Error! Unexpected token: "+yytext()); }
00215                     case -20:
00216                         break;
00217                     default:
00218                         yy_error(YY_E_INTERNAL,false);
00219                     case -1:
00220                     }
00221                     yy_initial = true;
00222                     yy_state = yy_state_dtrans[yy_lexical_state];
00223                     yy_next_state = YY_NO_STATE;
00224                     yy_last_accept_state = YY_NO_STATE;
00225                     yy_mark_start();
00226                     yy_this_accept = yy_acpt[yy_state];
00227                     if (YY_NOT_ACCEPT != yy_this_accept) {
00228                         yy_last_accept_state = yy_state;
00229                         yy_mark_end();
00230                     }
00231                 }
00232             }
00233         }
00234     }
00235     private int[][] unpackFromString(int size1, int size2, String st) {
00236         int colonIndex = -1;
00237         String lengthString;
00238         int sequenceLength = 0;
00239         int sequenceInteger = 0;
00240 
00241         int commaIndex;
00242         String workString;
00243 
00244         int res[][] = new int[size1][size2];
00245         for (int i= 0; i < size1; i++) {
00246             for (int j= 0; j < size2; j++) {
00247                 if (sequenceLength != 0) {
00248                     res[i][j] = sequenceInteger;
00249                     sequenceLength--;
00250                     continue;
00251                 }
00252                 commaIndex = st.indexOf(',');
00253                 workString = (commaIndex==-1) ? st :
00254                     st.substring(0, commaIndex);
00255                 st = st.substring(commaIndex+1);
00256                 colonIndex = workString.indexOf(':');
00257                 if (colonIndex == -1) {
00258                     res[i][j]=Integer.parseInt(workString);
00259                     continue;
00260                 }
00261                 lengthString =
00262                     workString.substring(colonIndex+1);
00263                 sequenceLength=Integer.parseInt(lengthString);
00264                 workString=workString.substring(0,colonIndex);
00265                 sequenceInteger=Integer.parseInt(workString);
00266                 res[i][j] = sequenceInteger;
00267                 sequenceLength--;
00268             }
00269         }
00270         return res;
00271     }
00272     private int yy_advance ()
00273         throws java.io.IOException {
00274         int next_read;
00275         int i;
00276         int j;
00277 
00278         if (yy_buffer_index < yy_buffer_read) {
00279             return yy_buffer[yy_buffer_index++];
00280         }
00281 
00282         if (0 != yy_buffer_start) {
00283             i = yy_buffer_start;
00284             j = 0;
00285             while (i < yy_buffer_read) {
00286                 yy_buffer[j] = yy_buffer[i];
00287                 ++i;
00288                 ++j;
00289             }
00290             yy_buffer_end = yy_buffer_end - yy_buffer_start;
00291             yy_buffer_start = 0;
00292             yy_buffer_read = j;
00293             yy_buffer_index = j;
00294             next_read = yy_reader.read(yy_buffer,
00295                     yy_buffer_read,
00296                     yy_buffer.length - yy_buffer_read);
00297             if (-1 == next_read) {
00298                 return YY_EOF;
00299             }
00300             yy_buffer_read = yy_buffer_read + next_read;
00301         }
00302 
00303         while (yy_buffer_index >= yy_buffer_read) {
00304             if (yy_buffer_index >= yy_buffer.length) {
00305                 yy_buffer = yy_double(yy_buffer);
00306             }
00307             next_read = yy_reader.read(yy_buffer,
00308                     yy_buffer_read,
00309                     yy_buffer.length - yy_buffer_read);
00310             if (-1 == next_read) {
00311                 return YY_EOF;
00312             }
00313             yy_buffer_read = yy_buffer_read + next_read;
00314         }
00315         return yy_buffer[yy_buffer_index++];
00316     }
00317     private char[] yy_double (char buf[]) {
00318         int i;
00319         char newbuf[];
00320         newbuf = new char[2*buf.length];
00321         for (i = 0; i < buf.length; ++i) {
00322             newbuf[i] = buf[i];
00323         }
00324         return newbuf;
00325     }
00326     private void yy_error (int code,boolean fatal) {
00327         java.lang.System.out.print(yy_error_string[code]);
00328         java.lang.System.out.flush();
00329         if (fatal) {
00330             throw new Error("Fatal Error.\n");
00331         }
00332     }
00333     private void yy_mark_end () {
00334         yy_buffer_end = yy_buffer_index;
00335     }
00336     private void yy_mark_start () {
00337         int i;
00338         for (i = yy_buffer_start; i < yy_buffer_index; ++i) {
00339             if ('\n' == yy_buffer[i] && !yy_last_was_cr) {
00340                 ++yyline;
00341             }
00342             if ('\r' == yy_buffer[i]) {
00343                 ++yyline;
00344                 yy_last_was_cr=true;
00345             } else yy_last_was_cr=false;
00346         }
00347         yy_buffer_start = yy_buffer_index;
00348     }
00349     private void yy_move_end () {
00350         if (yy_buffer_end > yy_buffer_start &&
00351             '\n' == yy_buffer[yy_buffer_end-1])
00352             yy_buffer_end--;
00353         if (yy_buffer_end > yy_buffer_start &&
00354             '\r' == yy_buffer[yy_buffer_end-1])
00355             yy_buffer_end--;
00356     }
00357     private void yy_to_mark () {
00358         yy_buffer_index = yy_buffer_end;
00359         yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
00360                     ('\r' == yy_buffer[yy_buffer_end-1] ||
00361                      '\n' == yy_buffer[yy_buffer_end-1] ||
00362                      2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
00363                      2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
00364     }
00365     private void yybegin (int state) {
00366         yy_lexical_state = state;
00367     }
00368     private int yylength () {
00369         return yy_buffer_end - yy_buffer_start;
00370     }
00371     private java.lang.String yytext () {
00372         return (new java.lang.String(yy_buffer,
00373             yy_buffer_start,
00374             yy_buffer_end - yy_buffer_start));
00375     }
00376 }

Generated at Thu Feb 7 06:59:45 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001