summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/json-export')
-rw-r--r--src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java34
-rw-r--r--src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java41
2 files changed, 49 insertions, 26 deletions
diff --git a/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java b/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java
index 538fbde..e9146d7 100644
--- a/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java
+++ b/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java
@@ -45,9 +45,9 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "add_text_effect");
- result.put("effect", n.get_effect_name());
+ result.put("name", n.get_effect_name());
result.put("parameters", params);
- result.put("content", content);
+ result.put("values", content);
}
public void visit_cast (final Cast n)
@@ -62,9 +62,9 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "cast");
- result.put("from", Translator.compile_type(n.get_parent().get_type()));
- result.put("to", Translator.compile_type(n.get_type()));
- result.put("content", cc.get_result());
+ result.put("from", n.get_parent().get_type().get_name());
+ result.put("to", n.get_type().get_name());
+ result.put("value", cc.get_result());
}
public void visit_constant (final Constant n)
@@ -73,7 +73,7 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "constant");
- result.put("type", Translator.compile_type(n.get_type()));
+ result.put("type", n.get_type().get_name());
result.put("value", n.get_as_string());
}
@@ -93,7 +93,7 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "if_else");
- result.put("type", Translator.compile_type(n.get_type()));
+ result.put("type", n.get_type().get_name());
result.put("condition", cond_cc.get_result());
result.put("if_true", if_true_cc.get_result());
result.put("if_false", if_false_cc.get_result());
@@ -105,7 +105,7 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "get_allocable_address");
- result.put("target", Translator.compile_type(n.get_target_type()));
+ result.put("type", n.get_target_type().get_name());
}
public void visit_newline (final Newline n)
@@ -137,7 +137,7 @@ public class ComputationCompiler implements ComputationVisitor
result.put("category", "operation");
result.put("operator", n.get_operator());
- result.put("type", Translator.compile_type(n.get_type()));
+ result.put("type", n.get_type().get_name());
result.put("x", cc.get_result());
if (n.get_second_parameter() != null)
@@ -162,8 +162,8 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "address");
- result.put("target_type", Translator.compile_type(n.get_type()));
- result.put("address", cc.get_result());
+ result.put("type", n.get_type().get_name());
+ result.put("value_or_target", cc.get_result());
}
public void visit_relative_address (final RelativeAddress n)
@@ -180,8 +180,8 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "relative_address");
- result.put("type", Translator.compile_type(n.get_type()));
- result.put("base", cc.get_result());
+ result.put("type", n.get_type().get_name());
+ result.put("target", cc.get_result());
result.put("extra", param_cc.get_result());
}
@@ -206,7 +206,7 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "text");
- result.put("content", content);
+ result.put("values", content);
}
public void visit_size (final Size n)
@@ -221,7 +221,7 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "size");
- result.put("reference", cc.get_result());
+ result.put("value", cc.get_result());
}
public void visit_extra_computation (final ExtraComputation n)
@@ -261,8 +261,8 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
result.put("category", "value_of");
- result.put("type", Translator.compile_type(n.get_type()));
- result.put("reference", cc.get_result());
+ result.put("type", n.get_type().get_name());
+ result.put("target", cc.get_result());
}
public JSONObject get_result ()
diff --git a/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java b/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java
index 79cb4ea..39a07af 100644
--- a/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java
+++ b/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java
@@ -24,7 +24,7 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
result.put("category", "add_text_option");
- result.put("label", label_cc.get_result());
+ result.put("value", label_cc.get_result());
}
public void visit_add_event_option (final AddEventOption n)
@@ -48,7 +48,7 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
result.put("category", "add_event_option");
- result.put("event", n.get_name());
+ result.put("name", n.get_name());
result.put("parameters", params);
}
@@ -82,7 +82,7 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
result.put("category", "display");
- result.put("content", cc.get_result());
+ result.put("value", cc.get_result());
}
public void visit_end (final End n)
@@ -130,7 +130,7 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
result.put("category", "remove");
- result.put("reference", cc.get_result());
+ result.put("target", cc.get_result());
}
public void visit_resolve_choice (final ResolveChoice n)
@@ -191,7 +191,7 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
result.put("category", "set_value");
- result.put("reference", ref_cc.get_result());
+ result.put("target", ref_cc.get_result());
result.put("value", val_cc.get_result());
}
@@ -207,7 +207,7 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
result.put("category", "initialize");
- result.put("reference", ref_cc.get_result());
+ result.put("target", ref_cc.get_result());
result.put("type", Translator.compile_type(n.get_type()));
}
@@ -232,9 +232,32 @@ public class InstructionCompiler implements InstructionVisitor
result.put("target", target_cc.get_result());
result.put("min", min_cc.get_result());
result.put("max", max_cc.get_result());
- result.put("label", label_cc.get_result());
+ result.put("message", label_cc.get_result());
}
+ public void visit_prompt_float (final PromptFloat n)
+ throws Throwable
+ {
+ final ComputationCompiler target_cc, min_cc, max_cc, label_cc;
+
+ target_cc = new ComputationCompiler();
+ min_cc = new ComputationCompiler();
+ max_cc = new ComputationCompiler();
+ label_cc = new ComputationCompiler();
+
+ n.get_target().get_visited_by(target_cc);
+ n.get_min().get_visited_by(min_cc);
+ n.get_max().get_visited_by(max_cc);
+ n.get_label().get_visited_by(label_cc);
+
+ result = new JSONObject();
+
+ result.put("category", "prompt_float");
+ result.put("target", target_cc.get_result());
+ result.put("min", min_cc.get_result());
+ result.put("max", max_cc.get_result());
+ result.put("message", label_cc.get_result());
+ }
public void visit_prompt_integer (final PromptInteger n)
throws Throwable
@@ -257,7 +280,7 @@ public class InstructionCompiler implements InstructionVisitor
result.put("target", target_cc.get_result());
result.put("min", min_cc.get_result());
result.put("max", max_cc.get_result());
- result.put("label", label_cc.get_result());
+ result.put("message", label_cc.get_result());
}
public void visit_prompt_string (final PromptString n)
@@ -281,7 +304,7 @@ public class InstructionCompiler implements InstructionVisitor
result.put("target", target_cc.get_result());
result.put("min", min_cc.get_result());
result.put("max", max_cc.get_result());
- result.put("label", label_cc.get_result());
+ result.put("message", label_cc.get_result());
}
public JSONObject get_result ()