📄 grm.java
字号:
"\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\004\037\257\001\001\000\002\001\001\000\004\037\261" + "\001\001\000\002\001\001\000\002\001\001\000\036\010" + "\264\011\011\012\023\014\013\015\033\016\010\017\003" + "\020\006\021\004\022\032\023\012\024\265\032\014\033" + "\031\001\001\000\002\001\001\000\002\001\001\000\040" + "\010\147\011\011\012\023\013\267\014\013\015\033\016" + "\010\017\003\020\006\021\004\022\032\023\012\032\014" + "\033\031\040\146\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\034\010\300\011" + "\011\012\023\014\013\015\033\016\010\017\003\020\006" + "\021\004\022\032\023\012\032\014\033\031\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\034" + "\010\303\011\011\012\023\014\013\015\033\016\010\017" + "\003\020\006\021\004\022\032\023\012\032\014\033\031" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\034\010\311" + "\011\011\012\023\014\013\015\033\016\010\017\003\020" + "\006\021\004\022\032\023\012\032\014\033\031\001\001" + "\000\002\001\001\000\002\001\001" }); /** Access to <code>reduce_goto</code> table. */ public short[][] reduce_table() {return _reduce_table;} /** Instance of action encapsulation class. */ protected CUP$Grm$actions action_obj; /** Action encapsulation object initializer. */ protected void init_actions() { action_obj = new CUP$Grm$actions(this); } /** Invoke a user supplied parse action. */ public java_cup.runtime.Symbol do_action( int act_num, java_cup.runtime.lr_parser parser, java.util.Stack stack, int top) throws java.lang.Exception { /* call code in generated class */ return action_obj.CUP$Grm$do_action(act_num, parser, stack, top); } /** Indicates start state. */ public int start_state() {return 0;} /** Indicates start production. */ public int start_production() {return 0;} /** <code>EOF</code> Symbol index. */ public int EOF_sym() {return 0;} /** <code>error</code> Symbol index. */ public int error_sym() {return 1;} /** Scan to get the next Symbol. */ public java_cup.runtime.Symbol scan() throws java.lang.Exception { return lexer.nextToken(); } public Absyn.Exp parseResult; Lexer lexer; public static int dflag; ErrorMsg.ErrorMsg errorMsg; //-------------------------------------------------------------- // array di nomi per i simboli (token --> stringa per la stampa) public static String symnames[] = new String[60]; static { symnames[sym.EOF] = "EOF"; symnames[sym.error] = "error"; symnames[sym.ID] = "ID"; symnames[sym.STRING] = "STRING"; symnames[sym.INT] = "INT"; symnames[sym.COMMA] = "COMMA"; symnames[sym.COLON] = "COLON"; symnames[sym.SEMICOLON] = "SEMICOLON"; symnames[sym.LPAREN] = "LPAREN"; symnames[sym.RPAREN] = "RPAREN"; symnames[sym.LBRACK] = "LBRACK"; symnames[sym.RBRACK] = "RBRACK"; symnames[sym.LBRACE] = "LBRACE"; symnames[sym.RBRACE] = "RBRACE"; symnames[sym.DOT] = "DOT"; symnames[sym.PLUS] = "PLUS"; symnames[sym.MINUS] = "MINUS"; symnames[sym.UMINUS] = "UMINUS"; symnames[sym.TIMES] = "TIMES"; symnames[sym.DIVIDE] = "DIVIDE"; symnames[sym.EQ] = "EQ"; symnames[sym.NEQ] = "NEQ"; symnames[sym.LT] = "LT"; symnames[sym.LE] = "LE"; symnames[sym.GT] = "GT"; symnames[sym.GE] = "GE"; symnames[sym.AND] = "AND"; symnames[sym.OR] = "OR"; symnames[sym.ASSIGN] = "ASSIGN"; symnames[sym.ARRAY] = "ARRAY"; symnames[sym.IF] = "IF"; symnames[sym.THEN] = "THEN"; symnames[sym.ELSE] = "ELSE"; symnames[sym.WHILE] = "WHILE"; symnames[sym.FOR] = "FOR"; symnames[sym.TO] = "TO"; symnames[sym.DO] = "DO"; symnames[sym.LET] = "LET"; symnames[sym.IN] = "IN"; symnames[sym.END] = "END"; symnames[sym.OF] = "OF"; symnames[sym.BREAK] = "BREAK"; symnames[sym.NIL] = "NIL"; symnames[sym.FUNCTION] = "FUNCTION"; symnames[sym.VAR] = "VAR"; symnames[sym.TYPE] = "TYPE"; } //--------------------------------------------------------- public void syntax_error(java_cup.runtime.Symbol current) { report_error("Errore di sintassi: token \"" + symnames[current.sym] + "\" inaspettato", current); } //--------------------------------------------------------- public void report_error(String message, java_cup.runtime.Symbol info) { // nel caso di EOF devo dare come posizione la pos - 1 if(info.sym == sym.EOF) errorMsg.error(info.left - 1, message); else errorMsg.error(info.left, message); } public Grm(Lexer l, ErrorMsg.ErrorMsg err, int flagdebug) { this(); errorMsg=err; lexer=l; dflag=flagdebug; } //--------------------------------------------------------- // metodi di java_cup.runtime.lr_parser sovrascritti (traduzione in italiano) public void report_fatal_error( String message, Object info) throws java.lang.Exception { /* stop parsing (not really necessary since we throw an exception, but) */ done_parsing(); /* use the normal error message reporting to put out the message */ report_error(message, info); /* throw an exception */ throw new Exception("\nImpossibile recuperare dagli errori precedenti."); } public void unrecovered_syntax_error(java_cup.runtime.Symbol cur_token) throws java.lang.Exception { report_fatal_error("\nImpossibile recuperare dagli errori precedenti", cur_token); } public void report_error(String message, Object info) { System.err.print(message); if (info instanceof java_cup.runtime.Symbol) { if (((java_cup.runtime.Symbol)info).left != -1) { System.err.println(" al carattere " + ((java_cup.runtime.Symbol)info).left + " dell'input"); } else System.err.println(""); } else System.err.println(""); }}/** Cup generated class to encapsulate user supplied action code.*/class CUP$Grm$actions { static Symbol.Symbol sym(String s) { return Symbol.Symbol.symbol(s); } // stampa informazioni utili al debug (se e' attivata l'opzione debug) public void stampaDebug(String stringa) { if(Grm.dflag==1) System.out.println("> " + stringa ); } private final Grm parser; /** Constructor */ CUP$Grm$actions(Grm parser) { this.parser = parser; } /** Method with the actual generated action code. */ public final java_cup.runtime.Symbol CUP$Grm$do_action( int CUP$Grm$act_num, java_cup.runtime.lr_parser CUP$Grm$parser, java.util.Stack CUP$Grm$stack, int CUP$Grm$top) throws java.lang.Exception { /* Symbol object for return from actions */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -