Finished migrating parser to be object orientation free. All tests pass

This commit is contained in:
Stefan Zermatten
2021-10-03 13:54:17 +02:00
parent d30184434c
commit b78517b61f
35 changed files with 589 additions and 654 deletions

View File

@@ -1,14 +1,13 @@
const constant = {
create({value, valueType}){
if (!valueType) throw `Expected valueType to be set, got ${valueType}`
create({value}){
return {
type: 'constant',
valueType,
parseType: 'constant',
valueType: typeof value,
value,
}
},
compile(node){
return node;
compile(node, scope, context){
return {result: node, context};
},
toString(node){
return `${node.value}`;