aboutsummaryrefslogtreecommitdiff
path: root/lib/doml.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/doml.js')
-rw-r--r--lib/doml.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/doml.js b/lib/doml.js
index c813db9..181f574 100644
--- a/lib/doml.js
+++ b/lib/doml.js
@@ -151,6 +151,23 @@
'call': function(dataset, children, context) {
return context[dataset.name](children);
+ },
+
+ 'repeat': function(dataset, children, context) {
+ var times = me.evaluate(children[0], context);
+ for (var n = 0; n < times; n++) {
+ if (dataset.iteration) {
+ context[dataset.iteration] = n;
+ }
+ me.evaluate(children[1], context);
+ }
+ },
+
+ 'input': function(dataset, children, context) {
+ var msg = dataset.prompt || dataset.name;
+ var rawInput = prompt(dataset.prompt);
+ context[dataset.name] = me.Types[dataset.type](rawInput);
+ return context[dataset.name];
}
};
@@ -176,6 +193,22 @@
'bin-op': function(e) {
return [ e.dataset.op ];
+ },
+
+ 'input': function(e) {
+ return [ e.dataset.name ];
+ },
+
+ 'call': function(e) {
+ return [ e.dataset.name ];
+ },
+
+ 'function': function(e) {
+ return [ e.dataset.args ];
+ },
+
+ 'repeat': function(e) {
+ return [ e.dataset.iteration ];
}
};