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

@@ -1,12 +1,12 @@
import ParseNode from '/imports/parser/parseTree/ParseNode.js';
export default class ConstantNode extends ParseNode {
constructor({value, type, errors}){
super();
constructor({value, type, rollTable}){
super(...arguments);
// string, number, boolean, numberArray, uncompiledNode
this.type = type;
this.value = value;
if (errors) this.errors = errors;
if (rollTable) this.rollTable = rollTable;
}
compile(){
return this;
@@ -18,6 +18,6 @@ export default class ConstantNode extends ParseNode {
return this.type === 'number';
}
get isInteger(){
return this.isNumberNode && Number.isInteger(this.value);
return this.type === 'number' && Number.isInteger(this.value);
}
}