|
@@ -13,6 +13,7 @@ String function JSON_print(model : Element):
|
|
|
Boolean first
|
|
|
Element attr_value
|
|
|
String type_attr
|
|
|
+ Element attrs
|
|
|
|
|
|
result = "["
|
|
|
keys_m = dict_keys(model["model"])
|
|
@@ -36,22 +37,25 @@ String function JSON_print(model : Element):
|
|
|
result = result + ", \"__target\": \"" + reverseKeyLookup(model["model"], read_edge_dst(model["model"][v_m])) + "\""
|
|
|
|
|
|
// Has attributes
|
|
|
- attr_keys = dict_keys(getAttributeList(model, v_m))
|
|
|
+ attrs = getAttributeList(model, v_m)
|
|
|
+ attr_keys = dict_keys(attrs)
|
|
|
while (0 < set_len(attr_keys)):
|
|
|
attr_key = set_pop(attr_keys)
|
|
|
attr_value = read_attribute(model, v_m, attr_key)
|
|
|
- if (element_eq(attr_value, read_root())):
|
|
|
- result = result + ", \"" + attr_key + "\": null"
|
|
|
+ if (read_type(model["metamodel"], attrs[attr_key]) == "ActionLanguage"):
|
|
|
+ if (element_eq(attr_value, read_root())):
|
|
|
+ result = result + ", \"" + attr_key + "\": {\"AL\": \"\"}"
|
|
|
+ else:
|
|
|
+ result = result + ", \"" + attr_key + "\": {\"AL\": " + cast_value(attr_value) + "}"
|
|
|
else:
|
|
|
- if (is_physical_boolean(attr_value)):
|
|
|
- if (attr_value):
|
|
|
- result = result + ", \"" + attr_key + "\": true"
|
|
|
- else:
|
|
|
- result = result + ", \"" + attr_key + "\": false"
|
|
|
+ if (element_eq(attr_value, read_root())):
|
|
|
+ result = result + ", \"" + attr_key + "\": null"
|
|
|
else:
|
|
|
- type_attr = read_type(model, reverseKeyLookup(model["model"], attr_value))
|
|
|
- if (read_type(model["metamodel"], type_attr) == "ActionLanguage"):
|
|
|
- result = result + ", \"" + attr_key + "\": {\"AL\": " + cast_value(attr_value) + "}"
|
|
|
+ if (is_physical_boolean(attr_value)):
|
|
|
+ if (attr_value):
|
|
|
+ result = result + ", \"" + attr_key + "\": true"
|
|
|
+ else:
|
|
|
+ result = result + ", \"" + attr_key + "\": false"
|
|
|
else:
|
|
|
result = result + ", \"" + attr_key + "\": " + cast_value(attr_value)
|
|
|
|