--- parser3/src/main/compile.y 2001/05/28 06:10:06 1.138 +++ parser3/src/main/compile.y 2001/06/28 07:41:59 1.143 @@ -5,8 +5,9 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.138 2001/05/28 06:10:06 parser Exp $ + $Id: compile.y,v 1.143 2001/06/28 07:41:59 parser Exp $ */ +static char *RCSId="$Id: compile.y,v 1.143 2001/06/28 07:41:59 parser Exp $"; /** @todo parser4: @@ -34,7 +35,7 @@ #include "pa_vobject.h" #include "pa_vdouble.h" #include "pa_globals.h" -#include "pa_vnothing.h" +#include "pa_vvoid.h" #define SELF_ELEMENT_NAME "self" #define USE_CONTROL_METHOD_NAME "USE" @@ -344,9 +345,9 @@ call_value: '^' call_name store_params E O($$, OP_GET_METHOD_FRAME); /* stack: context,method_frame */ YYSTYPE params_code=$3; - if(params_code->size()==3) // probably [] case. [OP_VALUE + Nothing + STORE_PARAM] + if(params_code->size()==3) // probably [] case. [OP_VALUE + Void + STORE_PARAM] if(Value *value=LA2V(params_code)) // it is OP_VALUE + value? - if(!value->is_defined()) // value is VNothing? + if(!value->is_defined()) // value is VVoid? params_code=0; // ^zzz[] case. don't append lone empty param. if(params_code) P($$, params_code); // filling method_frame.store_params @@ -527,7 +528,7 @@ write_string: STRING { change_string_literal_to_write_string_literal($$=$1) }; -unknown_value: /* empty */ { $$=VL(NEW VNothing(POOL)) }; +unknown_value: /* empty */ { $$=VL(NEW VVoid(POOL)) }; empty: /* empty */ { $$=N(POOL) }; %% @@ -857,6 +858,7 @@ static int yylex(YYSTYPE *lvalp, void *p // VARIABLE GET/PUT/WITH case LS_VAR_NAME_SIMPLE: case LS_EXPRESSION_VAR_NAME: + case LS_VAR_NAME_NO_COLON: if(PC.ls==LS_EXPRESSION_VAR_NAME) { // name in expr ends also before binary operators switch(c) { @@ -867,18 +869,30 @@ static int yylex(YYSTYPE *lvalp, void *p goto break2; } } + if(PC.ls==LS_VAR_NAME_NO_COLON) { + // name already has ':', stop before next + switch(c) { + case ':': + pop_LS(PC); + PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; } + result=EON; + goto break2; + } + } switch(c) { case 0: case ' ': case '\t': case '\n': case ';': case ']': case '}': case ')': case '"': case '\'': - case '<': case '>': // these stand for HTML brackets and expression binary ops + case '<': case '>': // these stand for HTML brackets AND expression binary ops case '+': case '*': case '/': case '%': case '&': case '|': case '=': case '!': // common delimiters case ',': + // before call + case '^': pop_LS(PC); PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; } result=EON; @@ -903,6 +917,7 @@ static int yylex(YYSTYPE *lvalp, void *p case '.': // name part delim case '$': // name part subvar case ':': // ':name' or 'class:name' + PC.ls=LS_VAR_NAME_NO_COLON; // stop before next ':' RC; } break;