adding literals + pretty printing
This commit is contained in:
parent
323b17e4a9
commit
9f345489ae
12
lib/ast.ml
12
lib/ast.ml
@ -69,6 +69,8 @@ and expression_primary =
|
||||
| DateLiteral of string
|
||||
| TimeLiteral of string
|
||||
| TimestampLiteral of string
|
||||
| IntegerLiteral of int
|
||||
| FloatLiteral of float
|
||||
| Concatenation of expression_primary * expression_primary
|
||||
| Numeric of expression_primary * sign * expression_primary
|
||||
| Signed of sign * expression_primary
|
||||
@ -103,8 +105,18 @@ and pp_expression exp =
|
||||
| DateLiteral(d) -> "'" ^ d ^ "'"
|
||||
| TimeLiteral(t) -> "'" ^ t ^ "'"
|
||||
| TimestampLiteral(ts) -> "'" ^ ts ^ "'"
|
||||
| IntegerLiteral(i) -> string_of_int i
|
||||
| FloatLiteral(f) -> string_of_float f
|
||||
| Numeric(n1, s, n2) -> pp_expression n1 ^ pp_sign s ^ pp_expression n2
|
||||
| _ -> "Expression not yet supported"
|
||||
|
||||
and pp_sign sign =
|
||||
match sign with
|
||||
| Plus -> "+"
|
||||
| Minus -> "-"
|
||||
| Times -> "*"
|
||||
| Divide -> "/"
|
||||
|
||||
and pp_table_expression table_exp =
|
||||
match table_exp with
|
||||
| TableExpression(tables, filter, _) -> pp_tables tables ^ pp_filter filter
|
||||
|
Loading…
Reference in New Issue
Block a user