Continued work on parser, now calling functions and rolling correctly

This commit is contained in:
Stefan Zermatten
2020-09-10 00:14:24 +02:00
parent 81645df2a6
commit ede4e1367d
16 changed files with 243 additions and 88 deletions

View File

@@ -18,6 +18,21 @@
readonly
label="compiled"
/>
<v-text-field
v-model="rolled"
readonly
label="rolled"
/>
<v-text-field
v-model="reduced"
readonly
label="reduced"
/>
<v-textarea
v-model="reducedJson"
readonly
label="reduced"
/>
</v-card-text>
</v-card>
</div>
@@ -32,6 +47,9 @@ export default {
output: null,
compiled: null,
string: null,
rolled: null,
reduced: null,
reducedJson: null,
}},
watch: {
input(val){
@@ -41,7 +59,11 @@ export default {
this.output = JSON.stringify(output, null, 2);
if (!output) return;
this.string = output;
this.compiled = output.compile();
let scope = {cat: 1, dog: 2, mouse: 3};
this.compiled = output.compile(scope);
this.rolled = output.roll(scope);
this.reduced = output.reduce(scope);
this.reducedJson = JSON.stringify(this.reduced, null, 2)
}
},
}