Commit ab02cce7 authored by Bruno Guillaume's avatar Bruno Guillaume

more explicit error

parent 28f369e4
......@@ -89,12 +89,23 @@ module Ast = struct
| Equal_param of string (* $ident *)
| Absent
let feature_kind_to_string = function
| Equality fv_list -> sprintf " = %s" (String.concat "|" fv_list)
| Disequality [] -> ""
| Disequality fv_list -> sprintf " <> %s" (String.concat "|" fv_list)
| Equal_param param -> sprintf " = $%s" param
| Absent -> " <> *"
type u_feature = {
name: feature_name;
kind: feature_kind;
}
let u_feature_to_string uf =
sprintf "%s%s" uf.name (feature_kind_to_string uf.kind)
type feature = u_feature * Loc.t
let default_fs ?loc lab =
match loc with
| None -> [({name="label"; kind=Equality [lab]}, Loc.empty)]
......
......@@ -61,6 +61,8 @@ module Ast : sig
name: feature_name;
kind: feature_kind;
}
val u_feature_to_string: u_feature -> string
type feature = u_feature * Loc.t
val default_fs: ?loc:Loc.t -> string -> feature list
......
......@@ -51,7 +51,7 @@ module G_feature = struct
let build ?domain = function
| ({Ast.kind=Ast.Equality [atom]; name=name},loc) ->
(name, Feature_value.build_value ~loc ?domain name atom)
| _ -> Error.build "Illegal feature declaration in Graph (must be '=' and atomic)"
| (uf,loc) -> Error.build ~loc "in graph nodes, features must follow the shape \"name = value\" (error on feature: \"%s\")" (Ast.u_feature_to_string uf)
let to_string (feat_name, feat_val) = sprintf "%s=%s" feat_name (string_of_value feat_val)
......
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