--- parser3/src/main/compile.y 2003/04/03 06:16:05 1.204.2.8.2.10 +++ parser3/src/main/compile.y 2003/04/03 12:40:53 1.204.2.8.2.13 @@ -5,7 +5,7 @@ Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.204.2.8.2.10 2003/04/03 06:16:05 paf Exp $ + $Id: compile.y,v 1.204.2.8.2.13 2003/04/03 12:40:53 paf Exp $ */ /** @@ -45,9 +45,9 @@ // forwards -static int real_yyerror(Parse_control *pc, char *s); -static void yyprint(FILE *file, int type, YYSTYPE value); -static int yylex(YYSTYPE *lvalp, void *pc); +static int real_yyerror(Parse_control* pc, char* s); +static void yyprint(FILE* file, int type, YYSTYPE value); +static int yylex(YYSTYPE* lvalp, void* pc); // local convinient inplace typecast & var @@ -121,11 +121,11 @@ static int yylex(YYSTYPE *lvalp, void *p %% all: one_big_piece { - Method& method=*new Method(/*main_method_name, */Method::CT_ANY, + Method& method=*new Method(Method::CT_ANY, 0, 0, /*min, max numbered_params_count*/ 0/*param_names*/, 0/*local_names*/, $1/*parser_code*/, 0/*native_code*/); - PC.cclass->add_method(main_method_name, method); + PC.cclass->add_method(PC.alias_method(main_method_name), method); } | methods; @@ -237,7 +237,7 @@ code_method: '@' STRING bracketed_maybe_ 0, 0/*min,max numbered_params_count*/, params_names, locals_names, $7, 0); - PC.cclass->add_method(name, method); + PC.cclass->add_method(PC.alias_method(name), method); }; maybe_bracketed_strings: empty | bracketed_maybe_strings; @@ -614,7 +614,7 @@ empty: /* empty */ { $$=N() }; 4:[^({]=pop */ -inline ungetc(Parse_control& pc, uint last_line_end_col) { +inline void ungetc(Parse_control& pc, uint last_line_end_col) { pc.source--; if(pc.pos.col==0) { --pc.pos.line; pc.pos.col=last_line_end_col; @@ -639,7 +639,6 @@ static int yylex(YYSTYPE *lvalp, void *a const char *begin=pc.source; Pos begin_pos=pc.pos; - uint last_line_end_col=0; const char *end; int skip_analized=0; while(true) { @@ -647,9 +646,7 @@ static int yylex(YYSTYPE *lvalp, void *a // fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp); if(c=='\n') { - pc.pos.line++; - last_line_end_col=pc.pos.col; - pc.pos.col=0; + pc.pos_next_line(); } else pc.pos.col+=c=='\t'?TAB_SIZE:1; @@ -1074,7 +1071,7 @@ default: // expression integer division case '\\': pop_LS(pc); - ungetc(pc, last_line_end_col); + pc.ungetc(); result=EON; goto break2; } @@ -1086,7 +1083,7 @@ default: switch(c) { case ':': pop_LS(pc); - ungetc(pc, last_line_end_col); + pc.ungetc(); result=EON; goto break2; } @@ -1106,7 +1103,7 @@ default: // before call case '^': pop_LS(pc); - ungetc(pc, last_line_end_col); + pc.ungetc(); result=EON; goto break2; case '[': @@ -1303,7 +1300,7 @@ default: RC; } pop_LS(pc); - ungetc(pc, last_line_end_col); + pc.ungetc(); result=EON; goto break2; }