Commit 9b62b72a authored by Jérôme Maloberti's avatar Jérôme Maloberti

Added types for Any and File in services.

parent c74af225
......@@ -1826,7 +1826,8 @@ module Service =
struct
type service_attributs = {
mutable const : bool;
mutable end_suffix : bool
mutable end_suffix : bool;
mutable file : bool
}
let prepare t =
let t = Print.uniq t in
......@@ -1874,11 +1875,13 @@ struct
| _ -> assert false;;
let rec convert (s : Print.nd) name =
trace ("debug:convert: " ^ name);
match s.Print.state with
| `Named n -> trace ("debug:convert " ^ (U.to_string n)) ;
convert_real name s.Print.def
| `GlobalName n ->
let t = get_gtype n in
trace("debug:convert:globalname: " ^ t);
(match t with
| "Int" | "String" | "Float" | "Bool"
-> convert_gtype t name
......@@ -1886,7 +1889,7 @@ struct
| _ -> convert_real name s.Print.def
and convert_real name def =
let rec aux = function
| [] -> assert false
| [] -> trace ("debug:convert_real:" ^ name); assert false
| [ h ] -> convert_expr name h
| h :: t -> assert false
in
......@@ -1899,20 +1902,23 @@ struct
| Print.Char c -> assert false
| Print.Regexp r -> convert_regexp name r
| Print.Xml (tag,attr,t) ->
let flags = { const = false; end_suffix = false } in
let flags = { const = false; end_suffix = false; file = false } in
(convert_attrs flags attr;
let tagname = convert_tag tag in
let res = convert t tagname in
let tagname = strip_namespace tagname in
match tagname with
| ":suffix" -> TSuffix(true,res)
| ":suffix" -> TSuffix(true,(convert t tagname))
| ":any" -> TAny
| _ -> (if flags.const then
TConst tagname
else
if flags.end_suffix then
TESuffix tagname
else
res)
if flags.file then
TFile tagname
else
convert t tagname)
)
| _ -> assert false
and convert_regexp name = function
......@@ -1953,6 +1959,7 @@ struct
match attr_label with
| "const" -> flags.const <- true
| "end_suffix" -> flags.end_suffix <- true
| "file" -> flags.file <- true
| _ -> output_string stderr
("Bad attribute name:" ^ attr_label ^ "\n")
(* Label.print_attr l opt (do_print_slot 0) t *)
......@@ -1991,6 +1998,8 @@ struct
| TSum (e1, e2) -> "TSum(" ^ (aux e1) ^ "," ^ (aux e2) ^ ")"
| TSuffix (b,e) -> "TSuffix(" ^ (bool_to_string b) ^ "," ^ (aux e) ^ ")"
| TESuffix n -> "TESuffix(" ^ n ^ ")"
| TFile n -> "TFile(" ^ n ^ ")"
| TAny -> "TAny"
| _ -> " unknown "
in aux t;;
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment