affinirum 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +301 -0
- package/dst/Affinirum.d.ts +73 -0
- package/dst/Affinirum.js +536 -0
- package/dst/Constant.d.ts +15 -0
- package/dst/Constant.js +26 -0
- package/dst/Constants.d.ts +2 -0
- package/dst/Constants.js +22 -0
- package/dst/Functions.d.ts +2 -0
- package/dst/Functions.js +85 -0
- package/dst/Keywords.d.ts +1 -0
- package/dst/Keywords.js +17 -0
- package/dst/Node.d.ts +13 -0
- package/dst/Node.js +22 -0
- package/dst/ParserFrame.d.ts +13 -0
- package/dst/ParserFrame.js +80 -0
- package/dst/ParserState.d.ts +54 -0
- package/dst/ParserState.js +562 -0
- package/dst/StaticScope.d.ts +13 -0
- package/dst/StaticScope.js +44 -0
- package/dst/Type.d.ts +72 -0
- package/dst/Type.js +196 -0
- package/dst/Value.d.ts +3 -0
- package/dst/Value.js +1 -0
- package/dst/Variable.d.ts +13 -0
- package/dst/Variable.js +25 -0
- package/dst/atom/ArrayAtom.d.ts +11 -0
- package/dst/atom/ArrayAtom.js +38 -0
- package/dst/atom/FunctionAtom.d.ts +17 -0
- package/dst/atom/FunctionAtom.js +54 -0
- package/dst/atom/ObjectAtom.d.ts +11 -0
- package/dst/atom/ObjectAtom.js +44 -0
- package/dst/atom/PrimitiveAtom.d.ts +8 -0
- package/dst/atom/PrimitiveAtom.js +26 -0
- package/dst/cjs/Affinirum.js +540 -0
- package/dst/cjs/Constant.js +30 -0
- package/dst/cjs/Constants.js +25 -0
- package/dst/cjs/Functions.js +88 -0
- package/dst/cjs/Keywords.js +20 -0
- package/dst/cjs/Node.js +26 -0
- package/dst/cjs/ParserFrame.js +84 -0
- package/dst/cjs/ParserState.js +566 -0
- package/dst/cjs/StaticScope.js +48 -0
- package/dst/cjs/Type.js +200 -0
- package/dst/cjs/Value.js +2 -0
- package/dst/cjs/Variable.js +29 -0
- package/dst/cjs/atom/ArrayAtom.js +42 -0
- package/dst/cjs/atom/FunctionAtom.js +58 -0
- package/dst/cjs/atom/ObjectAtom.js +48 -0
- package/dst/cjs/atom/PrimitiveAtom.js +30 -0
- package/dst/cjs/constant/Array.js +93 -0
- package/dst/cjs/constant/Boolean.js +25 -0
- package/dst/cjs/constant/Buffer.js +68 -0
- package/dst/cjs/constant/Enumerable.js +34 -0
- package/dst/cjs/constant/Float.js +85 -0
- package/dst/cjs/constant/Integer.js +104 -0
- package/dst/cjs/constant/Iterable.js +24 -0
- package/dst/cjs/constant/Number.js +59 -0
- package/dst/cjs/constant/Object.js +13 -0
- package/dst/cjs/constant/String.js +197 -0
- package/dst/cjs/constant/Timestamp.js +56 -0
- package/dst/cjs/constant/Unknown.js +101 -0
- package/dst/cjs/constant/notation/AN.js +46 -0
- package/dst/cjs/constant/notation/JSON.js +14 -0
- package/dst/cjs/index.js +19 -0
- package/dst/cjs/node/ArrayNode.js +34 -0
- package/dst/cjs/node/BlockNode.js +33 -0
- package/dst/cjs/node/CallNode.js +54 -0
- package/dst/cjs/node/ConstantNode.js +33 -0
- package/dst/cjs/node/LoopNode.js +34 -0
- package/dst/cjs/node/ObjectNode.js +42 -0
- package/dst/cjs/node/SwitchNode.js +45 -0
- package/dst/cjs/node/VariableNode.js +30 -0
- package/dst/cjs/package.json +3 -0
- package/dst/constant/Array.d.ts +22 -0
- package/dst/constant/Array.js +90 -0
- package/dst/constant/Boolean.d.ts +11 -0
- package/dst/constant/Boolean.js +22 -0
- package/dst/constant/Buffer.d.ts +10 -0
- package/dst/constant/Buffer.js +61 -0
- package/dst/constant/Enumerable.d.ts +5 -0
- package/dst/constant/Enumerable.js +31 -0
- package/dst/constant/Float.d.ts +22 -0
- package/dst/constant/Float.js +80 -0
- package/dst/constant/Integer.d.ts +10 -0
- package/dst/constant/Integer.js +100 -0
- package/dst/constant/Iterable.d.ts +3 -0
- package/dst/constant/Iterable.js +21 -0
- package/dst/constant/Number.d.ts +14 -0
- package/dst/constant/Number.js +56 -0
- package/dst/constant/Object.d.ts +7 -0
- package/dst/constant/Object.js +10 -0
- package/dst/constant/String.d.ts +34 -0
- package/dst/constant/String.js +179 -0
- package/dst/constant/Timestamp.d.ts +20 -0
- package/dst/constant/Timestamp.js +50 -0
- package/dst/constant/Unknown.d.ts +10 -0
- package/dst/constant/Unknown.js +95 -0
- package/dst/constant/notation/AN.d.ts +6 -0
- package/dst/constant/notation/AN.js +42 -0
- package/dst/constant/notation/JSON.d.ts +7 -0
- package/dst/constant/notation/JSON.js +10 -0
- package/dst/index.d.ts +3 -0
- package/dst/index.js +3 -0
- package/dst/node/ArrayNode.d.ts +12 -0
- package/dst/node/ArrayNode.js +30 -0
- package/dst/node/BlockNode.d.ts +12 -0
- package/dst/node/BlockNode.js +29 -0
- package/dst/node/CallNode.d.ts +14 -0
- package/dst/node/CallNode.js +50 -0
- package/dst/node/ConstantNode.d.ts +15 -0
- package/dst/node/ConstantNode.js +29 -0
- package/dst/node/LoopNode.d.ts +13 -0
- package/dst/node/LoopNode.js +30 -0
- package/dst/node/ObjectNode.d.ts +13 -0
- package/dst/node/ObjectNode.js +38 -0
- package/dst/node/SwitchNode.d.ts +14 -0
- package/dst/node/SwitchNode.js +41 -0
- package/dst/node/VariableNode.d.ts +14 -0
- package/dst/node/VariableNode.js +26 -0
- package/package.json +67 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Node } from '../Node.js';
|
|
2
|
+
export class VariableNode extends Node {
|
|
3
|
+
_variable;
|
|
4
|
+
_subnode;
|
|
5
|
+
constructor(frame, _variable, _subnode) {
|
|
6
|
+
super(frame);
|
|
7
|
+
this._variable = _variable;
|
|
8
|
+
this._subnode = _subnode;
|
|
9
|
+
}
|
|
10
|
+
get type() {
|
|
11
|
+
return this._variable.type;
|
|
12
|
+
}
|
|
13
|
+
compile(type) {
|
|
14
|
+
this._subnode = this._subnode?.compile(type);
|
|
15
|
+
this._variable.type = this.reduceType(this._subnode?.type ?? type);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
evaluate() {
|
|
19
|
+
return this._subnode ? this._variable.value = this._subnode.evaluate() : this._variable.value;
|
|
20
|
+
}
|
|
21
|
+
toString(ident = 0) {
|
|
22
|
+
return this._subnode
|
|
23
|
+
? `${super.toString(ident)} variable node subnode:\n${this._subnode.toString(ident + 1)}`
|
|
24
|
+
: `${super.toString(ident)} variable node`;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "affinirum",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Affinirum Scripting Language",
|
|
5
|
+
"main": "dst/cjs/index.js",
|
|
6
|
+
"module": "dst/index.js",
|
|
7
|
+
"types": "dst/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"hopmepage": "https://github.com/affinir/affinirum",
|
|
10
|
+
"bugs": "https://github.com/affinir/affinirum/issues",
|
|
11
|
+
"author": "Riad Baghbanli <riadb@affinir.com>",
|
|
12
|
+
"contributors": [
|
|
13
|
+
{
|
|
14
|
+
"name": "Riad Baghbanli",
|
|
15
|
+
"email": "riadb@affinir.com"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"Affinirum",
|
|
20
|
+
"scripting",
|
|
21
|
+
"language",
|
|
22
|
+
"parsing",
|
|
23
|
+
"compilation",
|
|
24
|
+
"evaluation",
|
|
25
|
+
"void",
|
|
26
|
+
"boolean",
|
|
27
|
+
"timestamp",
|
|
28
|
+
"float",
|
|
29
|
+
"integer",
|
|
30
|
+
"buffer",
|
|
31
|
+
"string",
|
|
32
|
+
"array",
|
|
33
|
+
"object",
|
|
34
|
+
"function"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean": "rimraf --glob dst/* && rimraf --glob *.tgz",
|
|
38
|
+
"prebuild": "npm run clean",
|
|
39
|
+
"build": "tsc --build tsconfig.esm.json && tsc --build tsconfig.cjs.json",
|
|
40
|
+
"pretest": "npm run clean && tsc --build tsconfig.spec.json",
|
|
41
|
+
"test": "jasmine",
|
|
42
|
+
"lint": "eslint ./src ./spec",
|
|
43
|
+
"lint-fix": "eslint ./src ./spec --fix",
|
|
44
|
+
"prepare": "npm run build && copyfiles ./cjs/package.json ./dst"
|
|
45
|
+
},
|
|
46
|
+
"license": "AGPLv3.0",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/affinir/affinirum.git"
|
|
50
|
+
},
|
|
51
|
+
"exports": {
|
|
52
|
+
".": {
|
|
53
|
+
"import": "./dst/index.js",
|
|
54
|
+
"require": "./dst/cjs/index.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/jasmine": "~5.1.7",
|
|
60
|
+
"copyfiles": "~2.4.1",
|
|
61
|
+
"eslint": "~9.25.1",
|
|
62
|
+
"jasmine": "~5.7.0",
|
|
63
|
+
"rimraf": "~6.0.1",
|
|
64
|
+
"typescript": "~5.8.3",
|
|
65
|
+
"typescript-eslint": "~8.31.1"
|
|
66
|
+
}
|
|
67
|
+
}
|