--- parser3/src/main/compile.y 2001/03/12 09:08:50 1.91 +++ parser3/src/main/compile.y 2001/03/13 09:05:31 1.94 @@ -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.91 2001/03/12 09:08:50 paf Exp $ + $Id: compile.y,v 1.94 2001/03/13 09:05:31 paf Exp $ */ /* @@ -38,7 +38,7 @@ #include "core.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); @@ -179,9 +179,10 @@ control_method: '@' STRING '\n' YYERROR; } } else { - strcpy(PC->error, command.cstr()); - strcat(PC->error, ": invalid special name. valid names are " - CLASS_NAME", "USE_CONTROL_METHOD_NAME" and "BASE_NAME); + strcpy(PC->error, "'"); + strncat(PC->error, command.cstr(), MAX_STRING/2); + strcat(PC->error, "' invalid special name. valid names are " + "'"CLASS_NAME"', '"USE_CONTROL_METHOD_NAME"' and '"BASE_NAME"'"); YYERROR; } } @@ -349,10 +350,7 @@ store_param: ; store_square_param: '[' store_code_param_parts ']' {$$=$2}; store_round_param: '(' store_expr_param_parts ')' {$$=$2}; -store_curly_param: '{' maybe_codes '}' { - $$=N(POOL); - PCA($$, $2); -}; +store_curly_param: '{' store_curly_param_parts '}' {$$=$2}; store_code_param_parts: store_code_param_part | store_code_param_parts ';' store_code_param_part { $$=$1; P($$, $3) } @@ -361,6 +359,10 @@ store_expr_param_parts: store_expr_param_part | store_expr_param_parts ';' store_expr_param_part { $$=$1; P($$, $3) } ; +store_curly_param_parts: + store_curly_param_part +| store_curly_param_parts ';' store_curly_param_part { $$=$1; P($$, $3) } +; store_code_param_part: empty /* optimized [] case */ | STRING { /* optimized [STRING] case */ @@ -376,6 +378,10 @@ store_expr_param_part: write_expr_value $$=N(POOL); PCA($$, $1); }; +store_curly_param_part: maybe_codes { + $$=N(POOL); + PCA($$, $1); +}; write_expr_value: expr_value { $$=$1; O($$, OP_WRITE); @@ -775,9 +781,7 @@ int yylex(YYSTYPE *lvalp, void *pc) { if(PC->ls==LS_EXPRESSION_VAR_NAME) { // name in expr ends also before binary operators switch(c) { - case '+': case '-': case '*': case '/': case '%': - case '&': case '|': - case '=': case '!': + case '-': pop_LS(PC); PC->source--; if(--PC->col<0) { PC->line--; PC->col=-1; } result=EON; @@ -790,6 +794,9 @@ int yylex(YYSTYPE *lvalp, void *pc) { case ';': case ']': case '}': case ')': case '"': case '<': case '>': // these stand for HTML brackets and expression binary ops + case '+': case '*': case '/': case '%': + case '&': case '|': + case '=': case '!': pop_LS(PC); PC->source--; if(--PC->col<0) { PC->line--; PC->col=-1; } result=EON; @@ -924,6 +931,8 @@ int yylex(YYSTYPE *lvalp, void *pc) { case '^': push_LS(PC, LS_METHOD_NAME); RC; + case ';': // param delim + RC; case '}': if(--lexical_brackets_nestage==0) { PC->ls=LS_METHOD_AFTER;