--- parser3/src/main/compile.y 2001/04/20 14:18:41 1.126 +++ parser3/src/main/compile.y 2001/04/27 15:56:32 1.128 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.126 2001/04/20 14:18:41 paf Exp $ + $Id: compile.y,v 1.128 2001/04/27 15:56:32 paf Exp $ */ /** @@ -85,6 +85,7 @@ static int yylex(YYSTYPE *lvalp, void *p %token DEF "def" %token IN "in" %token FEXISTS "-f" +%token DEXISTS "-d" %token IS "is" /* logical */ @@ -95,7 +96,7 @@ static int yylex(YYSTYPE *lvalp, void *p %left "==" "!=" %left "||" %left "&&" -%left "def" "in" "-f" +%left "def" "in" "-f" "-d" %left '!' /* bitwise */ @@ -137,7 +138,7 @@ control_method: '@' STRING '\n' YYERROR; } if(command==CLASS_NAME) { - if(PC.cclass) { // already changed from default? + if(PC.cclass!=&PC.request->OP) { // already changed from default[OP]? strcpy(PC.error, "class already have a name '"); strncat(PC.error, PC.cclass->name().cstr(), 100); strcat(PC.error, "'"); @@ -488,6 +489,7 @@ expr: | "def" expr { $$=$2; O($$, OP_DEF) } | "in" expr { $$=$2; O($$, OP_IN) } | "-f" expr { $$=$2; O($$, OP_FEXISTS) } +| "-d" expr { $$=$2; O($$, OP_DEXISTS) } /* stack: a,b // stack: a@b */ | expr '-' expr { $$=$1; P($$, $3); O($$, OP_SUB) } | expr '+' expr { $$=$1; P($$, $3); O($$, OP_ADD) } @@ -759,11 +761,19 @@ static int yylex(YYSTYPE *lvalp, void *p lexical_brackets_nestage++; RC; case '-': - if(*PC.source=='f') { // -f + switch(*PC.source) { + case 'f': // -f skip_analized=1; result=FEXISTS; - } else + goto break2; + case 'd': // -d + skip_analized=1; + result=DEXISTS; + goto break2; + default: result=c; + goto break2; + } goto break2; case '+': case '*': case '/': case '%': case '~':