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.
Files changed (121) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +301 -0
  3. package/dst/Affinirum.d.ts +73 -0
  4. package/dst/Affinirum.js +536 -0
  5. package/dst/Constant.d.ts +15 -0
  6. package/dst/Constant.js +26 -0
  7. package/dst/Constants.d.ts +2 -0
  8. package/dst/Constants.js +22 -0
  9. package/dst/Functions.d.ts +2 -0
  10. package/dst/Functions.js +85 -0
  11. package/dst/Keywords.d.ts +1 -0
  12. package/dst/Keywords.js +17 -0
  13. package/dst/Node.d.ts +13 -0
  14. package/dst/Node.js +22 -0
  15. package/dst/ParserFrame.d.ts +13 -0
  16. package/dst/ParserFrame.js +80 -0
  17. package/dst/ParserState.d.ts +54 -0
  18. package/dst/ParserState.js +562 -0
  19. package/dst/StaticScope.d.ts +13 -0
  20. package/dst/StaticScope.js +44 -0
  21. package/dst/Type.d.ts +72 -0
  22. package/dst/Type.js +196 -0
  23. package/dst/Value.d.ts +3 -0
  24. package/dst/Value.js +1 -0
  25. package/dst/Variable.d.ts +13 -0
  26. package/dst/Variable.js +25 -0
  27. package/dst/atom/ArrayAtom.d.ts +11 -0
  28. package/dst/atom/ArrayAtom.js +38 -0
  29. package/dst/atom/FunctionAtom.d.ts +17 -0
  30. package/dst/atom/FunctionAtom.js +54 -0
  31. package/dst/atom/ObjectAtom.d.ts +11 -0
  32. package/dst/atom/ObjectAtom.js +44 -0
  33. package/dst/atom/PrimitiveAtom.d.ts +8 -0
  34. package/dst/atom/PrimitiveAtom.js +26 -0
  35. package/dst/cjs/Affinirum.js +540 -0
  36. package/dst/cjs/Constant.js +30 -0
  37. package/dst/cjs/Constants.js +25 -0
  38. package/dst/cjs/Functions.js +88 -0
  39. package/dst/cjs/Keywords.js +20 -0
  40. package/dst/cjs/Node.js +26 -0
  41. package/dst/cjs/ParserFrame.js +84 -0
  42. package/dst/cjs/ParserState.js +566 -0
  43. package/dst/cjs/StaticScope.js +48 -0
  44. package/dst/cjs/Type.js +200 -0
  45. package/dst/cjs/Value.js +2 -0
  46. package/dst/cjs/Variable.js +29 -0
  47. package/dst/cjs/atom/ArrayAtom.js +42 -0
  48. package/dst/cjs/atom/FunctionAtom.js +58 -0
  49. package/dst/cjs/atom/ObjectAtom.js +48 -0
  50. package/dst/cjs/atom/PrimitiveAtom.js +30 -0
  51. package/dst/cjs/constant/Array.js +93 -0
  52. package/dst/cjs/constant/Boolean.js +25 -0
  53. package/dst/cjs/constant/Buffer.js +68 -0
  54. package/dst/cjs/constant/Enumerable.js +34 -0
  55. package/dst/cjs/constant/Float.js +85 -0
  56. package/dst/cjs/constant/Integer.js +104 -0
  57. package/dst/cjs/constant/Iterable.js +24 -0
  58. package/dst/cjs/constant/Number.js +59 -0
  59. package/dst/cjs/constant/Object.js +13 -0
  60. package/dst/cjs/constant/String.js +197 -0
  61. package/dst/cjs/constant/Timestamp.js +56 -0
  62. package/dst/cjs/constant/Unknown.js +101 -0
  63. package/dst/cjs/constant/notation/AN.js +46 -0
  64. package/dst/cjs/constant/notation/JSON.js +14 -0
  65. package/dst/cjs/index.js +19 -0
  66. package/dst/cjs/node/ArrayNode.js +34 -0
  67. package/dst/cjs/node/BlockNode.js +33 -0
  68. package/dst/cjs/node/CallNode.js +54 -0
  69. package/dst/cjs/node/ConstantNode.js +33 -0
  70. package/dst/cjs/node/LoopNode.js +34 -0
  71. package/dst/cjs/node/ObjectNode.js +42 -0
  72. package/dst/cjs/node/SwitchNode.js +45 -0
  73. package/dst/cjs/node/VariableNode.js +30 -0
  74. package/dst/cjs/package.json +3 -0
  75. package/dst/constant/Array.d.ts +22 -0
  76. package/dst/constant/Array.js +90 -0
  77. package/dst/constant/Boolean.d.ts +11 -0
  78. package/dst/constant/Boolean.js +22 -0
  79. package/dst/constant/Buffer.d.ts +10 -0
  80. package/dst/constant/Buffer.js +61 -0
  81. package/dst/constant/Enumerable.d.ts +5 -0
  82. package/dst/constant/Enumerable.js +31 -0
  83. package/dst/constant/Float.d.ts +22 -0
  84. package/dst/constant/Float.js +80 -0
  85. package/dst/constant/Integer.d.ts +10 -0
  86. package/dst/constant/Integer.js +100 -0
  87. package/dst/constant/Iterable.d.ts +3 -0
  88. package/dst/constant/Iterable.js +21 -0
  89. package/dst/constant/Number.d.ts +14 -0
  90. package/dst/constant/Number.js +56 -0
  91. package/dst/constant/Object.d.ts +7 -0
  92. package/dst/constant/Object.js +10 -0
  93. package/dst/constant/String.d.ts +34 -0
  94. package/dst/constant/String.js +179 -0
  95. package/dst/constant/Timestamp.d.ts +20 -0
  96. package/dst/constant/Timestamp.js +50 -0
  97. package/dst/constant/Unknown.d.ts +10 -0
  98. package/dst/constant/Unknown.js +95 -0
  99. package/dst/constant/notation/AN.d.ts +6 -0
  100. package/dst/constant/notation/AN.js +42 -0
  101. package/dst/constant/notation/JSON.d.ts +7 -0
  102. package/dst/constant/notation/JSON.js +10 -0
  103. package/dst/index.d.ts +3 -0
  104. package/dst/index.js +3 -0
  105. package/dst/node/ArrayNode.d.ts +12 -0
  106. package/dst/node/ArrayNode.js +30 -0
  107. package/dst/node/BlockNode.d.ts +12 -0
  108. package/dst/node/BlockNode.js +29 -0
  109. package/dst/node/CallNode.d.ts +14 -0
  110. package/dst/node/CallNode.js +50 -0
  111. package/dst/node/ConstantNode.d.ts +15 -0
  112. package/dst/node/ConstantNode.js +29 -0
  113. package/dst/node/LoopNode.d.ts +13 -0
  114. package/dst/node/LoopNode.js +30 -0
  115. package/dst/node/ObjectNode.d.ts +13 -0
  116. package/dst/node/ObjectNode.js +38 -0
  117. package/dst/node/SwitchNode.d.ts +14 -0
  118. package/dst/node/SwitchNode.js +41 -0
  119. package/dst/node/VariableNode.d.ts +14 -0
  120. package/dst/node/VariableNode.js +26 -0
  121. 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
+ }