From e281113f887c39b4aa86a794f73b074ef5655319 Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Mon, 16 Sep 2002 13:09:08 +0000 Subject: [PATCH] parser and pretty printer corrected and tested --- helm/ocaml/mathql/mQueryTParser.mly | 4 +++- helm/ocaml/mathql/mQueryUtil.ml | 12 ++++++------ helm/ocaml/mathql/mathQL.ml | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/helm/ocaml/mathql/mQueryTParser.mly b/helm/ocaml/mathql/mQueryTParser.mly index 7bb6be3c4..a90c90e71 100644 --- a/helm/ocaml/mathql/mQueryTParser.mly +++ b/helm/ocaml/mathql/mQueryTParser.mly @@ -42,7 +42,9 @@ %left DIFF WHERE REFOF %left OR UNION %left AND INTER - %nonassoc NOT EX IN STR ATTR + %nonassoc STR + %nonassoc NOT EX IN ATTR + %start qstr query result %type qstr %type query diff --git a/helm/ocaml/mathql/mQueryUtil.ml b/helm/ocaml/mathql/mQueryUtil.ml index dc6b6997f..73006b606 100644 --- a/helm/ocaml/mathql/mQueryUtil.ml +++ b/helm/ocaml/mathql/mQueryUtil.ml @@ -54,11 +54,11 @@ let text_of_query x = | M.SuperOp -> "super " in let txt_vvar_list l = - txt_list txt_vvar "," l + txt_list txt_vvar ", " l in let rec txt_val = function | M.Const [s] -> txt_qstr s - | M.Const l -> "{" ^ txt_list txt_qstr "," l ^ "}" + | M.Const l -> "{" ^ txt_list txt_qstr ", " l ^ "}" | M.VVar vv -> txt_vvar vv | M.Record (rv, vv) -> txt_rvar rv ^ "." ^ txt_vvar vv | M.Fun (s, x) -> "fun " ^ txt_qstr s ^ " " ^ txt_val x @@ -93,14 +93,14 @@ let text_of_query x = let text_of_result x sep = let txt_attr = function | (s, []) -> txt_qstr s - | (s, l) -> txt_qstr s ^ "=" ^ txt_list txt_qstr "," l + | (s, l) -> txt_qstr s ^ "=" ^ txt_list txt_qstr ", " l in - let txt_group l = "{" ^ txt_list txt_attr ";" l ^ "}" in + let txt_group l = "{" ^ txt_list txt_attr "; " l ^ "}" in let txt_res = function | (s, []) -> txt_qstr s - | (s, l) -> txt_qstr s ^ " attr " ^ txt_list txt_group "," l + | (s, l) -> txt_qstr s ^ " attr " ^ txt_list txt_group ", " l in - let txt_set l = txt_list txt_res (";" ^ sep) l in + let txt_set l = txt_list txt_res ("; " ^ sep) l in txt_set x let query_of_text lexbuf = diff --git a/helm/ocaml/mathql/mathQL.ml b/helm/ocaml/mathql/mathQL.ml index 5ccdf79d7..b424d110b 100644 --- a/helm/ocaml/mathql/mathQL.ml +++ b/helm/ocaml/mathql/mathQL.ml @@ -74,7 +74,7 @@ and boole_exp = False and val_exp = Const of string list | RefOf of set_exp | Record of rvar * vvar - | VVar of string + | VVar of vvar | Fun of string * val_exp | Attribute of refine_op * string * val_exp -- 2.39.2