/* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /db0/home/nsl/www.export/protected/NS/cvsroot/pp/src/jbf/yylex.template,v 1.2 1997/03/28 02:06:50 aalx Exp $ */ /* * Copyright (c) 1996 Dennis Heimbigner. email dennis@cs.colorado.edu */ /**************************************************/ /**************************************************/ /**************************************************/ // PREFIX package patch.src; import java.util.*; import java.io.*; import java.lang.System; import patch.src.util.*; import pp.src.jbf.*; // import patch.src.jbf.*; class Utility { public static void assert ( boolean expr ) { if (false == expr) { throw (new Error("Error: Assertion failed.")); } } private static final String errorMsg[] = { "Error: Unmatched end-of-comment punctuation.", "Error: Unmatched start-of-comment punctuation.", "Error: Unclosed string.", "Error: Illegal character." }; public static final int E_ENDCOMMENT = 0; public static final int E_STARTCOMMENT = 1; public static final int E_UNCLOSEDSTR = 2; public static final int E_UNMATCHED = 3; public static void error ( int code ) { System.out.println(errorMsg[code]); } } /**************************************************/ public class YYlex { // Set up the fake goto mechanism protected int Goto; protected static final int yynobranch = 0; protected static final int yy_find_action = 1; protected static final int yy_match = 2; protected static final int do_action = 3; // CONSTANTS public static final int YY_FLEX_MAJOR_VERSION = 2; public static final int YY_FLEX_MINOR_VERSION = 5; public static final int YY_NULL = 0; public static final int YY_MORE_ADJ = 0; public static final int YY_END_OF_BUFFER_CHAR = 0; public static final int YY_BUF_SIZE = 16384; public static final int YY_READ_BUF_SIZE = 8192; public static final int EOB_ACT_CONTINUE_SCAN = 0; public static final int EOB_ACT_END_OF_FILE = 1; public static final int EOB_ACT_LAST_MATCH = 2; public static final int YY_START_STACK_INCR = 25; public static final int YY_BUFFER_NEW = 0; public static final int YY_BUFFER_NORMAL = 1; public static final int YY_BUFFER_EOF_PENDING = 2; public static final int YY_NUM_RULES = 32; public static final int YY_END_OF_BUFFER = 33; public static final int YY_SPECIAL = 155; // STATES public static final int INITIAL = 0; public static final int COMMENT = 1; // MISC. protected static final int EOF = -1; // Class State Int_Stack yy_start_stack; java.io.InputStream yyin; java.io.PrintStream yyout; int yy_start; /* start state number */ int yy_last_accepting_state; int yy_last_accepting_cpos; YYtoken yylval; YYtoken yylvalundef; protected StringBuffer lexeme; YYlexbuffer yytext; public int yydebug; boolean yy_at_bol; boolean is_interactive; int yy_current_state; int yy_act; // PROCS public YYlex(java.io.InputStream fin) {this(fin,System.out);} public YYlex() {this(System.in,System.out);} public YYlex(java.io.InputStream fin, java.io.PrintStream fout) { yyin = fin; yyout = fout; yy_start_stack = new Int_Stack(); yy_start = 1; /* start state number */ yy_last_accepting_state = 0; yy_last_accepting_cpos = 0; yy_current_state = 0; yy_act = 0; yy_at_bol = true; //pretend is_interactive= false; yylval = null; yylvalundef = new YYtoken(0); yydebug = 0; yytext = new YYlexbuffer(yyin,yyout); lexeme = new StringBuffer(); } public YYtoken yylex() throws LexException, IOException, EmptyStackException { yytext.purge(); scanloop: while( true ) { /* loops until end-of-file is reached */ yytext.mark(); int thisch = yytext.nextchar(); if(thisch == EOF) thisch = YY_END_OF_BUFFER_CHAR; branch: switch (Goto) { case yynobranch: yy_current_state = yy_start; yy_current_state += YY_AT_BOL(); //<< //yy_match: do { ///**/yyout.println("(1)yy_current_state=" + yy_current_state); int yy_c; // yy_c = yy_ec[YY_SC_TO_UI(thisch)]; yy_c = yy_ec[thisch]; ///**/yyout.println("(1)yy_c=" + yy_c); ///**/yyout.println("(1)yy_accept[yy_current_state]=" + yy_accept[yy_current_state]); if ( yy_accept[yy_current_state] != 0) { yy_last_accepting_cpos = yytext.currentpos(); yy_last_accepting_state = yy_current_state; ///**/yyout.println("(1)yy_last_accepting_state=" + yy_last_accepting_state); ///**/yyout.println("(1)yy_last_accepting_cpos=" + yy_last_accepting_cpos); } while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { ///**/yyout.println("(2)yy_chk[yy_base[yy_current_state]+yy_c]="+yy_chk[yy_base[yy_current_state] + yy_c]); yy_current_state = (int) yy_def[yy_current_state]; ///**/yyout.println("(2)yy_current_state=" + yy_current_state); if ( yy_current_state >= yy_accept.length ) { yy_c = yy_meta[yy_c]; ///**/yyout.println("(2)yy_c=" + yy_c); } } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ///**/yyout.println("(3)yy_current_state=" + yy_current_state); ///**/yyout.println("yy_at_bol=" + yy_at_bol); yy_at_bol = (thisch == '\n'); thisch = yytext.nextchar(); if(thisch == EOF) thisch = YY_END_OF_BUFFER_CHAR; } while ( yy_base[yy_current_state] != YY_SPECIAL ); case yy_find_action: yy_act = yy_accept[yy_current_state]; ///**/yyout.println("(4)yy_act=" + yy_act); if ( yy_act == 0 ) { /* have to back up to last accepting state*/ do { yytext.backup(); } while(yytext.currentpos() >= yy_last_accepting_cpos); thisch = yytext.nextchar(); ///**/yyout.print("backup:"+" yyline="+yyline()+" ; yychar="+yychar0()+" ; yylinechar="+yychar()+" ; yytext=/"+yytext.contents()+"/"); yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; ///**/yyout.println("(5)yy_current_state=" + yy_current_state); ///**/yyout.println("(5)yy_act=" + yy_act); } // YY_DO_BEFORE_ACTION; case do_action: /* This label is used only to access EOF actions. */ yy_at_bol = (yytext.yychar0() == 0); yylval = yylvalundef; yytext.backup(); ///**/yyout.println("(6)yy_act=" + yy_act); ///**/yyout.println("(6)yytext=/" + yytext.contents() + "/"); ///**/yyout.println("(6)yy_at_bol=" + yy_at_bol); ///**/yyout.println("yytext.lexeme=/" + yytext.lexeme() + "/"); switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* have to back up to last accepting state*/ do { yytext.backup(); } while(yytext.currentpos() > yy_last_accepting_cpos); thisch = yytext.nextchar(); ///**/yyout.print("backup:"+" yyline="+yyline()+" ; yychar="+yychar0()+" ; yylinechar="+yychar()+" ; yytext=/"+yytext.contents()+"/"); yy_current_state = yy_last_accepting_state; {Goto = yy_find_action; break branch;} // ACTIONS case 1: { yybegin(COMMENT); comment_count = comment_count + 1; } break; case 2: { comment_count = comment_count + 1; } break; case 3: { comment_count = comment_count - 1; Utility.assert(comment_count >= 0); if (comment_count == 0) { yybegin(INITIAL); } } break; case 4: { } break; case 5: { } break; case 6: { yyreturn(new YYtoken(YYtokentypes.ABSTRACT,yytext));} break; case 7: { yyreturn(new YYtoken(YYtokentypes.BOOLEAN,yytext));} break; case 8: { yyreturn(new YYtoken(YYtokentypes.BYTE,yytext));} break; case 9: { yyreturn(new YYtoken(YYtokentypes.CHAR, yytext));} break; case 10: { yyreturn(new YYtoken(YYtokentypes.CLASS,yytext));} break; case 11: { yyreturn(new YYtoken(YYtokentypes.DOUBLE,yytext));} break; case 12: { yyreturn(new YYtoken(YYtokentypes.FLOAT,yytext));} break; case 13: { yyreturn(new YYtoken(YYtokentypes.EXTENDS, yytext));} break; case 14: { yyreturn(new YYtoken(YYtokentypes.FINAL, yytext));} break; case 15: { yyreturn(new YYtoken(YYtokentypes.IMPLEMENTS, yytext));} break; case 16: { yyreturn(new YYtoken(YYtokentypes.INT ,yytext));} break; case 17: { yyreturn(new YYtoken(YYtokentypes.INTERFACE, yytext));} break; case 18: { yyreturn(new YYtoken(YYtokentypes.LONG ,yytext));} break; case 19: { yyreturn(new YYtoken(YYtokentypes.PRIVATE , yytext));} break; case 20: { yyreturn(new YYtoken(YYtokentypes.PROTECTED, yytext));} break; case 21: { yyreturn(new YYtoken(YYtokentypes.PUBLIC, yytext));} break; case 22: { yyreturn(new YYtoken(YYtokentypes.SHORT, yytext));} break; case 23: { yyreturn(new YYtoken(YYtokentypes.STATIC, yytext));} break; case 24: { yyreturn(new YYtoken(YYtokentypes.TRANSIENT, yytext));} break; case 25: { yyreturn(new YYtoken(YYtokentypes.VOLATILE , yytext));} break; case 26: { yyreturn(new YYtoken(YYtokentypes.VOID , yytext));} break; case 27: { yyreturn(new YYtoken((yytext.lexeme()).charAt(0), yytext));} break; case 28: { yyreturn(new YYtoken((yytext.lexeme()).charAt( 0), yytext));} break; case 29: { yyreturn(new YYtoken((yytext.lexeme()).charAt(0), yytext));} break; case 30: { yyreturn(new YYtoken((yytext.lexeme()).charAt(0), yytext));} break; case 31: { YYtoken t =new YYtoken(YYtokentypes.SYMBOL, yytext); yyreturn(t); } break; case 32: break; case YY_END_OF_BUFFER + 1 + INITIAL : case YY_END_OF_BUFFER + 1 + COMMENT : yylval = null; break; case YY_END_OF_BUFFER: yy_act = YY_STATE_EOF(YY_START()); {Goto = do_action; break branch;} default: yyfatalerror( "fatal flex scanner internal error--no action found" ); break; } /* end of action switch */ if(yylval != yylvalundef) { if(yydebug >= 1) yyreport(yylval); return yylval; } else { if(yydebug >= 10) yyout.println("yylex: no token produced"); } } //branch } /* end of scanning one token */ } /* end of yylex */ public void yy_push_state( int new_state ) { yy_start_stack.push(YY_START()); BEGIN(new_state); } public void yy_pop_state() { BEGIN(yy_start_stack.pop()); } protected int yy_top_state() { return yy_start_stack.top(); } protected void yyfatalerror( String msg) throws LexException { throw new LexException("yylex: fatalerror: " + msg); } public void yylexerror(String s) throws LexException { yyout.println("yylexerror: " + "char/line+char " + yytext.yychar0() + "/" + yytext.yyline() + "+" + yytext.yychar0() + " ; " + s); throw new LexException(s); } public YYtoken yyreport(YYtoken yylval) { if(yylval != null) { yyout.println("yylex: " + " char/line+char " + yylval.charno0() + "/" + yylval.lineno() + "+" + yylval.charno() + " /" + YYtokentypes.tokenname(yylval.tokentype) + "/(" + yylval.tokentype + ") ; text=#" + yylval.text + "#"); } else { yyout.println("yylex: " + " char/line+char " + yytext.yychar0() + "/" + yytext.yyline() + "+" + yytext.yychar0() + " /EOF/"); } return yylval; } protected void BEGIN(int n) {yy_start = 1+2*n;} public void yybegin(int n) {BEGIN(n);} public int YY_START() {return (yy_start-1)/2;} protected int YY_AT_BOL() {return (yy_at_bol)?1:0;} protected int YY_STATE_EOF(int st) {return YY_END_OF_BUFFER + st + 1;} /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ protected int YY_SC_TO_UI(byte c) {return (int)((byte)c);} public void yy_set_interactive(boolean is_interactive) { this.is_interactive= is_interactive; } protected void yy_set_bol(boolean at_bol) { yy_at_bol = at_bol; } // TABLES public static final short yy_accept[] = { 0, 0, 0, 0, 0, 33, 32, 29, 31, 30, 29, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 27, 28, 4, 4, 4, 31, 1, 5, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 3, 2, 5, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 16, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 8, 9, 31, 31, 31, 31, 31, 31, 31, 18, 31, 31, 31, 31, 31, 31, 26, 31, 31, 31, 10, 31, 31, 14, 12, 31, 31, 31, 31, 31, 22, 31, 31, 31, 31, 31, 11, 31, 31, 31, 31, 31, 21, 23, 31, 31, 31, 7, 13, 31, 31, 19, 31, 31, 31, 6, 31, 31, 31, 31, 25, 31, 17, 20, 24, 15, 0 }; public static final int yy_ec[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 4, 3, 3, 1, 3, 3, 5, 3, 3, 6, 3, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 1, 3, 3, 4, 1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 4, 4, 18, 19, 20, 21, 22, 4, 23, 24, 25, 26, 27, 4, 28, 29, 4, 30, 3, 31, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; public static final int yy_meta[] = { 0, 1, 2, 1, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1 }; public static final short yy_base[] = { 0, 0, 0, 30, 31, 154, 155, 155, 0, 155, 34, 143, 13, 27, 131, 123, 29, 29, 129, 27, 35, 126, 127, 155, 155, 155, 140, 141, 0, 155, 0, 121, 123, 118, 133, 132, 114, 114, 118, 116, 114, 110, 114, 23, 123, 111, 122, 121, 37, 155, 155, 0, 104, 110, 114, 103, 101, 114, 110, 113, 112, 102, 106, 103, 90, 91, 97, 91, 88, 92, 99, 101, 86, 95, 0, 0, 83, 88, 85, 86, 78, 89, 78, 0, 91, 86, 81, 72, 79, 71, 0, 69, 84, 83, 0, 78, 78, 0, 0, 70, 74, 62, 75, 74, 0, 73, 66, 65, 70, 60, 0, 55, 65, 68, 63, 50, 0, 0, 61, 55, 47, 0, 0, 51, 59, 0, 56, 48, 54, 0, 40, 46, 46, 32, 0, 32, 0, 0, 0, 0, 155, 60, 49, 63 }; public static final short yy_def[] = { 0, 140, 1, 141, 141, 140, 140, 140, 142, 140, 140, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 140, 140, 140, 140, 140, 142, 140, 143, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 140, 140, 143, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 0, 140, 140, 140 }; public static final short yy_nxt[] = { 0, 6, 6, 7, 8, 7, 9, 10, 6, 11, 12, 13, 14, 15, 16, 8, 8, 17, 18, 8, 8, 8, 19, 8, 20, 21, 8, 22, 8, 8, 23, 24, 6, 6, 32, 26, 26, 27, 27, 29, 64, 30, 33, 34, 65, 35, 38, 39, 40, 41, 43, 45, 28, 44, 70, 71, 139, 138, 137, 136, 46, 25, 25, 25, 51, 135, 51, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 69, 68, 67, 66, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 50, 49, 48, 47, 42, 37, 36, 31, 140, 5, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140 }; public static final short yy_chk[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 12, 3, 4, 3, 4, 10, 43, 10, 12, 13, 43, 13, 16, 16, 17, 17, 19, 20, 142, 19, 48, 48, 135, 133, 132, 131, 20, 141, 141, 141, 143, 130, 143, 128, 127, 126, 124, 123, 120, 119, 118, 115, 114, 113, 112, 111, 109, 108, 107, 106, 105, 103, 102, 101, 100, 99, 96, 95, 93, 92, 91, 89, 88, 87, 86, 85, 84, 82, 81, 80, 79, 78, 77, 76, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 47, 46, 45, 44, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 27, 26, 22, 21, 18, 15, 14, 11, 5, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140 }; // SUFFIX private int comment_count = 0; npp.src.util.NslPreProcessor p; public void init(npp.src.util.NslPreProcessor pat) { // pat.setWholeBuffer(yytext.wholebuffer); } /* public void init(npp.src.NPP pat) { // pat.setWholeBuffer(yytext.wholebuffer); } */ public void setdebug(boolean d) {yydebug = d?1:0; yytext.setdebug(d);} public void setdebug(int i) {yydebug = i>0?i:0; yytext.setdebug(i);} public void yyreturn(YYtoken t) {yylval = t;} // return 0 based line number public int yyline() {return yytext.yyline();} // return 0 based absolute char number public int yychar0() {return yytext.yychar0();} // return 0 based char number within line public int yychar() {return yytext.yychar();} } // class YYlex