diff --git a/lib/ast.ml b/lib/ast.ml index 5b3b884..4a000be 100644 --- a/lib/ast.ml +++ b/lib/ast.ml @@ -16,14 +16,16 @@ and join_type = | Union | Natural and condition = - | Condition of string * predicate + | Condition of predicand * predicate | And of condition * condition | Or of condition * condition | Not of condition +and predicand = + | Ref of string and predicate = - | Comparison of operator * string - | Between of string * string - | NotBetween of string * string + | Comparison of operator * predicand + | Between of predicand * predicand + | NotBetween of predicand * predicand | In of string list | NotIn of string list | Like of string diff --git a/parser/parser.mly b/parser/parser.mly index a16468e..e79cef8 100644 --- a/parser/parser.mly +++ b/parser/parser.mly @@ -110,7 +110,8 @@ parenthesized_value_expression: | LEFT_PAREN value_expression RIGHT_PAREN { $2 } nonparenthesized_value_expression_primary: - | column_reference { $1 } + | column_reference { Ref($1) } + (*| set_function_specification { Ref("function") } *) (***************************) @@ -443,8 +444,8 @@ as_clause : predicate : | comparison_predicate { $1 } - | between_predicate { $1 } - | in_predicate { $1 } +(* | between_predicate { $1 } *) +(* | in_predicate { $1 } *) (* | like_predicate { $1 }*) (*****************) @@ -536,14 +537,14 @@ search_condition: (* 10.9 AGGREGATE FUNCTION *) aggregate_function: - | COUNT LEFT_PAREN ASTERISK RIGHT_PAREN { Asterisk } - | COUNT LEFT_PAREN ASTERISK RIGHT_PAREN filter_clause { Asterisk } - | general_set_function { $1 } - | general_set_function filter_clause { $1 } + | COUNT LEFT_PAREN ASTERISK RIGHT_PAREN { } + | COUNT LEFT_PAREN ASTERISK RIGHT_PAREN filter_clause { } + | general_set_function { } + | general_set_function filter_clause { } general_set_function: - | set_function_type LEFT_PAREN value_expression RIGHT_PAREN { $3 } - | set_function_type LEFT_PAREN set_quantifier value_expression RIGHT_PAREN { $4 } + | set_function_type LEFT_PAREN value_expression RIGHT_PAREN { } + | set_function_type LEFT_PAREN set_quantifier value_expression RIGHT_PAREN { } set_function_type: | computationnal_operation {} diff --git a/test/test_ast.ml b/test/test_ast.ml index 4e366f4..21ffc2e 100644 --- a/test/test_ast.ml +++ b/test/test_ast.ml @@ -30,8 +30,8 @@ let test_default_join () = Table("t2"), Some( Condition( - "a", - Comparison(Equals, "b") + Ref("a"), + Comparison(Equals, Ref("b")) ) ) )], @@ -50,8 +50,8 @@ let test_left_join () = Table("t2"), Some( Condition( - "a", - Comparison(Equals, "b") + Ref("a"), + Comparison(Equals, Ref("b")) ) ) )], @@ -70,8 +70,8 @@ let test_right_join () = Table("t2"), Some( Condition( - "a", - Comparison(Equals, "b") + Ref("a"), + Comparison(Equals, Ref("b")) ) ) )], @@ -90,8 +90,8 @@ let test_inner_join () = Table("t2"), Some( Condition( - "a", - Comparison(Equals, "b") + Ref("a"), + Comparison(Equals, Ref("b")) ) ) )], @@ -156,8 +156,8 @@ let test_join_join () = Table("t2"), Some( Condition( - "a", - Comparison(Equals, "b") + Ref("a"), + Comparison(Equals, Ref("b")) ) ) ), @@ -165,8 +165,8 @@ let test_join_join () = Table("t3"), Some( Condition( - "a", - Comparison(Equals, "c") + Ref("a"), + Comparison(Equals, Ref("c")) ) ) )