Project

General

Profile

« Previous | Next » 

Revision 1f868027

Added by Pierre-Loïc Garoche over 3 years ago

JSON EMF

View differences:

src/backends/EMF/EMF_common.ml
236 236
    fprintf fmt "%i" (get_idx t const_list)
237 237

  
238 238
let pp_cst_type c inf fmt (*infered_typ*) =
239
  let pp_basic fmt s = fprintf fmt "{ \"kind\": \"%s\" }" s in
239 240
  match c with
240 241
  | Const_tag t ->
241 242
     let typ = (Corelang.typedef_of_top (Hashtbl.find Corelang.tag_table t)) in
242 243
     if typ.tydef_id = "bool" then
243
       fprintf fmt "\"bool\""
244
       pp_basic fmt "bool"
244 245
     else
245 246
       pp_tag_type t typ inf fmt
246
  | Const_int _ -> fprintf fmt "\"int\"" (*!Options.int_type*)
247
  | Const_real _ -> fprintf fmt "\"real\"" (*!Options.real_type*)
248
  | Const_string _ -> fprintf fmt "\"string\"" 
247
  | Const_int _ -> pp_basic fmt "int" (*!Options.int_type*)
248
  | Const_real _ -> pp_basic fmt "real" (*!Options.real_type*)
249
  | Const_string _ -> pp_basic fmt "string" 
249 250
  | _ -> eprintf "cst: %a@." Printers.pp_const c; assert false
250 251

  
251 252
    
252 253
let pp_emf_cst c inf fmt =
253
  let pp_typ fmt =
254
    fprintf fmt "\"datatype\": { \"kind\": %t } @ "
254
  let pp_typ fmt = 
255
    fprintf fmt "\"datatype\": %t@ "
255 256
      (pp_cst_type c inf)   
256 257
  in
257 258
  match c with

Also available in: Unified diff