*** gram.y.orig Thu Sep 23 16:30:59 1999 --- gram.y Fri Sep 24 14:42:53 1999 *************** *** 221,227 **** having_clause %type row_descriptor, row_list, c_list, c_expr %type row_expr - %type row_op %type case_expr, case_arg, when_clause, case_default %type when_clause_list %type sub_type --- 221,226 ---- *************** *** 970,981 **** { $$ = nconc( $1, lcons( makeString( "-"), $3)); } | default_expr '/' default_expr { $$ = nconc( $1, lcons( makeString( "/"), $3)); } - | default_expr '%' default_expr - { $$ = nconc( $1, lcons( makeString( "%"), $3)); } | default_expr '*' default_expr { $$ = nconc( $1, lcons( makeString( "*"), $3)); } | default_expr '^' default_expr { $$ = nconc( $1, lcons( makeString( "^"), $3)); } | default_expr '=' default_expr { elog(ERROR,"boolean expressions not supported in DEFAULT"); } | default_expr '<' default_expr --- 969,982 ---- { $$ = nconc( $1, lcons( makeString( "-"), $3)); } | default_expr '/' default_expr { $$ = nconc( $1, lcons( makeString( "/"), $3)); } | default_expr '*' default_expr { $$ = nconc( $1, lcons( makeString( "*"), $3)); } + | default_expr '%' default_expr + { $$ = nconc( $1, lcons( makeString( "%"), $3)); } | default_expr '^' default_expr { $$ = nconc( $1, lcons( makeString( "^"), $3)); } + | default_expr '|' default_expr + { $$ = nconc( $1, lcons( makeString( "|"), $3)); } | default_expr '=' default_expr { elog(ERROR,"boolean expressions not supported in DEFAULT"); } | default_expr '<' default_expr *************** *** 1120,1131 **** { $$ = nconc( $1, lcons( makeString( "-"), $3)); } | constraint_expr '/' constraint_expr { $$ = nconc( $1, lcons( makeString( "/"), $3)); } - | constraint_expr '%' constraint_expr - { $$ = nconc( $1, lcons( makeString( "%"), $3)); } | constraint_expr '*' constraint_expr { $$ = nconc( $1, lcons( makeString( "*"), $3)); } | constraint_expr '^' constraint_expr { $$ = nconc( $1, lcons( makeString( "^"), $3)); } | constraint_expr '=' constraint_expr { $$ = nconc( $1, lcons( makeString( "="), $3)); } | constraint_expr '<' constraint_expr --- 1121,1134 ---- { $$ = nconc( $1, lcons( makeString( "-"), $3)); } | constraint_expr '/' constraint_expr { $$ = nconc( $1, lcons( makeString( "/"), $3)); } | constraint_expr '*' constraint_expr { $$ = nconc( $1, lcons( makeString( "*"), $3)); } + | constraint_expr '%' constraint_expr + { $$ = nconc( $1, lcons( makeString( "%"), $3)); } | constraint_expr '^' constraint_expr { $$ = nconc( $1, lcons( makeString( "^"), $3)); } + | constraint_expr '|' constraint_expr + { $$ = nconc( $1, lcons( makeString( "|"), $3)); } | constraint_expr '=' constraint_expr { $$ = nconc( $1, lcons( makeString( "="), $3)); } | constraint_expr '<' constraint_expr *************** *** 2016,2028 **** all_Op: Op | MathOp; ! MathOp: '+' { $$ = "+"; } | '-' { $$ = "-"; } | '*' { $$ = "*"; } | '/' { $$ = "/"; } - | '%' { $$ = "%"; } | '<' { $$ = "<"; } | '>' { $$ = ">"; } | '=' { $$ = "="; } ; --- 2019,2033 ---- all_Op: Op | MathOp; ! MathOp: '+' { $$ = "+"; } | '-' { $$ = "-"; } | '*' { $$ = "*"; } | '/' { $$ = "/"; } | '<' { $$ = "<"; } | '>' { $$ = ">"; } + | '%' { $$ = "%"; } + | '^' { $$ = "^"; } + | '|' { $$ = "|"; } | '=' { $$ = "="; } ; *************** *** 3528,3534 **** /* Expressions using row descriptors * Define row_descriptor to allow yacc to break the reduce/reduce conflict * with singleton expressions. ! * Eliminated lots of code by defining row_op and sub_type clauses. * However, can not consolidate EXPR_LINK case with others subselects * due to shift/reduce conflict with the non-subselect clause (the parser * would have to look ahead more than one token to resolve the conflict). --- 3533,3539 ---- /* Expressions using row descriptors * Define row_descriptor to allow yacc to break the reduce/reduce conflict * with singleton expressions. ! * Eliminated lots of code by defining sub_type clauses. * However, can not consolidate EXPR_LINK case with others subselects * due to shift/reduce conflict with the non-subselect clause (the parser * would have to look ahead more than one token to resolve the conflict). *************** *** 3554,3560 **** n->subselect = $7; $$ = (Node *)n; } ! | '(' row_descriptor ')' row_op sub_type '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = $2; --- 3559,3565 ---- n->subselect = $7; $$ = (Node *)n; } ! | '(' row_descriptor ')' all_Op sub_type '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = $2; *************** *** 3567,3573 **** n->subselect = $7; $$ = (Node *)n; } ! | '(' row_descriptor ')' row_op '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = $2; --- 3572,3578 ---- n->subselect = $7; $$ = (Node *)n; } ! | '(' row_descriptor ')' all_Op '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = $2; *************** *** 3580,3586 **** n->subselect = $6; $$ = (Node *)n; } ! | '(' row_descriptor ')' row_op '(' row_descriptor ')' { $$ = makeRowExpr($4, $2, $6); } --- 3585,3591 ---- n->subselect = $6; $$ = (Node *)n; } ! | '(' row_descriptor ')' all_Op '(' row_descriptor ')' { $$ = makeRowExpr($4, $2, $6); } *************** *** 3602,3618 **** } ; - row_op: Op { $$ = $1; } - | '<' { $$ = "<"; } - | '=' { $$ = "="; } - | '>' { $$ = ">"; } - | '+' { $$ = "+"; } - | '-' { $$ = "-"; } - | '*' { $$ = "*"; } - | '/' { $$ = "/"; } - | '%' { $$ = "%"; } - ; - sub_type: ANY { $$ = ANY_SUBLINK; } | ALL { $$ = ALL_SUBLINK; } ; --- 3607,3612 ---- *************** *** 3658,3669 **** { $$ = makeA_Expr(OP, "-", $1, $3); } | a_expr '/' a_expr { $$ = makeA_Expr(OP, "/", $1, $3); } - | a_expr '%' a_expr - { $$ = makeA_Expr(OP, "%", $1, $3); } | a_expr '*' a_expr { $$ = makeA_Expr(OP, "*", $1, $3); } | a_expr '^' a_expr { $$ = makeA_Expr(OP, "^", $1, $3); } | a_expr '<' a_expr { $$ = makeA_Expr(OP, "<", $1, $3); } | a_expr '>' a_expr --- 3652,3665 ---- { $$ = makeA_Expr(OP, "-", $1, $3); } | a_expr '/' a_expr { $$ = makeA_Expr(OP, "/", $1, $3); } | a_expr '*' a_expr { $$ = makeA_Expr(OP, "*", $1, $3); } + | a_expr '%' a_expr + { $$ = makeA_Expr(OP, "%", $1, $3); } | a_expr '^' a_expr { $$ = makeA_Expr(OP, "^", $1, $3); } + | a_expr '|' a_expr + { $$ = makeA_Expr(OP, "|", $1, $3); } | a_expr '<' a_expr { $$ = makeA_Expr(OP, "<", $1, $3); } | a_expr '>' a_expr *************** *** 4049,4054 **** --- 4045,4060 ---- n->subselect = $4; $$ = (Node *)n; } + | a_expr '*' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } | a_expr '%' '(' SubSelect ')' { SubLink *n = makeNode(SubLink); *************** *** 4059,4069 **** n->subselect = $4; $$ = (Node *)n; } ! | a_expr '*' '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = lcons($1, NULL); ! n->oper = lcons("*",NIL); n->useor = false; n->subLinkType = EXPR_SUBLINK; n->subselect = $4; --- 4065,4085 ---- n->subselect = $4; $$ = (Node *)n; } ! | a_expr '^' '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = lcons($1, NULL); ! n->oper = lcons("^",NIL); ! n->useor = false; ! n->subLinkType = EXPR_SUBLINK; ! n->subselect = $4; ! $$ = (Node *)n; ! } ! | a_expr '|' '(' SubSelect ')' ! { ! SubLink *n = makeNode(SubLink); ! n->lefthand = lcons($1, NULL); ! n->oper = lcons("|",NIL); n->useor = false; n->subLinkType = EXPR_SUBLINK; n->subselect = $4; *************** *** 4139,4144 **** --- 4155,4170 ---- n->subselect = $5; $$ = (Node *)n; } + | a_expr '*' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } | a_expr '%' ANY '(' SubSelect ')' { SubLink *n = makeNode(SubLink); *************** *** 4149,4159 **** n->subselect = $5; $$ = (Node *)n; } ! | a_expr '*' ANY '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = lcons($1,NIL); ! n->oper = lcons("*",NIL); n->useor = false; n->subLinkType = ANY_SUBLINK; n->subselect = $5; --- 4175,4195 ---- n->subselect = $5; $$ = (Node *)n; } ! | a_expr '^' ANY '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = lcons($1,NIL); ! n->oper = lcons("^",NIL); ! n->useor = false; ! n->subLinkType = ANY_SUBLINK; ! n->subselect = $5; ! $$ = (Node *)n; ! } ! | a_expr '|' ANY '(' SubSelect ')' ! { ! SubLink *n = makeNode(SubLink); ! n->lefthand = lcons($1,NIL); ! n->oper = lcons("|",NIL); n->useor = false; n->subLinkType = ANY_SUBLINK; n->subselect = $5; *************** *** 4229,4234 **** --- 4265,4280 ---- n->subselect = $5; $$ = (Node *)n; } + | a_expr '*' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } | a_expr '%' ALL '(' SubSelect ')' { SubLink *n = makeNode(SubLink); *************** *** 4239,4249 **** n->subselect = $5; $$ = (Node *)n; } ! | a_expr '*' ALL '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = lcons($1, NULL); ! n->oper = lcons("*",NIL); n->useor = false; n->subLinkType = ALL_SUBLINK; n->subselect = $5; --- 4285,4305 ---- n->subselect = $5; $$ = (Node *)n; } ! | a_expr '^' ALL '(' SubSelect ')' { SubLink *n = makeNode(SubLink); n->lefthand = lcons($1, NULL); ! n->oper = lcons("^",NIL); ! n->useor = false; ! n->subLinkType = ALL_SUBLINK; ! n->subselect = $5; ! $$ = (Node *)n; ! } ! | a_expr '|' ALL '(' SubSelect ')' ! { ! SubLink *n = makeNode(SubLink); ! n->lefthand = lcons($1, NULL); ! n->oper = lcons("|",NIL); n->useor = false; n->subLinkType = ALL_SUBLINK; n->subselect = $5; *************** *** 4325,4336 **** { $$ = makeA_Expr(OP, "-", $1, $3); } | b_expr '/' b_expr { $$ = makeA_Expr(OP, "/", $1, $3); } | b_expr '%' b_expr { $$ = makeA_Expr(OP, "%", $1, $3); } | b_expr '^' b_expr { $$ = makeA_Expr(OP, "^", $1, $3); } ! | b_expr '*' b_expr ! { $$ = makeA_Expr(OP, "*", $1, $3); } | ':' b_expr { $$ = makeA_Expr(OP, ":", NULL, $2); } | ';' b_expr --- 4381,4394 ---- { $$ = makeA_Expr(OP, "-", $1, $3); } | b_expr '/' b_expr { $$ = makeA_Expr(OP, "/", $1, $3); } + | b_expr '*' b_expr + { $$ = makeA_Expr(OP, "*", $1, $3); } | b_expr '%' b_expr { $$ = makeA_Expr(OP, "%", $1, $3); } | b_expr '^' b_expr { $$ = makeA_Expr(OP, "^", $1, $3); } ! | b_expr '|' b_expr ! { $$ = makeA_Expr(OP, "|", $1, $3); } | ':' b_expr { $$ = makeA_Expr(OP, ":", NULL, $2); } | ';' b_expr *************** *** 4602,4611 **** { $$ = makeA_Expr(OP, "-", $1, $3); } | position_expr '/' position_expr { $$ = makeA_Expr(OP, "/", $1, $3); } - | position_expr '%' position_expr - { $$ = makeA_Expr(OP, "%", $1, $3); } | position_expr '*' position_expr { $$ = makeA_Expr(OP, "*", $1, $3); } | '|' position_expr { $$ = makeA_Expr(OP, "|", NULL, $2); } | position_expr TYPECAST Typename --- 4660,4673 ---- { $$ = makeA_Expr(OP, "-", $1, $3); } | position_expr '/' position_expr { $$ = makeA_Expr(OP, "/", $1, $3); } | position_expr '*' position_expr { $$ = makeA_Expr(OP, "*", $1, $3); } + | position_expr '%' position_expr + { $$ = makeA_Expr(OP, "%", $1, $3); } + | position_expr '^' position_expr + { $$ = makeA_Expr(OP, "^", $1, $3); } + | position_expr '|' position_expr + { $$ = makeA_Expr(OP, "|", $1, $3); } | '|' position_expr { $$ = makeA_Expr(OP, "|", NULL, $2); } | position_expr TYPECAST Typename