eggtended-js
Version:
A extended version of the Egg programming language from the Eloquent Javascript book.
1,363 lines • 138 kB
JSON
[
{
"__docId__": 1,
"kind": "external",
"name": "Infinity",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Infinity",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 2,
"kind": "external",
"name": "NaN",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~NaN",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 3,
"kind": "external",
"name": "undefined",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~undefined",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 4,
"kind": "external",
"name": "null",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~null",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 5,
"kind": "external",
"name": "Object",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Object",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 6,
"kind": "external",
"name": "object",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~object",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 7,
"kind": "external",
"name": "Function",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Function",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 8,
"kind": "external",
"name": "function",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~function",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 9,
"kind": "external",
"name": "Boolean",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Boolean",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 10,
"kind": "external",
"name": "boolean",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~boolean",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 11,
"kind": "external",
"name": "Symbol",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Symbol",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 12,
"kind": "external",
"name": "Error",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Error",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 13,
"kind": "external",
"name": "EvalError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~EvalError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 14,
"kind": "external",
"name": "InternalError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~InternalError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 15,
"kind": "external",
"name": "RangeError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~RangeError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 16,
"kind": "external",
"name": "ReferenceError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~ReferenceError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 17,
"kind": "external",
"name": "SyntaxError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~SyntaxError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 18,
"kind": "external",
"name": "TypeError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~TypeError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 19,
"kind": "external",
"name": "URIError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~URIError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 20,
"kind": "external",
"name": "Number",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Number",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 21,
"kind": "external",
"name": "number",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~number",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 22,
"kind": "external",
"name": "Date",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Date",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 23,
"kind": "external",
"name": "String",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~String",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 24,
"kind": "external",
"name": "string",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~string",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 25,
"kind": "external",
"name": "RegExp",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~RegExp",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 26,
"kind": "external",
"name": "Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 27,
"kind": "external",
"name": "Int8Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Int8Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 28,
"kind": "external",
"name": "Uint8Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Uint8Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 29,
"kind": "external",
"name": "Uint8ClampedArray",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Uint8ClampedArray",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 30,
"kind": "external",
"name": "Int16Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Int16Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 31,
"kind": "external",
"name": "Uint16Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Uint16Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 32,
"kind": "external",
"name": "Int32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Int32Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 33,
"kind": "external",
"name": "Uint32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Uint32Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 34,
"kind": "external",
"name": "Float32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Float32Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 35,
"kind": "external",
"name": "Float64Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Float64Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 36,
"kind": "external",
"name": "Map",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Map",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 37,
"kind": "external",
"name": "Set",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Set",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 38,
"kind": "external",
"name": "WeakMap",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~WeakMap",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 39,
"kind": "external",
"name": "WeakSet",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~WeakSet",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 40,
"kind": "external",
"name": "ArrayBuffer",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~ArrayBuffer",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 41,
"kind": "external",
"name": "DataView",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~DataView",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 42,
"kind": "external",
"name": "JSON",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~JSON",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 43,
"kind": "external",
"name": "Promise",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Promise",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 44,
"kind": "external",
"name": "Generator",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Generator",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 45,
"kind": "external",
"name": "GeneratorFunction",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~GeneratorFunction",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 46,
"kind": "external",
"name": "Reflect",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Reflect",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 47,
"kind": "external",
"name": "Proxy",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy",
"memberof": "lib/.external-ecmascript.js",
"static": true,
"longname": "lib/.external-ecmascript.js~Proxy",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 48,
"kind": "file",
"name": "lib/interp/arithm.js",
"content": "const { SpecialForms } = require(\"./environment.js\");\n\nconst { Value } = require(\"./ast.js\");\n\nSpecialForms[\"++\"] = (args, env) => {\n if (args.length !== 1) {\n throw new SyntaxError(\"Bad use of ++\");\n }\n\n return incrementHelper(args[0], env, 1);\n};\n\nSpecialForms[\"--\"] = (args, env) => {\n if (args.length !== 1) {\n throw new SyntaxError(\"Bad use of --\");\n }\n\n return incrementHelper(args[0], env, -1);\n};\n\nSpecialForms[\"+=\"] = (args, env) => {\n if (args.length !== 2) {\n throw new SyntaxError(\"Bad use of +=\");\n }\n\n const inc = args[1].evaluate(env);\n\n return incrementHelper(args[0], env, inc);\n};\n\nSpecialForms[\"-=\"] = (args, env) => {\n if (args.length !== 2) {\n throw new SyntaxError(\"Bad use of -=\");\n }\n\n const inc = args[1].evaluate(env);\n\n return incrementHelper(args[0], env, -inc);\n};\n\nconst incrementHelper = (variable, env, inc) => {\n const varValue = variable.evaluate(env);\n\n const token = { type: \"value\", value: varValue + inc };\n const newValue = new Value(token);\n\n return SpecialForms[\"set\"]([variable, newValue], env);\n};\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/arithm.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 49,
"kind": "function",
"name": "incrementHelper",
"memberof": "lib/interp/arithm.js",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/arithm.js~incrementHelper",
"access": "public",
"export": false,
"importPath": "eggtended-js/lib/interp/arithm.js",
"importStyle": null,
"description": null,
"lineNumber": 41,
"undocument": true,
"params": [
{
"name": "variable",
"types": [
"*"
]
},
{
"name": "env",
"types": [
"*"
]
},
{
"name": "inc",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
},
"ignore": true
},
{
"__docId__": 50,
"kind": "file",
"name": "lib/interp/ast.js",
"content": "// AST class nodes\nconst xRegExp = require(\"xregexp\");\nconst utils = require(\"../utils.js\");\n\nconst { SpecialForms } = require(\"./environment.js\");\n\nclass Value {\n constructor(token) {\n this.type = \"value\";\n this.value = token.value;\n }\n\n evaluate() {\n return this.value;\n }\n}\n\nclass Word {\n constructor(token) {\n this.type = \"word\";\n this.name = token.value;\n }\n\n evaluate(env) {\n // Variable\n if (this.name in env) {\n return env[this.name];\n\n // Object variable referenced without using 'this'\n } else if (\"this\" in env && this.name in env[\"this\"]) {\n return env[\"this\"][this.name];\n } else {\n throw new ReferenceError(`Undefined variable: ${this.name}`);\n }\n }\n}\n\nclass Apply {\n constructor(expr) {\n this.type = \"apply\";\n this.operator = expr;\n this.args = [];\n }\n\n evaluate(env) {\n // Check if its a specialForm function\n if (this.operator.type === \"word\" && this.operator.name in SpecialForms) {\n return SpecialForms[this.operator.name](this.args, env);\n }\n\n // Evaluated operator\n let op = this.operator.evaluate(env);\n // Evaluated arguments\n let evArgs = this.args.map(arg => arg.evaluate(env));\n\n if (typeof op === \"function\") {\n // Is a function\n return op(...evArgs);\n }\n\n if (typeof op !== \"undefined\") {\n // Is an object, number, string or boolean\n let name = evArgs[0];\n let methodArgs = evArgs.slice(1);\n\n // Check if the name of the method/property is defined on the object\n if (typeof op[name] !== \"undefined\") {\n // Execute as function\n if (typeof op[name] === \"function\") {\n return op[name](...methodArgs);\n\n // Return as property\n } else {\n return op[name];\n }\n\n // If the name of the method is not defined on the object...\n } else {\n // Check if its a Map property.\n if (op instanceof Map) {\n if (typeof op.get(name) === \"function\") {\n return op.get(name)(...methodArgs);\n } else {\n return op.get(name);\n }\n }\n\n // Try to call the 'missing' method\n if (typeof op[\"__missing__\"] === \"function\") {\n return op[\"__missing__\"](...methodArgs);\n\n // As a last resort, throw an Exception\n } else {\n throw new SyntaxError(`The method '${name}' was not found on the\n object '${utils.ins(op)}'`);\n }\n }\n }\n\n throw new TypeError(`Could not resolve the apply expression`);\n }\n}\n\nclass Regex {\n constructor(token) {\n this.type = \"regex\";\n\n this.body = token.body;\n this.flags = token.flags;\n }\n\n evaluate() {\n return new xRegExp(this.body, this.flags);\n }\n}\n\nmodule.exports = {\n Value,\n Word,\n Apply,\n Regex\n};\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/ast.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 51,
"kind": "class",
"name": "Value",
"memberof": "lib/interp/ast.js",
"static": true,
"longname": "lib/interp/ast.js~Value",
"access": "public",
"export": true,
"importPath": "eggtended-js/lib/interp/ast.js",
"importStyle": "{Value}",
"description": null,
"lineNumber": 7,
"undocument": true,
"interface": false
},
{
"__docId__": 52,
"kind": "constructor",
"name": "constructor",
"memberof": "lib/interp/ast.js~Value",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Value#constructor",
"access": "public",
"description": null,
"lineNumber": 8,
"undocument": true
},
{
"__docId__": 53,
"kind": "member",
"name": "type",
"memberof": "lib/interp/ast.js~Value",
"static": false,
"longname": "lib/interp/ast.js~Value#type",
"access": "public",
"description": null,
"lineNumber": 9,
"undocument": true,
"type": {
"types": [
"string"
]
}
},
{
"__docId__": 54,
"kind": "member",
"name": "value",
"memberof": "lib/interp/ast.js~Value",
"static": false,
"longname": "lib/interp/ast.js~Value#value",
"access": "public",
"description": null,
"lineNumber": 10,
"undocument": true,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 55,
"kind": "method",
"name": "evaluate",
"memberof": "lib/interp/ast.js~Value",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Value#evaluate",
"access": "public",
"description": null,
"lineNumber": 13,
"undocument": true,
"params": [],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 56,
"kind": "class",
"name": "Word",
"memberof": "lib/interp/ast.js",
"static": true,
"longname": "lib/interp/ast.js~Word",
"access": "public",
"export": true,
"importPath": "eggtended-js/lib/interp/ast.js",
"importStyle": "{Word}",
"description": null,
"lineNumber": 18,
"undocument": true,
"interface": false
},
{
"__docId__": 57,
"kind": "constructor",
"name": "constructor",
"memberof": "lib/interp/ast.js~Word",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Word#constructor",
"access": "public",
"description": null,
"lineNumber": 19,
"undocument": true
},
{
"__docId__": 58,
"kind": "member",
"name": "type",
"memberof": "lib/interp/ast.js~Word",
"static": false,
"longname": "lib/interp/ast.js~Word#type",
"access": "public",
"description": null,
"lineNumber": 20,
"undocument": true,
"type": {
"types": [
"string"
]
}
},
{
"__docId__": 59,
"kind": "member",
"name": "name",
"memberof": "lib/interp/ast.js~Word",
"static": false,
"longname": "lib/interp/ast.js~Word#name",
"access": "public",
"description": null,
"lineNumber": 21,
"undocument": true,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 60,
"kind": "method",
"name": "evaluate",
"memberof": "lib/interp/ast.js~Word",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Word#evaluate",
"access": "public",
"description": null,
"lineNumber": 24,
"undocument": true,
"params": [
{
"name": "env",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 61,
"kind": "class",
"name": "Apply",
"memberof": "lib/interp/ast.js",
"static": true,
"longname": "lib/interp/ast.js~Apply",
"access": "public",
"export": true,
"importPath": "eggtended-js/lib/interp/ast.js",
"importStyle": "{Apply}",
"description": null,
"lineNumber": 38,
"undocument": true,
"interface": false
},
{
"__docId__": 62,
"kind": "constructor",
"name": "constructor",
"memberof": "lib/interp/ast.js~Apply",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Apply#constructor",
"access": "public",
"description": null,
"lineNumber": 39,
"undocument": true
},
{
"__docId__": 63,
"kind": "member",
"name": "type",
"memberof": "lib/interp/ast.js~Apply",
"static": false,
"longname": "lib/interp/ast.js~Apply#type",
"access": "public",
"description": null,
"lineNumber": 40,
"undocument": true,
"type": {
"types": [
"string"
]
}
},
{
"__docId__": 64,
"kind": "member",
"name": "operator",
"memberof": "lib/interp/ast.js~Apply",
"static": false,
"longname": "lib/interp/ast.js~Apply#operator",
"access": "public",
"description": null,
"lineNumber": 41,
"undocument": true,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 65,
"kind": "member",
"name": "args",
"memberof": "lib/interp/ast.js~Apply",
"static": false,
"longname": "lib/interp/ast.js~Apply#args",
"access": "public",
"description": null,
"lineNumber": 42,
"undocument": true,
"type": {
"types": [
"*[]"
]
}
},
{
"__docId__": 66,
"kind": "method",
"name": "evaluate",
"memberof": "lib/interp/ast.js~Apply",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Apply#evaluate",
"access": "public",
"description": null,
"lineNumber": 45,
"undocument": true,
"params": [
{
"name": "env",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 67,
"kind": "class",
"name": "Regex",
"memberof": "lib/interp/ast.js",
"static": true,
"longname": "lib/interp/ast.js~Regex",
"access": "public",
"export": true,
"importPath": "eggtended-js/lib/interp/ast.js",
"importStyle": "{Regex}",
"description": null,
"lineNumber": 104,
"undocument": true,
"interface": false
},
{
"__docId__": 68,
"kind": "constructor",
"name": "constructor",
"memberof": "lib/interp/ast.js~Regex",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Regex#constructor",
"access": "public",
"description": null,
"lineNumber": 105,
"undocument": true
},
{
"__docId__": 69,
"kind": "member",
"name": "type",
"memberof": "lib/interp/ast.js~Regex",
"static": false,
"longname": "lib/interp/ast.js~Regex#type",
"access": "public",
"description": null,
"lineNumber": 106,
"undocument": true,
"type": {
"types": [
"string"
]
}
},
{
"__docId__": 70,
"kind": "member",
"name": "body",
"memberof": "lib/interp/ast.js~Regex",
"static": false,
"longname": "lib/interp/ast.js~Regex#body",
"access": "public",
"description": null,
"lineNumber": 108,
"undocument": true,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 71,
"kind": "member",
"name": "flags",
"memberof": "lib/interp/ast.js~Regex",
"static": false,
"longname": "lib/interp/ast.js~Regex#flags",
"access": "public",
"description": null,
"lineNumber": 109,
"undocument": true,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 72,
"kind": "method",
"name": "evaluate",
"memberof": "lib/interp/ast.js~Regex",
"generator": false,
"async": false,
"static": false,
"longname": "lib/interp/ast.js~Regex#evaluate",
"access": "public",
"description": null,
"lineNumber": 112,
"undocument": true,
"params": [],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 73,
"kind": "file",
"name": "lib/interp/eggvm.js",
"content": "// Add monkey-patching functions and extended functions\nrequire(\"./monkey-patching.js\");\nrequire(\"./require.js\");\nrequire(\"./arithm.js\");\nrequire(\"./exceptions.js\");\nrequire(\"./typing.js\");\n\nconst fs = require(\"fs\");\n\nconst { Parser } = require(\"../parser/parse.js\");\nconst { TopEnv } = require(\"./environment.js\");\nconst { json2AST } = require(\"../parser/json2AST.js\");\n\nclass Eggvm {\n static run(program) {\n const tree = Parser.parse(program);\n\n return Eggvm.eval(tree);\n }\n\n static runFromFile(file) {\n const program = fs.readFileSync(file, \"utf8\");\n\n return Eggvm.run(program);\n }\n\n static runFromEVM(file) {\n const rawData = fs.readFileSync(file);\n let json = JSON.parse(rawData);\n\n const tree = json2AST(json);\n\n return Eggvm.eval(tree);\n }\n\n static eval(tree, env) {\n // Create a new env if not already defined on parameters\n if (env === undefined || env === null) {\n env = Object.create(TopEnv);\n }\n\n return tree !== null ? tree.evaluate(env) : null;\n }\n\n static getEnvFromFile(file) {\n const env = Object.create(TopEnv);\n const tree = Parser.parseFromFile(file);\n Eggvm.eval(tree, env);\n\n return env;\n }\n}\n\nmodule.exports = {\n Eggvm\n};\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/eggvm.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 74,
"kind": "class",
"name": "Eggvm",
"memberof": "lib/interp/eggvm.js",
"static": true,
"longname": "lib/interp/eggvm.js~Eggvm",
"access": "public",
"export": true,
"importPath": "eggtended-js/lib/interp/eggvm.js",
"importStyle": "{Eggvm}",
"description": null,
"lineNumber": 14,
"undocument": true,
"interface": false
},
{
"__docId__": 75,
"kind": "method",
"name": "run",
"memberof": "lib/interp/eggvm.js~Eggvm",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/eggvm.js~Eggvm.run",
"access": "public",
"description": null,
"lineNumber": 15,
"undocument": true,
"params": [
{
"name": "program",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 76,
"kind": "method",
"name": "runFromFile",
"memberof": "lib/interp/eggvm.js~Eggvm",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/eggvm.js~Eggvm.runFromFile",
"access": "public",
"description": null,
"lineNumber": 21,
"undocument": true,
"params": [
{
"name": "file",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 77,
"kind": "method",
"name": "runFromEVM",
"memberof": "lib/interp/eggvm.js~Eggvm",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/eggvm.js~Eggvm.runFromEVM",
"access": "public",
"description": null,
"lineNumber": 27,
"undocument": true,
"params": [
{
"name": "file",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 78,
"kind": "method",
"name": "eval",
"memberof": "lib/interp/eggvm.js~Eggvm",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/eggvm.js~Eggvm.eval",
"access": "public",
"description": null,
"lineNumber": 36,
"undocument": true,
"params": [
{
"name": "tree",
"types": [
"*"
]
},
{
"name": "env",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 79,
"kind": "method",
"name": "getEnvFromFile",
"memberof": "lib/interp/eggvm.js~Eggvm",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/eggvm.js~Eggvm.getEnvFromFile",
"access": "public",
"description": null,
"lineNumber": 45,
"undocument": true,
"params": [
{
"name": "file",
"types": [
"*"
]
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 80,
"kind": "file",
"name": "lib/interp/environment.js",
"content": "const { SpecialForms, TopEnv } = require(\"./registry.js\");\n\nmodule.exports = {\n SpecialForms,\n TopEnv\n};\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/environment.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 81,
"kind": "file",
"name": "lib/interp/exceptions.js",
"content": "const { SpecialForms, TopEnv } = require(\"./registry\");\n\nSpecialForms[\"try\"] = (args, env) => {\n if (args.length < 2) {\n throw new SyntaxError(\"Bad use of try-catch block\");\n }\n\n const body = args[0];\n const catch_body = args[1];\n\n try {\n body.evaluate(env);\n } catch (err) {\n env[\"__error__\"] = err;\n catch_body.evaluate(env);\n } finally {\n if (args.length === 3) {\n const finally_body = args[2];\n\n finally_body.evaluate(env);\n }\n }\n\n return false;\n};\n\nTopEnv[\"throw\"] = obj => {\n throw obj;\n};\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/exceptions.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 82,
"kind": "file",
"name": "lib/interp/index.js",
"content": "const { Eggvm } = require(\"./eggvm.js\");\nconst { Value, Word, Apply, Regex } = require(\"./ast.js\");\n\nmodule.exports = {\n Eggvm,\n Value,\n Word,\n Apply,\n Regex\n};\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/index.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 83,
"kind": "file",
"name": "lib/interp/monkey-patching.js",
"content": "// SUB\nconst utils = require(\"../utils.js\");\n\nObject.prototype.sub = function(...indices) {\n utils.checkIterable(this, indices.length);\n\n // Get index\n let index = indices[0];\n if (this instanceof Array) {\n index = utils.getValidIndex(this.length, indices[0]);\n }\n\n // Get value\n let value;\n if (this instanceof Map) {\n value = this.get(index);\n } else {\n value = this[index];\n }\n\n // Return value or keep recursion\n if (indices.length === 1) {\n return value;\n }\n\n return value.sub(...indices.slice(1));\n};\n\n// SETELEM\n\nObject.prototype.setelem = function(value, ...indices) {\n utils.checkIterable(this, indices.length);\n\n // Get index\n let index = indices[0];\n if (this instanceof Array) {\n index = utils.getValidIndex(this.length, indices[0]);\n }\n\n // Set value or continue the recursion\n if (indices.length === 1) {\n if (this instanceof Map) {\n this.set(index, value);\n } else {\n this[index] = value;\n }\n\n return value;\n }\n\n const obj = this.sub(index);\n return obj.setelem(value, ...indices.slice(1));\n};\n\n// NUMBER\n\n[\"+\", \"-\", \"*\", \"/\"].forEach(op => {\n Number.prototype[op] = new Function(\n \"...values\",\n `return [this, ...values].reduce((a, b) => a ${op} b);`\n );\n});\n\nNumber.prototype[\"__missing__\"] = Number.prototype[\"+\"];\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/monkey-patching.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 84,
"kind": "function",
"name": "sub",
"memberof": "lib/interp/monkey-patching.js",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/monkey-patching.js~sub",
"access": "public",
"export": false,
"importPath": "eggtended-js/lib/interp/monkey-patching.js",
"importStyle": null,
"description": null,
"lineNumber": 4,
"undocument": true,
"params": [
{
"name": "indices",
"types": [
"...*"
],
"spread": true
}
],
"return": {
"types": [
"*"
]
},
"ignore": true
},
{
"__docId__": 85,
"kind": "function",
"name": "setelem",
"memberof": "lib/interp/monkey-patching.js",
"generator": false,
"async": false,
"static": true,
"longname": "lib/interp/monkey-patching.js~setelem",
"access": "public",
"export": false,
"importPath": "eggtended-js/lib/interp/monkey-patching.js",
"importStyle": null,
"description": null,
"lineNumber": 31,
"undocument": true,
"params": [
{
"name": "value",
"types": [
"*"
]
},
{
"name": "indices",
"types": [
"...*"
],
"spread": true
}
],
"return": {
"types": [
"*"
]
},
"ignore": true
},
{
"__docId__": 86,
"kind": "file",
"name": "lib/interp/registry.js",
"content": "const xRegExp = require(\"xregexp\");\n\nconst utils = require(\"../utils.js\");\n\nconst { SymbolTable } = require(\"./symboltable.js\");\n\n// specialForms and topEnv maps\nconst SpecialForms = Object.create(null);\nconst TopEnv = Object.create(null);\n\nSpecialForms[\"if\"] = (args, env) => {\n if (args.length !== 3) {\n throw new SyntaxError(\"Bad number of args passed to if\");\n }\n\n if (args[0].evaluate(env) === true) {\n return args[1].evaluate(env);\n } else {\n return args[2].evaluate(env);\n }\n};\n\nSpecialForms[\"while\"] = (args, env) => {\n if (args.length !== 2) {\n throw new SyntaxError(\"Bad number of args passed to while\");\n }\n\n while (args[0].evaluate(env) === true) {\n args[1].evaluate(env);\n }\n\n // Egg has no undefined so we return false when there's no meaningful result\n return false;\n};\n\nSpecialForms[\"for\"] = (args, env) => {\n if (args.length !== 4) {\n throw new SyntaxError(\"Bad number of args passed to for\");\n }\n\n const forEnv = Object.create(env);\n forEnv[\"__symbol__\"] = new SymbolTable();\n\n // Variable\n args[0].evaluate(forEnv);\n\n // Condition\n while (args[1].evaluate(forEnv) === true) {\n // Body\n args[3].evaluate(forEnv);\n\n // Increment\n args[2].evaluate(forEnv);\n }\n\n return false;\n};\n\nSpecialForms[\"foreach\"] = (args, env) => {\n if (args.length !== 3) {\n throw new SyntaxError(\"Bad number of args passed to foreach\");\n }\n\n if (args[0].type !== \"word\") {\n throw new SyntaxError(\"The first argument to foreach must be a valid word\");\n }\n\n const localEnv = Object.create(env);\n localEnv[\"__symbol__\"] = new SymbolTable();\n\n const iterable = args[1].evaluate(localEnv);\n for (const val of iterable) {\n localEnv[args[0].name] = val;\n args[2].evaluate(localEnv);\n }\n\n return false;\n};\n\nSpecialForms[\"do\"] = (args, env) => {\n let value = false;\n\n args.forEach(arg => {\n value = arg.evaluate(env);\n });\n\n return value;\n};\n\nSpecialForms[\"def\"] = SpecialForms[\"define\"] = SpecialForms[\":=\"] = (args, env) => {\n if (args.length !== 2) {\n throw new SyntaxError(\"Bad use of define\");\n }\n\n // Value to assign to the variable\n let value = args[1].evaluate(env);\n\n // Variable name\n let valName = args[0].name;\n\n env[valName] = value;\n return value;\n};\n\nSpecialForms[\"fun\"] = SpecialForms[\"->\"] = (args, env) => {\n if (!args.length) {\n throw new SyntaxError(\"Functions need a body.\");\n }\n\n function name(expr) {\n if (expr.type !== \"word\") {\n throw new SyntaxError(\"Arg names must be words\");\n }\n\n return expr.name;\n }\n\n let argNames = args.slice(0, args.length - 1).map(name);\n let body = args[args.length - 1];\n\n return function() {\n if (arguments.length !== argNames.length) {\n throw new TypeError(\"Wrong number of arguments\");\n }\n\n const localEnv = Object.create(env);\n localEnv[\"__symbol__\"] = new SymbolTable();\n\n for (let i = 0; i < arguments.length; i++) {\n localEnv[argNames[i]] = arguments[i];\n }\n\n return body.evaluate(localEnv);\n };\n};\n\nSpecialForms[\"set\"] = SpecialForms[\"=\"] = (args, env) => {\n if (args[0].type !== \"word\") {\n throw new SyntaxError(\"Bad use of set\");\n }\n\n let valName = args[0].name;\n\n let indices = args.slice(1, -1).map(arg => arg.evaluate(env));\n\n let value = args[args.length - 1].evaluate(env);\n\n for (let scope = env; scope; scope = Object.getPrototypeOf(scope)) {\n if (scope[\"__symbol__\"].checkAttribute(\"const\", valName)) {\n throw new ReferenceError(`Trying to change 'const' variable ${args[0].name}`);\n }\n\n // TODO: Reduce code duplication\n if (\"this\" in scope) {\n // TODO: use hasOwnProperty ?\n\n if (Object.prototype.hasOwnProperty.call(scope[\"this\"], valName)) {\n if (indices.length === 0) {\n scope[\"this\"][valName] = value;\n } else {\n scope[\"this\"][valName].setelem(value, ...indices);\n }\n\n return value;\n }\n }\n\n if (Object.prototype.hasOwnProperty.call(scope, valName)) {\n if (indices.length === 0) {\n scope[valName] = value;\n } else {\n scope[valName].setelem(value, ...indices);\n }\n\n return value;\n }\n }\n\n throw new ReferenceError(`Tried setting an undefined variable: ${valName}`);\n};\n\nSpecialForms[\"object\"] = (args, env) => {\n // Create a new object and a new scope\n const object = {};\n const objectEnv = Object.create(env);\n objectEnv[\"__symbol__\"] = new SymbolTable();\n\n // Add the variable 'this' as a reference to the current object\n objectEnv[\"this\"] = object;\n\n // Evaluate the arguments and add the methods/properties to the object\n const evArgs = args.map(arg => arg.evaluate(objectEnv));\n\n for (const pair of utils.chunk(evArgs, 2)) {\n const name = pair[0];\n const value = pair[1];\n\n object[name] = value;\n }\n\n return object;\n};\n\n// TODO: Continue implementing class?\n//\n// SpecialForms['class'] = (args, env) => {\n// // const evArgs = args.map((arg) => evaluate(arg, env));\n//\n// const newClass = function(x, y) {\n// this.x = x;\n// this.y = y;\n// }\n//\n// return newClass;\n// }\n\n[\"+\", \"-\", \"*\", \"/\", \"==\", \"!=\", \"<\", \">\", \">=\", \"<=\", \"&&\", \"||\"].forEach(op => {\n TopEnv[op] = new Function(\"a, b\", `return a ${op} b;`);\n});\n\nTopEnv[\"true\"] = true;\nTopEnv[\"false\"] = false;\nTopEnv[\"null\"] = null;\n\nTopEnv[\"print\"] = value => {\n console.log(value);\n return value;\n};\n\nTopEnv[\"arr\"] = TopEnv[\"array\"] = (...args) => {\n return args;\n};\n\nTopEnv[\"map\"] = TopEnv[\"dict\"] = (...args) => {\n return new Map(utils.chunk(args, 2));\n};\n\nTopEnv[\"<-\"] = TopEnv[\"[]\"] = TopEnv[\"element\"] = (object, ...indices) => {\n return object.sub(...indices);\n};\n\nTopEnv[\"length\"] = array => {\n return array.length;\n};\n\nTopEnv[\"RegExp\"] = (method, ...args) => {\n return xRegExp[method](...args);\n};\n\nTopEnv[\"child\"] = parent => {\n return Object.create(parent);\n};\n\nTopEnv[\"__symbol__\"] = new SymbolTable();\n\n// WIP: Continue implementing class?\n// TopEnv['new'] = (...args) => {\n// const className = args[0];\n//\n// // TODO: Check for more exceptions\n// if(typeof className !== \"function\") {\n// throw new SyntaxError(`${className} must be a class with a constructor.`)\n// }\n//\n// return new className(...args.slice(1));\n//\n\nmodule.exports = {\n SpecialForms,\n TopEnv\n};\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/registry.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 87,
"kind": "variable",
"name": "SpecialForms",
"memberof": "lib/interp/registry.js",
"static": true,
"longname": "lib/interp/registry.js~SpecialForms",
"access": "public",
"export": true,
"importPath": "eggtended-js/lib/interp/registry.js",
"importStyle": "{SpecialForms}",
"description": null,
"lineNumber": 8,
"undocument": true,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 88,
"kind": "variable",
"name": "TopEnv",
"memberof": "lib/interp/registry.js",
"static": true,
"longname": "lib/interp/registry.js~TopEnv",
"access": "public",
"export": true,
"importPath": "eggtended-js/lib/interp/registry.js",
"importStyle": "{TopEnv}",
"description": null,
"lineNumber": 9,
"undocument": true,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 89,
"kind": "file",
"name": "lib/interp/require.js",
"content": "const { TopEnv } = require(\"./environment.js\");\nconst { Parser } = require(\"../parser/parse.js\");\nconst { SymbolTable } = require(\"./symboltable.js\");\n\nTopEnv[\"require\"] = file => {\n if (!(file in TopEnv[\"require\"].cache)) {\n const tree = Parser.parseFromFile(file);\n const env = Object.create(TopEnv);\n env[\"__symbol__\"] = new SymbolTable();\n\n tree.evaluate(env);\n\n const module = { exports: env[\"module\"].exports };\n\n TopEnv[\"require\"].cache[file] = module;\n }\n\n return TopEnv[\"require\"].cache[file].exports;\n};\n\nTopEnv[\"require\"].cache = Object.create(null);\nTopEnv[\"module\"] = { exports: {} };\n",
"static": true,
"longname": "/home/dav/eggtended-js/lib/interp/require.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 90,
"kind": "file",
"name": "lib/interp/symboltable.js",
"content": "class SymbolTable {\n addAttribute(attribute, value, name) {\n if (!(name in this)) {\n this[name] =