mlogjs 0.3.0 → 0.4.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 (278) hide show
  1. package/dist/Compiler.d.ts +39 -0
  2. package/dist/CompilerError.d.ts +33 -0
  3. package/dist/Scope.d.ts +24 -0
  4. package/dist/assertions.d.ts +28 -0
  5. package/dist/bin.cjs +7 -14
  6. package/dist/bin.cjs.map +1 -1
  7. package/dist/bin.d.ts +1 -0
  8. package/dist/handlers/BlockStatement.d.ts +2 -0
  9. package/dist/handlers/CallExpression.d.ts +4 -0
  10. package/dist/handlers/File.d.ts +2 -0
  11. package/dist/handlers/ForStatement.d.ts +2 -0
  12. package/dist/handlers/Function.d.ts +5 -0
  13. package/dist/handlers/Identifier.d.ts +2 -0
  14. package/dist/handlers/IfStatement.d.ts +2 -0
  15. package/dist/handlers/Literal.d.ts +5 -0
  16. package/dist/handlers/Object.d.ts +6 -0
  17. package/dist/handlers/OperationExpressions.d.ts +8 -0
  18. package/dist/handlers/Program.d.ts +2 -0
  19. package/dist/handlers/Statements.d.ts +5 -0
  20. package/dist/handlers/SwitchStatement.d.ts +2 -0
  21. package/dist/handlers/TemplateExpression.d.ts +2 -0
  22. package/dist/handlers/Typescript.d.ts +7 -0
  23. package/dist/handlers/VariableDeclaration.d.ts +3 -0
  24. package/dist/handlers/WhileStatement.d.ts +3 -0
  25. package/dist/handlers/index.d.ts +17 -0
  26. package/dist/index.cjs +1037 -315
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.ts +3 -0
  29. package/dist/index.mjs +1037 -315
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/initScope.d.ts +5 -0
  32. package/dist/instructions/AddressResolver.d.ts +12 -0
  33. package/dist/instructions/ControlInstructions.d.ts +10 -0
  34. package/dist/instructions/EndInstruction.d.ts +4 -0
  35. package/dist/instructions/InstructionBase.d.ts +14 -0
  36. package/dist/instructions/JumpInstruction.d.ts +16 -0
  37. package/dist/instructions/OperationInstruction.d.ts +5 -0
  38. package/dist/instructions/SetCounterInstruction.d.ts +5 -0
  39. package/dist/instructions/SetInstruction.d.ts +6 -0
  40. package/dist/instructions/ZeroSpaceInstruction.d.ts +4 -0
  41. package/dist/instructions/index.d.ts +9 -0
  42. package/dist/{types/macros/RawValue.d.ts → macros/Asm.d.ts} +1 -1
  43. package/dist/macros/Function.d.ts +13 -0
  44. package/dist/macros/GetGlobal.d.ts +5 -0
  45. package/dist/macros/Math.d.ts +5 -0
  46. package/dist/macros/Memory.d.ts +5 -0
  47. package/dist/macros/Namespace.d.ts +13 -0
  48. package/dist/macros/Other.d.ts +5 -0
  49. package/dist/macros/commands/ApplyStatus.d.ts +5 -0
  50. package/dist/macros/commands/Control.d.ts +5 -0
  51. package/dist/macros/commands/Cutscene.d.ts +5 -0
  52. package/dist/macros/commands/Draw.d.ts +5 -0
  53. package/dist/macros/commands/DrawFlush.d.ts +5 -0
  54. package/dist/macros/commands/End.d.ts +5 -0
  55. package/dist/macros/commands/Explosion.d.ts +5 -0
  56. package/dist/macros/commands/Fetch.d.ts +5 -0
  57. package/dist/macros/commands/FlushMessage.d.ts +5 -0
  58. package/dist/macros/commands/GetBlock.d.ts +5 -0
  59. package/dist/macros/commands/GetFlag.d.ts +5 -0
  60. package/dist/macros/commands/GetLink.d.ts +5 -0
  61. package/dist/macros/commands/Lookup.d.ts +5 -0
  62. package/dist/macros/commands/PackColor.d.ts +5 -0
  63. package/dist/macros/commands/Print.d.ts +5 -0
  64. package/dist/macros/commands/PrintFlush.d.ts +5 -0
  65. package/dist/macros/commands/Radar.d.ts +7 -0
  66. package/dist/macros/commands/Sensor.d.ts +5 -0
  67. package/dist/macros/commands/SetBlock.d.ts +5 -0
  68. package/dist/macros/commands/SetFlag.d.ts +5 -0
  69. package/dist/macros/commands/SetRate.d.ts +5 -0
  70. package/dist/macros/commands/SetRule.d.ts +5 -0
  71. package/dist/macros/commands/SpawnUnit.d.ts +5 -0
  72. package/dist/macros/commands/SpawnWave.d.ts +5 -0
  73. package/dist/macros/commands/Stop.d.ts +5 -0
  74. package/dist/macros/commands/UnitBind.d.ts +5 -0
  75. package/dist/macros/commands/UnitControl.d.ts +5 -0
  76. package/dist/macros/commands/UnitLocate.d.ts +5 -0
  77. package/dist/macros/commands/UnitRadar.d.ts +5 -0
  78. package/dist/macros/commands/Wait.d.ts +5 -0
  79. package/dist/macros/commands/index.d.ts +30 -0
  80. package/dist/macros/index.d.ts +6 -0
  81. package/dist/macros/util.d.ts +18 -0
  82. package/dist/operators.d.ts +25 -0
  83. package/dist/types/Compiler.d.ts +17 -4
  84. package/dist/types/CompilerError.d.ts +28 -4
  85. package/dist/types/assertions.d.ts +28 -0
  86. package/dist/types/handlers/CallExpression.d.ts +1 -0
  87. package/dist/types/handlers/SwitchStatement.d.ts +2 -0
  88. package/dist/types/handlers/index.d.ts +1 -0
  89. package/dist/types/index.d.ts +1 -0
  90. package/dist/types/instructions/ControlInstructions.d.ts +3 -1
  91. package/dist/types/instructions/InstructionBase.d.ts +5 -1
  92. package/dist/types/instructions/JumpInstruction.d.ts +1 -0
  93. package/dist/types/macros/Asm.d.ts +5 -0
  94. package/dist/types/macros/Namespace.d.ts +0 -3
  95. package/dist/types/macros/commands/ApplyStatus.d.ts +5 -0
  96. package/dist/types/macros/commands/Control.d.ts +2 -2
  97. package/dist/types/macros/commands/Cutscene.d.ts +5 -0
  98. package/dist/types/macros/commands/Draw.d.ts +2 -2
  99. package/dist/types/macros/commands/Explosion.d.ts +5 -0
  100. package/dist/types/macros/commands/Fetch.d.ts +5 -0
  101. package/dist/types/macros/commands/FlushMessage.d.ts +5 -0
  102. package/dist/types/macros/commands/GetBlock.d.ts +5 -0
  103. package/dist/types/macros/commands/GetFlag.d.ts +5 -0
  104. package/dist/types/macros/commands/Lookup.d.ts +2 -2
  105. package/dist/types/macros/commands/PackColor.d.ts +5 -0
  106. package/dist/types/macros/commands/Radar.d.ts +2 -2
  107. package/dist/types/macros/commands/SetBlock.d.ts +5 -0
  108. package/dist/types/macros/commands/SetFlag.d.ts +5 -0
  109. package/dist/types/macros/commands/SetRate.d.ts +5 -0
  110. package/dist/types/macros/commands/SetRule.d.ts +5 -0
  111. package/dist/types/macros/commands/SpawnUnit.d.ts +5 -0
  112. package/dist/types/macros/commands/SpawnWave.d.ts +5 -0
  113. package/dist/types/macros/commands/Stop.d.ts +5 -0
  114. package/dist/types/macros/commands/UnitControl.d.ts +3 -3
  115. package/dist/types/macros/commands/UnitLocate.d.ts +2 -2
  116. package/dist/types/macros/commands/index.d.ts +15 -0
  117. package/dist/types/macros/util.d.ts +18 -0
  118. package/dist/types/types.d.ts +14 -0
  119. package/dist/types/utils.d.ts +19 -2
  120. package/dist/types/values/BaseValue.d.ts +2 -0
  121. package/dist/types/values/FunctionValue.d.ts +1 -1
  122. package/dist/types/values/ObjectValue.d.ts +1 -1
  123. package/dist/types.d.ts +238 -0
  124. package/dist/utils.d.ts +47 -0
  125. package/dist/values/BaseValue.d.ts +9 -0
  126. package/dist/values/DestructuringValue.d.ts +17 -0
  127. package/dist/values/FunctionValue.d.ts +47 -0
  128. package/dist/values/LiteralValue.d.ts +13 -0
  129. package/dist/values/ObjectValue.d.ts +23 -0
  130. package/dist/values/SenseableValue.d.ts +23 -0
  131. package/dist/{types/values/StackValue.d.ts → values/StoreValue.d.ts} +5 -6
  132. package/dist/values/ValueOwner.d.ts +27 -0
  133. package/dist/values/VoidValue.d.ts +16 -0
  134. package/dist/values/index.d.ts +7 -0
  135. package/lib/commands.d.ts +849 -418
  136. package/lib/eslib/lib.es2015.core.d.ts +3 -0
  137. package/lib/globals.d.ts +331 -19
  138. package/lib/helpers.d.ts +14 -0
  139. package/lib/kinds.d.ts +3 -2
  140. package/lib/memory.d.ts +1 -1
  141. package/lib/traits.d.ts +6 -0
  142. package/lib/util.d.ts +16 -0
  143. package/package.json +15 -16
  144. package/build/Compiler.js +0 -105
  145. package/build/Compiler.js.map +0 -1
  146. package/build/CompilerError.js +0 -11
  147. package/build/CompilerError.js.map +0 -1
  148. package/build/Scope.js +0 -71
  149. package/build/Scope.js.map +0 -1
  150. package/build/bin.js +0 -75
  151. package/build/bin.js.map +0 -1
  152. package/build/handlers/BlockStatement.js +0 -14
  153. package/build/handlers/BlockStatement.js.map +0 -1
  154. package/build/handlers/CallExpression.js +0 -20
  155. package/build/handlers/CallExpression.js.map +0 -1
  156. package/build/handlers/File.js +0 -9
  157. package/build/handlers/File.js.map +0 -1
  158. package/build/handlers/ForStatement.js +0 -32
  159. package/build/handlers/ForStatement.js.map +0 -1
  160. package/build/handlers/Function.js +0 -47
  161. package/build/handlers/Function.js.map +0 -1
  162. package/build/handlers/Identifier.js +0 -8
  163. package/build/handlers/Identifier.js.map +0 -1
  164. package/build/handlers/IfStatement.js +0 -25
  165. package/build/handlers/IfStatement.js.map +0 -1
  166. package/build/handlers/Literal.js +0 -15
  167. package/build/handlers/Literal.js.map +0 -1
  168. package/build/handlers/Object.js +0 -55
  169. package/build/handlers/Object.js.map +0 -1
  170. package/build/handlers/OperationExpressions.js +0 -38
  171. package/build/handlers/OperationExpressions.js.map +0 -1
  172. package/build/handlers/Program.js +0 -9
  173. package/build/handlers/Program.js.map +0 -1
  174. package/build/handlers/Statements.js +0 -30
  175. package/build/handlers/Statements.js.map +0 -1
  176. package/build/handlers/TemplateExpression.js +0 -18
  177. package/build/handlers/TemplateExpression.js.map +0 -1
  178. package/build/handlers/VariableDeclaration.js +0 -72
  179. package/build/handlers/VariableDeclaration.js.map +0 -1
  180. package/build/handlers/WhileStatement.js +0 -23
  181. package/build/handlers/WhileStatement.js.map +0 -1
  182. package/build/handlers/index.js +0 -32
  183. package/build/handlers/index.js.map +0 -1
  184. package/build/index.js +0 -8
  185. package/build/index.js.map +0 -1
  186. package/build/initScope.js +0 -40
  187. package/build/initScope.js.map +0 -1
  188. package/build/instructions/AddressResolver.js +0 -31
  189. package/build/instructions/AddressResolver.js.map +0 -1
  190. package/build/instructions/ControlInstructions.js +0 -23
  191. package/build/instructions/ControlInstructions.js.map +0 -1
  192. package/build/instructions/EndInstruction.js +0 -11
  193. package/build/instructions/EndInstruction.js.map +0 -1
  194. package/build/instructions/InstructionBase.js +0 -21
  195. package/build/instructions/InstructionBase.js.map +0 -1
  196. package/build/instructions/JumpInstruction.js +0 -22
  197. package/build/instructions/JumpInstruction.js.map +0 -1
  198. package/build/instructions/OperationInstruction.js +0 -11
  199. package/build/instructions/OperationInstruction.js.map +0 -1
  200. package/build/instructions/SetCounterInstruction.js +0 -11
  201. package/build/instructions/SetCounterInstruction.js.map +0 -1
  202. package/build/instructions/SetInstruction.js +0 -11
  203. package/build/instructions/SetInstruction.js.map +0 -1
  204. package/build/instructions/ZeroSpaceInstruction.js +0 -11
  205. package/build/instructions/ZeroSpaceInstruction.js.map +0 -1
  206. package/build/instructions/index.js +0 -26
  207. package/build/instructions/index.js.map +0 -1
  208. package/build/macros/Building.js +0 -89
  209. package/build/macros/Building.js.map +0 -1
  210. package/build/macros/Function.js +0 -20
  211. package/build/macros/Function.js.map +0 -1
  212. package/build/macros/Math.js +0 -62
  213. package/build/macros/Math.js.map +0 -1
  214. package/build/macros/Memory.js +0 -63
  215. package/build/macros/Memory.js.map +0 -1
  216. package/build/macros/Namespace.js +0 -111
  217. package/build/macros/Namespace.js.map +0 -1
  218. package/build/macros/Other.js +0 -21
  219. package/build/macros/Other.js.map +0 -1
  220. package/build/macros/RawValue.js +0 -17
  221. package/build/macros/RawValue.js.map +0 -1
  222. package/build/macros/commands/Control.js +0 -26
  223. package/build/macros/commands/Control.js.map +0 -1
  224. package/build/macros/commands/Draw.js +0 -40
  225. package/build/macros/commands/Draw.js.map +0 -1
  226. package/build/macros/commands/DrawFlush.js +0 -18
  227. package/build/macros/commands/DrawFlush.js.map +0 -1
  228. package/build/macros/commands/GetLink.js +0 -25
  229. package/build/macros/commands/GetLink.js.map +0 -1
  230. package/build/macros/commands/Lookup.js +0 -25
  231. package/build/macros/commands/Lookup.js.map +0 -1
  232. package/build/macros/commands/Print.js +0 -18
  233. package/build/macros/commands/Print.js.map +0 -1
  234. package/build/macros/commands/PrintFlush.js +0 -18
  235. package/build/macros/commands/PrintFlush.js.map +0 -1
  236. package/build/macros/commands/Radar.js +0 -65
  237. package/build/macros/commands/Radar.js.map +0 -1
  238. package/build/macros/commands/Sensor.js +0 -21
  239. package/build/macros/commands/Sensor.js.map +0 -1
  240. package/build/macros/commands/UnitBind.js +0 -18
  241. package/build/macros/commands/UnitBind.js.map +0 -1
  242. package/build/macros/commands/UnitControl.js +0 -73
  243. package/build/macros/commands/UnitControl.js.map +0 -1
  244. package/build/macros/commands/UnitLocate.js +0 -76
  245. package/build/macros/commands/UnitLocate.js.map +0 -1
  246. package/build/macros/commands/UnitRadar.js +0 -48
  247. package/build/macros/commands/UnitRadar.js.map +0 -1
  248. package/build/macros/commands/Wait.js +0 -19
  249. package/build/macros/commands/Wait.js.map +0 -1
  250. package/build/macros/commands/index.js +0 -33
  251. package/build/macros/commands/index.js.map +0 -1
  252. package/build/macros/index.js +0 -40
  253. package/build/macros/index.js.map +0 -1
  254. package/build/operators.js +0 -102
  255. package/build/operators.js.map +0 -1
  256. package/build/types.js +0 -28
  257. package/build/types.js.map +0 -1
  258. package/build/utils.js +0 -18
  259. package/build/utils.js.map +0 -1
  260. package/build/values/BaseValue.js +0 -112
  261. package/build/values/BaseValue.js.map +0 -1
  262. package/build/values/FunctionValue.js +0 -116
  263. package/build/values/FunctionValue.js.map +0 -1
  264. package/build/values/LiteralValue.js +0 -89
  265. package/build/values/LiteralValue.js.map +0 -1
  266. package/build/values/ObjectValue.js +0 -55
  267. package/build/values/ObjectValue.js.map +0 -1
  268. package/build/values/StoreValue.js +0 -32
  269. package/build/values/StoreValue.js.map +0 -1
  270. package/build/values/TempValue.js +0 -78
  271. package/build/values/TempValue.js.map +0 -1
  272. package/build/values/VoidValue.js +0 -32
  273. package/build/values/VoidValue.js.map +0 -1
  274. package/build/values/index.js +0 -23
  275. package/build/values/index.js.map +0 -1
  276. package/dist/types/macros/Building.d.ts +0 -10
  277. package/dist/types/macros/Entities.d.ts +0 -11
  278. package/dist/types/values/TempValue.d.ts +0 -19
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnitBind.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitBind.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAA0C;AAC1C,uDAAoD;AAEpD,MAAa,QAAS,SAAQ,iBAAmB;IAC/C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YAClB,IAAI,CAAC,CAAC,IAAI,YAAY,mBAAU,CAAC;gBAC/B,MAAM,IAAI,6BAAa,CAAC,mCAAmC,CAAC,CAAC;YAE/D,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AATD,4BASC"}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnitControl = void 0;
4
- const instructions_1 = require("../../instructions");
5
- const __1 = require("..");
6
- const values_1 = require("../../values");
7
- const Building_1 = require("../Building");
8
- const CompilerError_1 = require("../../CompilerError");
9
- const validModes = [
10
- "idle",
11
- "stop",
12
- "move",
13
- "approach",
14
- "boost",
15
- "pathfind",
16
- "target",
17
- "targetp",
18
- "itemDrop",
19
- "itemTake",
20
- "payDrop",
21
- "payTake",
22
- "payEnter",
23
- "mine",
24
- "flag",
25
- "build",
26
- "getBlock",
27
- "within",
28
- ];
29
- class UnitControl extends __1.MacroFunction {
30
- constructor(scope) {
31
- super(scope, (mode, ...args) => {
32
- if (!(mode instanceof values_1.LiteralValue) || typeof mode.data !== "string")
33
- throw new CompilerError_1.CompilerError("The unitControl mode must be a string literal");
34
- if (!validModes.includes(mode.data))
35
- throw new CompilerError_1.CompilerError("Invalid unitControl mode");
36
- if (args.some(value => !(value instanceof values_1.StoreValue ||
37
- value instanceof values_1.LiteralValue ||
38
- value instanceof values_1.ObjectValue)))
39
- throw new CompilerError_1.CompilerError("The others arguments of unitControl must be literals or stores");
40
- let result = null;
41
- let extraArgs = [];
42
- switch (mode.data) {
43
- case "getBlock": {
44
- const outType = new values_1.TempValue({ scope });
45
- const outBuilding = new Building_1.Building({
46
- scope,
47
- name: scope.makeTempName(),
48
- renameable: true,
49
- });
50
- result = new values_1.ObjectValue(scope, {
51
- 0: outType,
52
- 1: outBuilding,
53
- length: new values_1.LiteralValue(scope, 2),
54
- });
55
- extraArgs = [outType, outBuilding, new values_1.LiteralValue(scope, 0)];
56
- break;
57
- }
58
- case "within": {
59
- const temp = new values_1.TempValue({ scope });
60
- result = temp;
61
- extraArgs = [temp, new values_1.LiteralValue(scope, 0)];
62
- break;
63
- }
64
- }
65
- return [
66
- result,
67
- [new instructions_1.InstructionBase("ucontrol", mode.data, ...args, ...extraArgs)],
68
- ];
69
- });
70
- }
71
- }
72
- exports.UnitControl = UnitControl;
73
- //# sourceMappingURL=UnitControl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnitControl.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitControl.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAgF;AAChF,0CAAuC;AACvC,uDAAoD;AAEpD,MAAM,UAAU,GAAG;IACjB,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;IACR,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;CACT,CAAC;AAEF,MAAa,WAAY,SAAQ,iBAA4B;IAC3D,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE;YAC7B,IAAI,CAAC,CAAC,IAAI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AM,GAAG,IAAI,CAAC;oBACd,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,qBAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;oBAC/C,MAAM;iBACP;aACF;YAED,OAAO;gBACL,MAAM;gBACN,CAAC,IAAI,8BAAe,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC;aACpE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1DD,kCA0DC"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnitLocate = void 0;
4
- const instructions_1 = require("../../instructions");
5
- const __1 = require("..");
6
- const values_1 = require("../../values");
7
- const Building_1 = require("../Building");
8
- const CompilerError_1 = require("../../CompilerError");
9
- const validFinds = ["ore", "building", "spawn", "damaged"];
10
- const validBuildingGroups = [
11
- "core",
12
- "storage",
13
- "generator",
14
- "turret",
15
- "factory",
16
- "repair",
17
- "rally",
18
- "battery",
19
- "reactor",
20
- ];
21
- class UnitLocate extends __1.MacroFunction {
22
- constructor(scope) {
23
- super(scope, (find, ...args) => {
24
- if (!(find instanceof values_1.LiteralValue && typeof find.data === "string"))
25
- throw new CompilerError_1.CompilerError("The unitLocate find must be a string literal");
26
- if (!validFinds.includes(find.data))
27
- throw new CompilerError_1.CompilerError("Invalid find value");
28
- if (args.some(value => !(value instanceof values_1.StoreValue || value instanceof values_1.LiteralValue)))
29
- throw new CompilerError_1.CompilerError("The others arguments of unitLocate must be literals or stores");
30
- const outFound = new values_1.TempValue({ scope });
31
- const outX = new values_1.TempValue({ scope });
32
- const outY = new values_1.TempValue({ scope });
33
- const outBuilding = new Building_1.Building({
34
- scope,
35
- name: scope.makeTempName(),
36
- renameable: true,
37
- });
38
- const outArgs = [outX, outY, outFound, outBuilding];
39
- let inputArgs = [];
40
- switch (find.data) {
41
- case "ore": {
42
- const [ore] = args;
43
- inputArgs = [find.data, "core", "true", ore];
44
- break;
45
- }
46
- case "building": {
47
- const [group, enemy] = args;
48
- if (!(group instanceof values_1.LiteralValue && typeof group.data === "string")) {
49
- throw new CompilerError_1.CompilerError("The building group must be a string literal");
50
- }
51
- if (!validBuildingGroups.includes(group.data))
52
- throw new CompilerError_1.CompilerError("Invalid building group");
53
- inputArgs = [find.data, group.data, enemy, "@copper"];
54
- break;
55
- }
56
- case "spawn":
57
- case "damaged": {
58
- inputArgs = [find.data, "core", "true", "@copper"];
59
- break;
60
- }
61
- }
62
- return [
63
- new values_1.ObjectValue(scope, {
64
- 0: outFound,
65
- 1: outX,
66
- 2: outY,
67
- 3: outBuilding,
68
- length: new values_1.LiteralValue(scope, find.data === "ore" ? 3 : 4),
69
- }),
70
- [new instructions_1.InstructionBase("ulocate", ...inputArgs, ...outArgs)],
71
- ];
72
- });
73
- }
74
- }
75
- exports.UnitLocate = UnitLocate;
76
- //# sourceMappingURL=UnitLocate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnitLocate.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitLocate.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAgF;AAChF,0CAAuC;AACvC,uDAAoD;AAEpD,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAE3D,MAAM,mBAAmB,GAAG;IAC1B,MAAM;IACN,SAAS;IACT,WAAW;IACX,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,SAAS;IACT,SAAS;CACV,CAAC;AAEF,MAAa,UAAW,SAAQ,iBAAa;IAC3C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE;YAC7B,IAAI,CAAC,CAAC,IAAI,YAAY,qBAAY,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAClE,M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K,QAAQ,CAAC,EAClE;wBACA,MAAM,IAAI,6BAAa,CACrB,6CAA6C,CAC9C,CAAC;qBACH;oBACD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;wBAC3C,MAAM,IAAI,6BAAa,CAAC,wBAAwB,CAAC,CAAC;oBAEpD,SAAS,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;oBACtD,MAAM;iBACP;gBACD,KAAK,OAAO,CAAC;gBACb,KAAK,SAAS,CAAC,CAAC;oBACd,SAAS,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;oBACnD,MAAM;iBACP;aACF;YACD,OAAO;gBACL,IAAI,oBAAW,CAAC,KAAK,EAAE;oBACrB,CAAC,EAAE,QAAQ;oBACX,CAAC,EAAE,IAAI;oBACP,CAAC,EAAE,IAAI;oBACP,CAAC,EAAE,WAAW;oBACd,MAAM,EAAE,IAAI,qBAAY,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC7D,CAAC;gBACF,CAAC,IAAI,8BAAe,CAAC,SAAS,EAAE,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,CAAC;aAC3D,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AArED,gCAqEC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnitRadar = void 0;
4
- const instructions_1 = require("../../instructions");
5
- const __1 = require("..");
6
- const values_1 = require("../../values");
7
- const Radar_1 = require("./Radar");
8
- const CompilerError_1 = require("../../CompilerError");
9
- const Namespace_1 = require("../Namespace");
10
- class UnitRadar extends __1.MacroFunction {
11
- constructor(scope) {
12
- super(scope, (filter1, filter2, filter3, order, sort) => {
13
- if (!(filter1 instanceof values_1.LiteralValue) ||
14
- typeof filter1.data !== "string" ||
15
- !(filter2 instanceof values_1.LiteralValue) ||
16
- typeof filter2.data !== "string" ||
17
- !(filter3 instanceof values_1.LiteralValue) ||
18
- typeof filter3.data !== "string")
19
- throw new CompilerError_1.CompilerError("The filters must be string literals");
20
- if (!Radar_1.validRadarFilters.includes(filter1.data))
21
- throw new CompilerError_1.CompilerError("Invalid value for filter1");
22
- if (!Radar_1.validRadarFilters.includes(filter2.data))
23
- throw new CompilerError_1.CompilerError("Invalid value for filter2");
24
- if (!Radar_1.validRadarFilters.includes(filter3.data))
25
- throw new CompilerError_1.CompilerError("Invalid value for filter3");
26
- if (!(order instanceof values_1.LiteralValue || order instanceof values_1.StoreValue))
27
- throw new CompilerError_1.CompilerError("The radar order must be a literal or a store");
28
- if (!(sort instanceof values_1.LiteralValue) || typeof sort.data !== "string")
29
- throw new CompilerError_1.CompilerError("The radar sort must be a string literal");
30
- if (!Radar_1.validRadarSorts.includes(sort.data))
31
- throw new CompilerError_1.CompilerError("Invalid sort value");
32
- const outUnit = new Namespace_1.Unit({
33
- scope,
34
- name: scope.makeTempName(),
35
- renameable: true,
36
- });
37
- return [
38
- outUnit,
39
- [
40
- new instructions_1.InstructionBase("uradar", filter1.data, filter2.data, filter3.data, sort.data, "0", // I don't know why, but mindustry requires this extra parameter
41
- order, outUnit),
42
- ],
43
- ];
44
- });
45
- }
46
- }
47
- exports.UnitRadar = UnitRadar;
48
- //# sourceMappingURL=UnitRadar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnitRadar.js","sourceRoot":"","sources":["../../../src/macros/commands/UnitRadar.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAwD;AACxD,mCAA6D;AAC7D,uDAAoD;AACpD,4CAAoC;AAEpC,MAAa,SAAU,SAAQ,iBAAa;IAC1C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,CAA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,EAAE,KAAK,CAAC,YAAY,EAAE;gBAC1B,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO;gBACP;oBACE,IAAI,8BAAe,CACjB,QAAQ,EACR,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,IAAI,EACZ,IAAI,CAAC,IAAI,EACT,GAAG,EAAE,gEAAgE;oBACrE,KAAK,EACL,OAAO,CACR;iBACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApDD,8BAoDC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Wait = void 0;
4
- const instructions_1 = require("../../instructions");
5
- const __1 = require("..");
6
- const values_1 = require("../../values");
7
- const CompilerError_1 = require("../../CompilerError");
8
- class Wait extends __1.MacroFunction {
9
- constructor(scope) {
10
- super(scope, seconds => {
11
- if (!(seconds instanceof values_1.StoreValue) &&
12
- !(seconds instanceof values_1.LiteralValue && typeof seconds.data === "number"))
13
- throw new CompilerError_1.CompilerError("The wait seconds must be either a number literal or a store");
14
- return [null, [new instructions_1.InstructionBase("wait", seconds)]];
15
- });
16
- }
17
- }
18
- exports.Wait = Wait;
19
- //# sourceMappingURL=Wait.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Wait.js","sourceRoot":"","sources":["../../../src/macros/commands/Wait.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,0BAAmC;AAEnC,yCAAwD;AACxD,uDAAoD;AAEpD,MAAa,IAAK,SAAQ,iBAAmB;IAC3C,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;YACrB,IACE,CAAC,CAAC,OAAO,YAAY,mBAAU,CAAC;gBAChC,CAAC,CAAC,OAAO,YAAY,qBAAY,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAEtE,MAAM,IAAI,6BAAa,CACrB,6DAA6D,CAC9D,CAAC;YAEJ,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,8BAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAdD,oBAcC"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Radar = void 0;
18
- __exportStar(require("./Draw"), exports);
19
- __exportStar(require("./Print"), exports);
20
- __exportStar(require("./PrintFlush"), exports);
21
- __exportStar(require("./DrawFlush"), exports);
22
- __exportStar(require("./GetLink"), exports);
23
- __exportStar(require("./Control"), exports);
24
- var Radar_1 = require("./Radar");
25
- Object.defineProperty(exports, "Radar", { enumerable: true, get: function () { return Radar_1.Radar; } });
26
- __exportStar(require("./Sensor"), exports);
27
- __exportStar(require("./Wait"), exports);
28
- __exportStar(require("./Lookup"), exports);
29
- __exportStar(require("./UnitBind"), exports);
30
- __exportStar(require("./UnitControl"), exports);
31
- __exportStar(require("./UnitRadar"), exports);
32
- __exportStar(require("./UnitLocate"), exports);
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,0CAAwB;AACxB,+CAA6B;AAC7B,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAC5B,+CAA6B"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.VarsNamespace = exports.NamespaceMacro = exports.BuildingBuilder = exports.commands = void 0;
30
- __exportStar(require("./Function"), exports);
31
- __exportStar(require("./Math"), exports);
32
- __exportStar(require("./Other"), exports);
33
- exports.commands = __importStar(require("./commands"));
34
- __exportStar(require("./Memory"), exports);
35
- var Building_1 = require("./Building");
36
- Object.defineProperty(exports, "BuildingBuilder", { enumerable: true, get: function () { return Building_1.BuildingBuilder; } });
37
- var Namespace_1 = require("./Namespace");
38
- Object.defineProperty(exports, "NamespaceMacro", { enumerable: true, get: function () { return Namespace_1.NamespaceMacro; } });
39
- Object.defineProperty(exports, "VarsNamespace", { enumerable: true, get: function () { return Namespace_1.VarsNamespace; } });
40
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/macros/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,yCAAuB;AACvB,0CAAwB;AACxB,uDAAuC;AACvC,2CAAyB;AACzB,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,yCAA4D;AAAnD,2GAAA,cAAc,OAAA;AAAE,0GAAA,aAAa,OAAA"}
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.operatorMap = exports.operators = exports.singleOperators = exports.updateOperators = exports.unaryOperators = exports.leftRightOperators = exports.assignmentOperators = exports.bitwiseAssignmentOperators = exports.logicalAssignmentOperators = exports.arithmeticAssignmentOperators = exports.logicalOperators = exports.binaryOperators = exports.bitwiseBinaryOperators = exports.comparisonBinaryOperators = exports.arithmeticBinaryOperators = void 0;
4
- exports.arithmeticBinaryOperators = [
5
- "*",
6
- "**",
7
- "+",
8
- "-",
9
- "/",
10
- "%",
11
- ];
12
- exports.comparisonBinaryOperators = [
13
- "!=",
14
- "!==",
15
- "<",
16
- "<=",
17
- "==",
18
- "===",
19
- ">",
20
- ">=",
21
- ];
22
- exports.bitwiseBinaryOperators = [
23
- "&",
24
- "<<",
25
- ">>",
26
- ">>>",
27
- "^",
28
- "|",
29
- ];
30
- exports.binaryOperators = [
31
- ...exports.arithmeticBinaryOperators,
32
- ...exports.comparisonBinaryOperators,
33
- ...exports.bitwiseBinaryOperators,
34
- "instanceof",
35
- "in",
36
- ];
37
- exports.logicalOperators = ["&&", "??", "||"];
38
- exports.arithmeticAssignmentOperators = [
39
- "%=",
40
- "&=",
41
- "*=",
42
- "**=",
43
- "+=",
44
- "-=",
45
- "/=",
46
- ];
47
- exports.logicalAssignmentOperators = ["&&=", "||="];
48
- exports.bitwiseAssignmentOperators = [
49
- "<<=",
50
- ">>=",
51
- ">>>=",
52
- "^=",
53
- "|=",
54
- ];
55
- exports.assignmentOperators = [
56
- ...exports.arithmeticAssignmentOperators,
57
- ...exports.logicalAssignmentOperators,
58
- ...exports.bitwiseAssignmentOperators,
59
- "=",
60
- ];
61
- exports.leftRightOperators = [
62
- ...exports.binaryOperators,
63
- ...exports.logicalOperators,
64
- ...exports.assignmentOperators,
65
- ];
66
- exports.unaryOperators = [
67
- "!",
68
- "u+",
69
- "u-",
70
- "delete",
71
- "typeof",
72
- "void",
73
- "~",
74
- ];
75
- exports.updateOperators = ["++", "--"];
76
- exports.singleOperators = [...exports.unaryOperators, ...exports.updateOperators];
77
- exports.operators = [...exports.leftRightOperators, ...exports.singleOperators];
78
- exports.operatorMap = {
79
- "==": "equal",
80
- "===": "strictEqual",
81
- "!=": "notEqual",
82
- "!==": "notEqual",
83
- "<": "lessThan",
84
- ">": "greaterThan",
85
- "<=": "lessThanEq",
86
- ">=": "greaterThanEq",
87
- "+": "add",
88
- "-": "sub",
89
- "*": "mul",
90
- "/": "div",
91
- "%": "mod",
92
- "**": "pow",
93
- "|": "or",
94
- "&": "and",
95
- "^": "xor",
96
- ">>": "shr",
97
- ">>>": "shr",
98
- "<<": "shl",
99
- "&&": "land",
100
- "||": "or",
101
- };
102
- //# sourceMappingURL=operators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operators.js","sourceRoot":"","sources":["../src/operators.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG;IACvC,GAAG;IACH,IAAI;IACJ,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACK,CAAC;AACE,QAAA,yBAAyB,GAAG;IAC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WAAW,GAIpB;IACF,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,aAAa;IAClB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,eAAe;IACrB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;CACF,CAAC"}
package/build/types.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.es = void 0;
27
- exports.es = __importStar(require("@babel/types"));
28
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAmC"}
package/build/utils.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.camelToDashCase = exports.nodeName = exports.internalPrefix = void 0;
4
- /**
5
- * The prefix for internal variables inside the compiler output
6
- */
7
- exports.internalPrefix = "&";
8
- function nodeName(node) {
9
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10
- const { line, column } = node.loc.start;
11
- return `${line}:${column}`;
12
- }
13
- exports.nodeName = nodeName;
14
- function camelToDashCase(name) {
15
- return name.replace(/[A-Z]/g, str => `-${str.toLowerCase()}`);
16
- }
17
- exports.camelToDashCase = camelToDashCase;
18
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,cAAc,GAAG,GAAG,CAAC;AAElC,SAAgB,QAAQ,CAAC,IAAa;IACpC,oEAAoE;IACpE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAI,CAAC,KAAK,CAAC;IACzC,OAAO,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;AAC7B,CAAC;AAJD,4BAIC;AAED,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC;AAFD,0CAEC"}
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseValue = void 0;
4
- const instructions_1 = require("../instructions");
5
- const operators_1 = require("../operators");
6
- const _1 = require(".");
7
- class BaseValue extends _1.VoidValue {
8
- "u-"(scope) {
9
- const [that, inst] = this.eval(scope);
10
- const temp = new _1.TempValue({ scope });
11
- return [
12
- temp,
13
- [
14
- ...inst,
15
- new instructions_1.OperationInstruction("sub", temp, new _1.LiteralValue(scope, 0), that),
16
- ],
17
- ];
18
- }
19
- }
20
- exports.BaseValue = BaseValue;
21
- const operatorMap = {
22
- "==": "equal",
23
- "===": "strictEqual",
24
- "!=": "notEqual",
25
- "!==": "notEqual",
26
- "<": "lessThan",
27
- ">": "greaterThan",
28
- "<=": "lessThanEq",
29
- ">=": "greaterThanEq",
30
- "+": "add",
31
- "-": "sub",
32
- "*": "mul",
33
- "/": "div",
34
- "%": "mod",
35
- "**": "pow",
36
- "|": "or",
37
- "&": "and",
38
- "^": "xor",
39
- ">>": "shr",
40
- ">>>": "shr",
41
- "<<": "shl",
42
- "&&": "land",
43
- "||": "or",
44
- };
45
- for (const key in operatorMap) {
46
- const kind = operatorMap[key];
47
- BaseValue.prototype[key] = function (scope, value) {
48
- const [left, leftInst] = this.eval(scope);
49
- const [right, rightInst] = value.eval(scope);
50
- const temp = new _1.TempValue({ scope });
51
- return [
52
- temp,
53
- [
54
- ...leftInst,
55
- ...rightInst,
56
- new instructions_1.OperationInstruction(kind, temp, left, right),
57
- ],
58
- ];
59
- };
60
- }
61
- const unaryOperatorMap = {
62
- "!": "not",
63
- "~": "flip",
64
- };
65
- for (const key in unaryOperatorMap) {
66
- const name = unaryOperatorMap[key];
67
- BaseValue.prototype[key] = function (scope) {
68
- const [that, inst] = this.eval(scope);
69
- const temp = new _1.TempValue({ scope });
70
- return [temp, [...inst, new instructions_1.OperationInstruction(name, temp, that, null)]];
71
- };
72
- }
73
- const assignmentToBinary = {
74
- "+=": "+",
75
- "-=": "-",
76
- "*=": "*",
77
- "/=": "/",
78
- "%=": "%",
79
- "**=": "**",
80
- "|=": "|",
81
- "&=": "&",
82
- "^=": "^",
83
- ">>=": ">>",
84
- ">>>=": ">>>",
85
- "<<=": "<<",
86
- "&&=": "&&",
87
- "||=": "||",
88
- };
89
- for (const op in assignmentToBinary) {
90
- BaseValue.prototype[op] = function (scope, value) {
91
- const [opValue, opInst] = this[assignmentToBinary[op]](scope, value);
92
- const [retValue, retInst] = this["="](scope, opValue);
93
- return [retValue, [...opInst, ...retInst]];
94
- };
95
- }
96
- for (const key of operators_1.updateOperators) {
97
- BaseValue.prototype[key] = function (scope, prefix) {
98
- let [ret, inst] = this.eval(scope);
99
- if (!prefix) {
100
- const temp = new _1.TempValue({ scope });
101
- const [tempValue, tempInst] = temp["="](scope, ret);
102
- ret = tempValue;
103
- inst.push(...tempInst);
104
- }
105
- const kind = key === "++" ? "+=" : "-=";
106
- return [
107
- ret,
108
- [...inst, ...this[kind](scope, new _1.LiteralValue(scope, 1))[1]],
109
- ];
110
- };
111
- }
112
- //# sourceMappingURL=BaseValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseValue.js","sourceRoot":"","sources":["../../src/values/BaseValue.ts"],"names":[],"mappings":";;;AAAA,kDAAuD;AACvD,4CAMsB;AAEtB,wBAAuD;AAEvD,MAAa,SAAU,SAAQ,YAAS;IACtC,IAAI,CAAC,KAAa;QAChB,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,IAAI,YAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACtC,OAAO;YACL,IAAI;YACJ;gBACE,GAAG,IAAI;gBACP,IAAI,mCAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,eAAY,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC;aACxE;SACF,CAAC;IACJ,CAAC;CACF;AAZD,8BAYC;AAED,MAAM,WAAW,GAGb;IACF,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,UAA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