Project

General

Profile

Revision bbfbc15a src/tools/stateflow/parser-json/parser_json.ml

View differences:

src/tools/stateflow/parser-json/parser_json.ml
130 130
    let initial_value = json |> member "initial_value" |> to_string in
131 131
    match datatype with
132 132
    | "bool" -> (Tydec_bool, mkexpr location
133
                   (Expr_const (Const_bool
134
                                  (bool_of_string initial_value))))
133
                   (Expr_const (Const_tag
134
                                  ((fun s -> match s with
135
                                     | "true"  -> tag_true
136
                                     | "false" -> tag_false
137
                                     | _       ->
138
                                       failwith ("Invalid constant for
139
     boolean: " ^ s)) initial_value))))
135 140
    | "int"  -> (Tydec_int, mkexpr location
136 141
                   (Expr_const (Const_int (int_of_string
137 142
                                             initial_value))))

Also available in: Unified diff