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
@@ -0,0 +1,13 @@
1
+ import { IScope } from "../types";
2
+ import { ObjectValue } from "../values";
3
+ interface NamespaceMacroOptions {
4
+ changeCasing?: boolean;
5
+ }
6
+ export declare class NamespaceMacro extends ObjectValue {
7
+ changeCasing: boolean;
8
+ constructor(scope: IScope, { changeCasing }?: NamespaceMacroOptions);
9
+ }
10
+ export declare class VarsNamespace extends NamespaceMacro {
11
+ constructor(scope: IScope);
12
+ }
13
+ export {};
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../types";
2
+ import { MacroFunction } from "./Function";
3
+ export declare class Concat extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class ApplyStatus extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Control extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Cutscene extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Draw extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class DrawFlush extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class End extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class Explosion extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Fetch extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class FlushMessage extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class GetBlock extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class GetFlag extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class GetLink extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Lookup extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class PackColor extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class Print extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class PrintFlush extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,7 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare const validRadarFilters: readonly ["any", "enemy", "ally", "player", "attacker", "flying", "boss", "ground"];
4
+ export declare const validRadarSorts: readonly ["distance", "health", "shield", "armor", "maxHealth"];
5
+ export declare class Radar extends MacroFunction {
6
+ constructor(scope: IScope);
7
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class Sensor extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class SetBlock extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class SetFlag extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class SetRate extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class SetRule extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class SpawnUnit extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class SpawnWave extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class Stop extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class UnitBind extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class UnitControl extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class UnitLocate extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class UnitRadar extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { MacroFunction } from "..";
2
+ import { IScope } from "../../types";
3
+ export declare class Wait extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,30 @@
1
+ export * from "./Draw";
2
+ export * from "./Print";
3
+ export * from "./PrintFlush";
4
+ export * from "./DrawFlush";
5
+ export * from "./GetBlock";
6
+ export * from "./GetLink";
7
+ export * from "./Control";
8
+ export { Radar } from "./Radar";
9
+ export * from "./Sensor";
10
+ export * from "./Wait";
11
+ export * from "./Lookup";
12
+ export * from "./PackColor";
13
+ export * from "./End";
14
+ export * from "./SetBlock";
15
+ export * from "./SpawnUnit";
16
+ export * from "./Stop";
17
+ export * from "./UnitBind";
18
+ export * from "./UnitControl";
19
+ export * from "./UnitRadar";
20
+ export * from "./UnitLocate";
21
+ export * from "./ApplyStatus";
22
+ export * from "./SpawnWave";
23
+ export * from "./SetRule";
24
+ export * from "./FlushMessage";
25
+ export * from "./Cutscene";
26
+ export * from "./Explosion";
27
+ export * from "./SetRate";
28
+ export * from "./Fetch";
29
+ export * from "./GetFlag";
30
+ export * from "./SetFlag";
@@ -0,0 +1,6 @@
1
+ export * from "./Function";
2
+ export * from "./Math";
3
+ export * from "./Other";
4
+ export * as commands from "./commands";
5
+ export * from "./Memory";
6
+ export { NamespaceMacro, VarsNamespace } from "./Namespace";
@@ -0,0 +1,18 @@
1
+ import { IParameterDescriptor } from "../assertions";
2
+ import { IScope, IValue, TValueInstructions } from "../types";
3
+ import { MacroFunction } from "./Function";
4
+ interface IOverloadNamespaceOptions<K extends string> {
5
+ scope: IScope;
6
+ overloads: Record<K, {
7
+ /**
8
+ * Pass the name of the options argument to tell if this overload uses
9
+ * named parameters.
10
+ */
11
+ named?: string;
12
+ args: (IParameterDescriptor | string)[];
13
+ }>;
14
+ handler(overload: K, ...args: (IValue | string)[]): TValueInstructions<IValue | null>;
15
+ }
16
+ /** Used to create namespaces that contain multiple methods that map into instructions */
17
+ export declare function createOverloadNamespace<K extends string>({ scope, overloads, handler, }: IOverloadNamespaceOptions<K>): Record<string, MacroFunction<IValue | null>>;
18
+ export {};
@@ -0,0 +1,25 @@
1
+ export declare const arithmeticBinaryOperators: readonly ["*", "**", "+", "-", "/", "%"];
2
+ export declare const comparisonBinaryOperators: readonly ["!=", "!==", "<", "<=", "==", "===", ">", ">="];
3
+ export declare const bitwiseBinaryOperators: readonly ["&", "<<", ">>", ">>>", "^", "|"];
4
+ export declare const binaryOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in"];
5
+ export declare type BinaryOperator = typeof binaryOperators[number];
6
+ export declare const logicalOperators: readonly ["&&", "??", "||"];
7
+ export declare type LogicalOperator = typeof logicalOperators[number];
8
+ export declare const arithmeticAssignmentOperators: readonly ["%=", "&=", "*=", "**=", "+=", "-=", "/="];
9
+ export declare const logicalAssignmentOperators: readonly ["&&=", "||="];
10
+ export declare const bitwiseAssignmentOperators: readonly ["<<=", ">>=", ">>>=", "^=", "|="];
11
+ export declare const assignmentOperators: readonly ["%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
12
+ export declare type AssignementOperator = typeof assignmentOperators[number];
13
+ export declare const leftRightOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
14
+ export declare type LeftRightOperator = typeof leftRightOperators[number];
15
+ export declare const unaryOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~"];
16
+ export declare type UnaryOperator = typeof unaryOperators[number];
17
+ export declare const updateOperators: readonly ["++", "--"];
18
+ export declare type UpdateOperator = typeof updateOperators[number];
19
+ export declare const singleOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
20
+ export declare type SingleOperator = typeof singleOperators[number];
21
+ export declare const operators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "=", "!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
22
+ export declare type Operator = typeof operators[number];
23
+ export declare const operatorMap: {
24
+ [k in Exclude<BinaryOperator, "instanceof" | "in"> | Exclude<LogicalOperator, "??">]: string;
25
+ };
@@ -7,20 +7,33 @@ export interface CompilerOptions {
7
7
  stackName?: string;
8
8
  /** Wether the compiler should preserve or compact variable and function names*/
9
9
  compactNames?: boolean;
10
+ sourcemap?: boolean;
10
11
  }
11
12
  export declare class Compiler {
12
13
  protected stackName?: string;
13
14
  protected usingStack: boolean;
14
15
  protected handlers: THandlerMap;
15
16
  readonly compactNames: boolean;
16
- constructor({ stackName, compactNames }?: CompilerOptions);
17
- compile(script: string): [string, null, es.Node[]] | [null, Error | CompilerError, es.Node[]];
17
+ readonly sourcemap: boolean;
18
+ constructor({ stackName, compactNames, sourcemap, }?: CompilerOptions);
19
+ compile(script: string): [string, null, es.SourceLocation[] | undefined] | [null, CompilerError];
18
20
  protected resolve(valueInst: TValueInstructions<IValue | null>): void;
19
21
  protected serialize(resLines: TValueInstructions<IValue | null>): string;
20
22
  protected parse(script: string): import("@babel/parser").ParseResult<es.File>;
21
- handle(scope: IScope, node: es.Node): TValueInstructions<IValue | null>;
23
+ protected mapSources(valueInst: TValueInstructions<IValue | null>): es.SourceLocation[];
24
+ handle(scope: IScope, node: es.Node, handler?: THandler<IValue | null> | undefined): TValueInstructions<IValue | null>;
22
25
  handleEval(scope: IScope, node: es.Node): TValueInstructions;
23
26
  handleConsume(scope: IScope, node: es.Node): TValueInstructions;
24
- handleMany<T extends es.Node>(scope: IScope, nodes: T[], handler?: (scope: IScope, node: T) => TValueInstructions<IValue | null>): TValueInstructions<null>;
27
+ /**
28
+ * Handles many nodes in order.
29
+ *
30
+ * The usage of this method over a regular loop over an array of nodes
31
+ * is only required if the code inside the loop generates
32
+ * instructions that are not tracked by the compiler
33
+ * handler methods ({@link handle}, {@link handleEval}, {@link handleConsume}
34
+ * and {@link handleMany})
35
+ *
36
+ */
37
+ handleMany<T extends es.Node>(scope: IScope, nodes: T[], handler?: (node: T) => TValueInstructions<IValue | null>): TValueInstructions<null>;
25
38
  }
26
39
  export {};
@@ -1,9 +1,33 @@
1
1
  import { es } from "./types";
2
- export declare class CompilerError extends Error {
3
- nodeStack: es.Node[];
4
- loc?: {
2
+ /**
3
+ * Error thrown by the babel parser.
4
+ *
5
+ * It doesn't export the type so we are writing it ourselves
6
+ */
7
+ export interface ParsingError extends Error {
8
+ code: string;
9
+ reasonCode: string;
10
+ loc: {
5
11
  line: number;
6
12
  column: number;
7
13
  };
8
- constructor(message: string, nodeStack?: es.Node[]);
9
14
  }
15
+ declare type CompilerErrorSource = es.Node | es.SourceLocation | {
16
+ line: number;
17
+ column: number;
18
+ };
19
+ export declare class CompilerError extends Error {
20
+ protected _loc?: es.SourceLocation;
21
+ /**
22
+ * The error that preceded this `CompilerError`.
23
+ *
24
+ * If it's not `undefined` it means that `this` is just wrapping the error to
25
+ * append extra data like the node stack
26
+ * */
27
+ inner?: unknown;
28
+ constructor(message: string, source?: CompilerErrorSource);
29
+ get loc(): es.SourceLocation | undefined;
30
+ set loc(value: CompilerErrorSource | undefined);
31
+ static from(error: unknown, source?: CompilerErrorSource): CompilerError;
32
+ }
33
+ export {};
@@ -0,0 +1,28 @@
1
+ import { IValue } from "./types";
2
+ import { LiteralValue, ObjectValue, StoreValue } from "./values";
3
+ /** Asserts that `value` is a `LiteralValue` that contains a string */
4
+ export declare function assertStringLiteral(value: IValue | undefined, name: string): asserts value is LiteralValue & {
5
+ data: string;
6
+ };
7
+ /** Asserts that `value` is a string literal that is part of a given set of `members`*/
8
+ export declare function assertLiteralOneOf<T extends readonly string[]>(value: IValue | undefined, members: T, name: string): asserts value is LiteralValue & {
9
+ data: T[number];
10
+ };
11
+ /** Asserts that `value` is either a store or a literal */
12
+ export declare function assertIsRuntimeValue(value: IValue | undefined, name: string): asserts value is LiteralValue | StoreValue;
13
+ /** Asserts that `value` is an `ObjectValue` */
14
+ export declare function assertIsObjectMacro(value: IValue | undefined, name: string): asserts value is ObjectValue;
15
+ /** Asserts that `value` is an `ObjectValue` that has a length property */
16
+ export declare function assertIsArrayMacro(value: IValue | undefined, name: string): asserts value is ObjectValue;
17
+ /** Helper type used to describe the overloads of a macro function. See {@link assertObjectFields} */
18
+ export declare type TOverloadDescriptor<K extends string> = Record<K, (string | IParameterDescriptor)[]>;
19
+ /** Describes an object destructuring paremeter. Generally used with `assertObjectFields` */
20
+ export interface IParameterDescriptor {
21
+ key: string;
22
+ name?: string;
23
+ default?: string;
24
+ /** Throw an error on invalid values */
25
+ validate?(value: IValue): void;
26
+ }
27
+ /** Asserts that all of the fields described are present on `value`*/
28
+ export declare function assertObjectFields(value: ObjectValue, fields: (string | IParameterDescriptor)[]): (IValue | string)[];
@@ -1,3 +1,4 @@
1
1
  import { IValue, THandler } from "../types";
2
2
  export declare const CallExpression: THandler<IValue | null>;
3
3
  export declare const NewExpression: THandler<IValue | null>;
4
+ export declare const TaggedTemplateExpression: THandler<IValue | null>;
@@ -0,0 +1,2 @@
1
+ import { THandler } from "../types";
2
+ export declare const SwitchStatement: THandler<null>;
@@ -5,6 +5,7 @@ export * from "./OperationExpressions";
5
5
  export * from "./Identifier";
6
6
  export * from "./Statements";
7
7
  export * from "./IfStatement";
8
+ export * from "./SwitchStatement";
8
9
  export * from "./WhileStatement";
9
10
  export * from "./ForStatement";
10
11
  export * from "./Function";
@@ -1,2 +1,3 @@
1
1
  export { Compiler, CompilerOptions } from "./Compiler";
2
2
  export { CompilerError } from "./CompilerError";
3
+ export { SourceLocation } from "@babel/types";
@@ -1,8 +1,10 @@
1
- import { IBindableValue } from "../types";
1
+ import { EInstIntent, IBindableValue } from "../types";
2
2
  import { JumpInstruction } from "./JumpInstruction";
3
3
  export declare class BreakInstruction extends JumpInstruction {
4
+ intent: EInstIntent;
4
5
  constructor(address: IBindableValue);
5
6
  }
6
7
  export declare class ContinueInstruction extends JumpInstruction {
8
+ intent: EInstIntent;
7
9
  constructor(address: IBindableValue);
8
10
  }
@@ -1,9 +1,13 @@
1
- import { IInstruction, IValue } from "../types";
1
+ import { SourceLocation } from "@babel/types";
2
+ import { EInstIntent, IInstruction, IValue } from "../types";
2
3
  export declare class InstructionBase implements IInstruction {
4
+ intent: EInstIntent;
5
+ alwaysRuns: boolean;
3
6
  protected _hidden: boolean;
4
7
  get hidden(): boolean;
5
8
  set hidden(value: boolean);
6
9
  args: (string | IValue | null)[];
10
+ source?: SourceLocation;
7
11
  constructor(...args: (string | IValue | null)[]);
8
12
  resolve(_i: number): void;
9
13
  toString(): string;
@@ -11,5 +11,6 @@ export declare enum EJumpKind {
11
11
  Always = "always"
12
12
  }
13
13
  export declare class JumpInstruction extends InstructionBase {
14
+ address: IBindableValue;
14
15
  constructor(address: IBindableValue, kind: EJumpKind, left?: IValue | null, right?: IValue | null);
15
16
  }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../types";
2
+ import { MacroFunction } from "./Function";
3
+ export declare class Asm extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -10,7 +10,4 @@ export declare class NamespaceMacro extends ObjectValue {
10
10
  export declare class VarsNamespace extends NamespaceMacro {
11
11
  constructor(scope: IScope);
12
12
  }
13
- export declare class UCommandsNamespace extends NamespaceMacro {
14
- constructor(scope: IScope);
15
- }
16
13
  export {};
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class ApplyStatus extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -1,5 +1,5 @@
1
- import { MacroFunction } from "..";
2
1
  import { IScope } from "../../types";
3
- export declare class Control extends MacroFunction<null> {
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Control extends ObjectValue {
4
4
  constructor(scope: IScope);
5
5
  }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Cutscene extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -1,5 +1,5 @@
1
1
  import { IScope } from "../../types";
2
- import { MacroFunction } from "../Function";
3
- export declare class Draw extends MacroFunction<null> {
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Draw extends ObjectValue {
4
4
  constructor(scope: IScope);
5
5
  }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class Explosion extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Fetch extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class FlushMessage extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class GetBlock extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class GetFlag extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -1,5 +1,5 @@
1
- import { MacroFunction } from "..";
2
1
  import { IScope } from "../../types";
3
- export declare class Lookup extends MacroFunction {
2
+ import { ObjectValue } from "../../values";
3
+ export declare class Lookup extends ObjectValue {
4
4
  constructor(scope: IScope);
5
5
  }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class PackColor extends MacroFunction {
4
+ constructor(scope: IScope);
5
+ }
@@ -1,7 +1,7 @@
1
1
  import { MacroFunction } from "..";
2
2
  import { IScope } from "../../types";
3
- export declare const validRadarFilters: string[];
4
- export declare const validRadarSorts: string[];
3
+ export declare const validRadarFilters: readonly ["any", "enemy", "ally", "player", "attacker", "flying", "boss", "ground"];
4
+ export declare const validRadarSorts: readonly ["distance", "health", "shield", "armor", "maxHealth"];
5
5
  export declare class Radar extends MacroFunction {
6
6
  constructor(scope: IScope);
7
7
  }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { ObjectValue } from "../../values";
3
+ export declare class SetBlock extends ObjectValue {
4
+ constructor(scope: IScope);
5
+ }
@@ -0,0 +1,5 @@
1
+ import { IScope } from "../../types";
2
+ import { MacroFunction } from "../Function";
3
+ export declare class SetFlag extends MacroFunction<null> {
4
+ constructor(scope: IScope);
5
+ }