--- parser3/src/main/compile.y 2001/03/13 14:28:51 1.95 +++ parser3/src/main/compile.y 2001/03/16 09:52:59 1.103 @@ -3,7 +3,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.95 2001/03/13 14:28:51 paf Exp $ + $Id: compile.y,v 1.103 2001/03/16 09:52:59 paf Exp $ */ /* @@ -35,10 +35,10 @@ #include "pa_request.h" #include "pa_vobject.h" #include "pa_vdouble.h" -#include "core.h" +#include "pa_globals.h" #define SELF_ELEMENT_NAME "self" -#define USE_CONTROL_METHOD_NAME "use" +#define USE_CONTROL_METHOD_NAME "USE" int real_yyerror(parse_control *pc, char *s); static void yyprint(FILE *file, int type, YYSTYPE value); @@ -145,7 +145,6 @@ control_method: '@' STRING '\n' // defaulting base. may change with @BASE PC->cclass->set_base(PC->request->root_class); // append to request's classes - PC->request->classes_array()+=PC->cclass; PC->request->classes().put(*name, PC->cclass); } else { strcpy(PC->error, "@"CLASS_NAME" must contain sole name"); @@ -240,7 +239,7 @@ action: get | put | with | call; get: get_value { $$=$1; /* stack: resulting value */ - O($$, OP_WRITE); /* value=pop; wcontext.write(value) */ + O($$, OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */ }; get_value: '$' get_name_value { $$=$2 } get_name_value: name_without_curly_rdive EON | name_in_curly_rdive; @@ -333,7 +332,7 @@ codes__excluding_sole_str_literal: actio call: call_value { $$=$1; /* stack: value */ - O($$, OP_WRITE); /* value=pop; wcontext.write(value) */ + O($$, OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */ }; call_value: '^' call_name store_params EON { /* ^field.$method{vasya} */ $$=$2; /* with_xxx,diving code; stack: context,method_junction */ @@ -378,7 +377,7 @@ store_code_param_part: ; store_expr_param_part: write_expr_value { $$=N(POOL); - PCA($$, $1); + PEA($$, $1); }; store_curly_param_part: maybe_codes { $$=N(POOL); @@ -386,7 +385,7 @@ store_curly_param_part: maybe_codes { }; write_expr_value: expr_value { $$=$1; - O($$, OP_WRITE); + O($$, OP_WRITE_EXPR_RESULT); }; /* name */ @@ -420,7 +419,7 @@ name_expr_with_subvar_value: STRING subv $$=N(POOL); O($$, OP_CREATE_EWPOOL); P($$, $1); - O($$, OP_WRITE); + O($$, OP_WRITE_VALUE); P($$, $2); O($$, OP_REDUCE_EWPOOL); }; @@ -454,7 +453,7 @@ with: '$' name_without_curly_rdive '{' c O($$, OP_CREATE_RWPOOL); P($$, $4); O($$, OP_REDUCE_RWPOOL); - O($$, OP_WRITE); + O($$, OP_WRITE_VALUE); }; /* expr */ @@ -513,7 +512,7 @@ string_inside_quotes_value: maybe_codes /* basics */ write_string: STRING { - // optimized from OP_STRING+OP_WRITE to OP_STRING__WRITE + // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE change_string_literal_to_write_string_literal($$=$1) }; @@ -809,6 +808,8 @@ int yylex(YYSTYPE *lvalp, void *pc) { case '+': case '*': case '/': case '%': case '&': case '|': case '=': case '!': + // common delimiters + case '\'': case ',': pop_LS(PC); PC->source--; if(--PC->col<0) { PC->line--; PC->col=-1; } result=EON; @@ -1011,8 +1012,6 @@ break2: int real_yyerror(parse_control *pc, char *s) /* Called by yyparse on error */ { - //fprintf(stderr, "[%s]\n", s); - strncpy(pc->error, s, MAX_STRING); // TODO: перепроверить с треклятым последним байтом return 1; }