--- parser3/src/main/compile.y 2001/04/20 14:18:41 1.126 +++ parser3/src/main/compile.y 2001/04/28 08:43:56 1.129 @@ -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.129 2001/04/28 08:43:56 paf Exp $ */ /** @@ -29,9 +29,6 @@ #define YYPRINT(file, type, value) yyprint(file, type, value) #include "pa_config_includes.h" -#include -#include -#include #include "compile_tools.h" #include "pa_value.h" @@ -85,6 +82,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 +93,7 @@ static int yylex(YYSTYPE *lvalp, void *p %left "==" "!=" %left "||" %left "&&" -%left "def" "in" "-f" +%left "def" "in" "-f" "-d" %left '!' /* bitwise */ @@ -137,7 +135,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? strcpy(PC.error, "class already have a name '"); strncat(PC.error, PC.cclass->name().cstr(), 100); strcat(PC.error, "'"); @@ -488,6 +486,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 +758,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 '~':