summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-12-29 02:54:35 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-12-29 02:54:35 +0100
commit22b3bf35e5e120bcfb6df317d11805fd5e83f53e (patch)
tree7b69906be66a1c3969729734e9e02abe40703358 /src/json-export
parentc2a3d1d2778c53738cad8e647b70edc98da84b59 (diff)
Diffstat (limited to 'src/json-export')
-rw-r--r--src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java33
-rw-r--r--src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java18
2 files changed, 38 insertions, 13 deletions
diff --git a/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java b/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java
index 132e658..4db47a9 100644
--- a/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java
+++ b/src/json-export/src/tonkadur/jsonexport/ComputationCompiler.java
@@ -12,7 +12,7 @@ public class ComputationCompiler implements ComputationVisitor
{
protected JSONObject result;
- public void visit_add_rich_text_effect (final AddRichTextEffect n)
+ public void visit_add_text_effect (final AddTextEffect n)
throws Throwable
{
final JSONArray params, content;
@@ -44,7 +44,7 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
- result.put("category", "add_rich_text_effect");
+ result.put("category", "add_text_effect");
result.put("effect", n.get_effect_name());
result.put("parameters", params);
result.put("content", content);
@@ -185,7 +185,7 @@ public class ComputationCompiler implements ComputationVisitor
result.put("extra", param_cc.get_result());
}
- public void visit_rich_text (final RichText n)
+ public void visit_text (final Text n)
throws Throwable
{
final JSONArray content;
@@ -205,7 +205,7 @@ public class ComputationCompiler implements ComputationVisitor
result = new JSONObject();
- result.put("category", "rich_text");
+ result.put("category", "text");
result.put("content", content);
}
@@ -224,6 +224,31 @@ public class ComputationCompiler implements ComputationVisitor
result.put("reference", cc.get_result());
}
+ public void visit_extra_computation (final ExtraComputation n)
+ throws Throwable
+ {
+ final JSONArray params;
+
+ params = new JSONArray();
+
+ for (final Computation c: n.get_parameters())
+ {
+ final ComputationCompiler cc;
+
+ cc = new ComputationCompiler();
+
+ c.get_visited_by(cc);
+
+ params.add(cc.get_result());
+ }
+
+ result = new JSONObject();
+
+ result.put("category", "extra_computation");
+ result.put("name", n.get_name());
+ result.put("parameters", params);
+ }
+
public void visit_value_of (final ValueOf n)
throws Throwable
{
diff --git a/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java b/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java
index 86b2a56..d33901d 100644
--- a/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java
+++ b/src/json-export/src/tonkadur/jsonexport/InstructionCompiler.java
@@ -12,7 +12,7 @@ public class InstructionCompiler implements InstructionVisitor
{
protected JSONObject result;
- public void visit_add_choice (final AddChoice n)
+ public void visit_add_text_option (final AddTextOption n)
throws Throwable
{
final ComputationCompiler label_cc;
@@ -23,11 +23,11 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
- result.put("category", "add_choice");
+ result.put("category", "add_text_option");
result.put("label", label_cc.get_result());
}
- public void visit_add_event_input (final AddEventInput n)
+ public void visit_add_event_option (final AddEventOption n)
throws Throwable
{
final JSONArray params;
@@ -47,7 +47,7 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
- result.put("category", "add_event_input");
+ result.put("category", "add_event_option");
result.put("event", n.get_name());
result.put("parameters", params);
}
@@ -93,7 +93,7 @@ public class InstructionCompiler implements InstructionVisitor
result.put("category", "end");
}
- public void visit_event_call (final EventCall n)
+ public void visit_extra_instruction (final ExtraInstruction n)
throws Throwable
{
final JSONArray params;
@@ -113,8 +113,8 @@ public class InstructionCompiler implements InstructionVisitor
result = new JSONObject();
- result.put("category", "event_call");
- result.put("event", n.get_name());
+ result.put("category", "extra_instruction");
+ result.put("name", n.get_name());
result.put("parameters", params);
}
@@ -133,12 +133,12 @@ public class InstructionCompiler implements InstructionVisitor
result.put("reference", cc.get_result());
}
- public void visit_resolve_choices (final ResolveChoices n)
+ public void visit_resolve_choice (final ResolveChoice n)
throws Throwable
{
result = new JSONObject();
- result.put("category", "resolve_choices");
+ result.put("category", "resolve_choice");
}
public void visit_set_pc (final SetPC n)