--- parser3/src/main/compile.y 2001/03/12 21:54:20 1.93 +++ parser3/src/main/compile.y 2001/03/13 14:28:51 1.95 @@ -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.93 2001/03/12 21:54:20 paf Exp $ + $Id: compile.y,v 1.95 2001/03/13 14:28:51 paf Exp $ */ /* @@ -79,8 +79,10 @@ int yylex(YYSTYPE *lvalp, void *pc); %token DEF "def" %token IN "in" %token FEXISTS "-f" +%token IS "is" /* logical */ +%left "is" %left "lt" "gt" "le" "ge" %left "eq" "ne" %left '<' '>' "<=" ">=" "##" @@ -350,10 +352,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) } @@ -362,6 +361,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 */ @@ -377,6 +380,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); @@ -493,6 +500,7 @@ expr: | expr "ge" expr { $$=$1; P($$, $3); O($$, OP_STR_GE) } | expr "eq" expr { $$=$1; P($$, $3); O($$, OP_STR_EQ) } | expr "ne" expr { $$=$1; P($$, $3); O($$, OP_STR_NE) } +| expr "is" expr { $$=$1; P($$, $3); O($$, OP_IS) } ; string_inside_quotes_value: maybe_codes { @@ -742,10 +750,19 @@ int yylex(YYSTYPE *lvalp, void *pc) { break; case 'i': if(end==begin) // right after whitespace - if(PC->source[0]=='n') { // in - skip_analized=1; - result=IN; - goto break2; + switch(PC->source[0]) { + case 'n': + { // in + skip_analized=1; + result=IN; + goto break2; + } + case 's': + { // is + skip_analized=1; + result=IS; + goto break2; + } } break; case 'd': @@ -926,6 +943,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;