mlogjs 0.4.10 → 0.5.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 (114) hide show
  1. package/README.md +15 -11
  2. package/dist/Compiler.d.ts +38 -38
  3. package/dist/CompilerError.d.ts +33 -33
  4. package/dist/Scope.d.ts +31 -30
  5. package/dist/bin.cjs +99 -58
  6. package/dist/bin.d.ts +1 -1
  7. package/dist/handlers/BlockStatement.d.ts +2 -2
  8. package/dist/handlers/CallExpression.d.ts +4 -4
  9. package/dist/handlers/File.d.ts +2 -2
  10. package/dist/handlers/ForStatement.d.ts +2 -2
  11. package/dist/handlers/Function.d.ts +5 -5
  12. package/dist/handlers/Identifier.d.ts +2 -2
  13. package/dist/handlers/IfStatement.d.ts +2 -2
  14. package/dist/handlers/Literal.d.ts +5 -5
  15. package/dist/handlers/Object.d.ts +8 -7
  16. package/dist/handlers/OperationExpressions.d.ts +9 -9
  17. package/dist/handlers/Program.d.ts +2 -2
  18. package/dist/handlers/Statements.d.ts +7 -7
  19. package/dist/handlers/SwitchStatement.d.ts +2 -2
  20. package/dist/handlers/TemplateExpression.d.ts +2 -2
  21. package/dist/handlers/Typescript.d.ts +8 -7
  22. package/dist/handlers/VariableDeclaration.d.ts +3 -3
  23. package/dist/handlers/WhileStatement.d.ts +3 -3
  24. package/dist/handlers/index.d.ts +17 -17
  25. package/dist/index.cjs +4170 -3263
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.mjs +4164 -3257
  28. package/dist/initScope.d.ts +5 -5
  29. package/dist/instructions/AddressResolver.d.ts +12 -12
  30. package/dist/instructions/ControlInstructions.d.ts +10 -10
  31. package/dist/instructions/EndInstruction.d.ts +6 -4
  32. package/dist/instructions/InstructionBase.d.ts +15 -15
  33. package/dist/instructions/JumpInstruction.d.ts +22 -16
  34. package/dist/instructions/OperationInstruction.d.ts +5 -5
  35. package/dist/instructions/SetCounterInstruction.d.ts +5 -5
  36. package/dist/instructions/SetInstruction.d.ts +8 -8
  37. package/dist/instructions/ZeroSpaceInstruction.d.ts +4 -4
  38. package/dist/instructions/index.d.ts +9 -9
  39. package/dist/macros/Asm.d.ts +4 -4
  40. package/dist/macros/DynamicArray.d.ts +30 -23
  41. package/dist/macros/Function.d.ts +14 -12
  42. package/dist/macros/GetGlobal.d.ts +5 -5
  43. package/dist/macros/Math.d.ts +4 -4
  44. package/dist/macros/Memory.d.ts +4 -4
  45. package/dist/macros/Namespace.d.ts +15 -12
  46. package/dist/macros/Other.d.ts +4 -4
  47. package/dist/macros/Unchecked.d.ts +7 -7
  48. package/dist/macros/commands/ApplyStatus.d.ts +4 -4
  49. package/dist/macros/commands/Control.d.ts +4 -4
  50. package/dist/macros/commands/Cutscene.d.ts +4 -4
  51. package/dist/macros/commands/Draw.d.ts +4 -4
  52. package/dist/macros/commands/DrawFlush.d.ts +4 -4
  53. package/dist/macros/commands/End.d.ts +4 -4
  54. package/dist/macros/commands/Explosion.d.ts +4 -4
  55. package/dist/macros/commands/Fetch.d.ts +4 -4
  56. package/dist/macros/commands/FlushMessage.d.ts +4 -4
  57. package/dist/macros/commands/GetBlock.d.ts +4 -4
  58. package/dist/macros/commands/GetFlag.d.ts +4 -4
  59. package/dist/macros/commands/GetLink.d.ts +4 -4
  60. package/dist/macros/commands/Lookup.d.ts +4 -4
  61. package/dist/macros/commands/PackColor.d.ts +4 -4
  62. package/dist/macros/commands/Print.d.ts +4 -4
  63. package/dist/macros/commands/PrintFlush.d.ts +4 -4
  64. package/dist/macros/commands/Radar.d.ts +6 -6
  65. package/dist/macros/commands/Sensor.d.ts +4 -4
  66. package/dist/macros/commands/SetBlock.d.ts +4 -4
  67. package/dist/macros/commands/SetFlag.d.ts +4 -4
  68. package/dist/macros/commands/SetRate.d.ts +4 -4
  69. package/dist/macros/commands/SetRule.d.ts +4 -4
  70. package/dist/macros/commands/SpawnUnit.d.ts +4 -4
  71. package/dist/macros/commands/SpawnWave.d.ts +4 -4
  72. package/dist/macros/commands/Stop.d.ts +4 -4
  73. package/dist/macros/commands/UnitBind.d.ts +4 -4
  74. package/dist/macros/commands/UnitControl.d.ts +4 -4
  75. package/dist/macros/commands/UnitLocate.d.ts +4 -4
  76. package/dist/macros/commands/UnitRadar.d.ts +4 -4
  77. package/dist/macros/commands/Wait.d.ts +4 -4
  78. package/dist/macros/commands/index.d.ts +30 -30
  79. package/dist/macros/index.d.ts +8 -6
  80. package/dist/macros/util.d.ts +17 -17
  81. package/dist/operators.d.ts +46 -26
  82. package/dist/types.d.ts +259 -237
  83. package/dist/utils/constants.d.ts +8 -6
  84. package/dist/utils/general.d.ts +26 -26
  85. package/dist/utils/index.d.ts +4 -4
  86. package/dist/utils/instruction.d.ts +9 -5
  87. package/dist/utils/value.d.ts +40 -36
  88. package/dist/values/AssignmentValue.d.ts +10 -0
  89. package/dist/values/BaseValue.d.ts +10 -10
  90. package/dist/values/DestructuringValue.d.ts +32 -30
  91. package/dist/values/FunctionValue.d.ts +57 -50
  92. package/dist/values/JumpOutValue.d.ts +36 -0
  93. package/dist/values/LazyValue.d.ts +11 -9
  94. package/dist/values/LiteralValue.d.ts +18 -14
  95. package/dist/values/ObjectValue.d.ts +23 -20
  96. package/dist/values/SenseableValue.d.ts +24 -24
  97. package/dist/values/StoreValue.d.ts +22 -21
  98. package/dist/values/VoidValue.d.ts +16 -13
  99. package/dist/values/index.d.ts +9 -8
  100. package/lib/commands.d.ts +59 -32
  101. package/lib/eslib/lib.es5.d.ts +36 -0
  102. package/lib/globals.d.ts +5 -5
  103. package/lib/helpers.d.ts +18 -2
  104. package/lib/index.d.ts +1 -1
  105. package/lib/macros.d.ts +150 -0
  106. package/lib/traits.d.ts +5 -5
  107. package/package.json +31 -27
  108. package/dist/assertions.d.ts +0 -28
  109. package/dist/bin.cjs.map +0 -1
  110. package/dist/discardedName.d.ts +0 -5
  111. package/dist/index.cjs.map +0 -1
  112. package/dist/index.mjs.map +0 -1
  113. package/dist/utils.d.ts +0 -45
  114. package/lib/memory.d.ts +0 -17
@@ -1,4 +1,4 @@
1
- import { MacroFunction } from "../Function";
2
- export declare class SpawnUnit extends MacroFunction {
3
- constructor();
4
- }
1
+ import { MacroFunction } from "../Function";
2
+ export declare class SpawnUnit extends MacroFunction {
3
+ constructor();
4
+ }
@@ -1,4 +1,4 @@
1
- import { MacroFunction } from "../Function";
2
- export declare class SpawnWave extends MacroFunction<null> {
3
- constructor();
4
- }
1
+ import { MacroFunction } from "../Function";
2
+ export declare class SpawnWave extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -1,4 +1,4 @@
1
- import { MacroFunction } from "../Function";
2
- export declare class Stop extends MacroFunction<null> {
3
- constructor();
4
- }
1
+ import { MacroFunction } from "../Function";
2
+ export declare class Stop extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -1,4 +1,4 @@
1
- import { MacroFunction } from "..";
2
- export declare class UnitBind extends MacroFunction<null> {
3
- constructor();
4
- }
1
+ import { MacroFunction } from "..";
2
+ export declare class UnitBind extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -1,4 +1,4 @@
1
- import { ObjectValue } from "../../values";
2
- export declare class UnitControl extends ObjectValue {
3
- constructor();
4
- }
1
+ import { ObjectValue } from "../../values";
2
+ export declare class UnitControl extends ObjectValue {
3
+ constructor();
4
+ }
@@ -1,4 +1,4 @@
1
- import { ObjectValue } from "../../values";
2
- export declare class UnitLocate extends ObjectValue {
3
- constructor();
4
- }
1
+ import { ObjectValue } from "../../values";
2
+ export declare class UnitLocate extends ObjectValue {
3
+ constructor();
4
+ }
@@ -1,4 +1,4 @@
1
- import { MacroFunction } from "..";
2
- export declare class UnitRadar extends MacroFunction {
3
- constructor();
4
- }
1
+ import { MacroFunction } from "..";
2
+ export declare class UnitRadar extends MacroFunction {
3
+ constructor();
4
+ }
@@ -1,4 +1,4 @@
1
- import { MacroFunction } from "..";
2
- export declare class Wait extends MacroFunction<null> {
3
- constructor();
4
- }
1
+ import { MacroFunction } from "..";
2
+ export declare class Wait extends MacroFunction<null> {
3
+ constructor();
4
+ }
@@ -1,30 +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";
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";
@@ -1,6 +1,8 @@
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";
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";
7
+ export * from "./DynamicArray";
8
+ export * from "./Unchecked";
@@ -1,17 +1,17 @@
1
- import { IScope, IValue, TEOutput, TValueInstructions } from "../types";
2
- import { IParameterDescriptor } from "../utils";
3
- import { MacroFunction } from "./Function";
4
- interface IOverloadNamespaceOptions<K extends string> {
5
- overloads: Record<K, {
6
- /**
7
- * Pass the name of the options argument to tell if this overload uses
8
- * named parameters.
9
- */
10
- named?: string;
11
- args: (IParameterDescriptor | string)[];
12
- }>;
13
- handler(scope: IScope, overload: K, out: TEOutput | undefined, ...args: (IValue | string)[]): TValueInstructions<IValue | null>;
14
- }
15
- /** Used to create namespaces that contain multiple methods that map into instructions */
16
- export declare function createOverloadNamespace<K extends string>({ overloads, handler, }: IOverloadNamespaceOptions<K>): Record<string, MacroFunction<IValue | null>>;
17
- export {};
1
+ import { IScope, IValue, TEOutput, TValueInstructions } from "../types";
2
+ import { IParameterDescriptor } from "../utils";
3
+ import { MacroFunction } from "./Function";
4
+ interface IOverloadNamespaceOptions<K extends string> {
5
+ overloads: Record<K, {
6
+ /**
7
+ * Pass the name of the options argument to tell if this overload uses
8
+ * named parameters.
9
+ */
10
+ named?: string;
11
+ args: (IParameterDescriptor | string)[];
12
+ }>;
13
+ handler(scope: IScope, overload: K, out: TEOutput | undefined, ...args: (IValue | string)[]): TValueInstructions<IValue | null>;
14
+ }
15
+ /** Used to create namespaces that contain multiple methods that map into instructions */
16
+ export declare function createOverloadNamespace<K extends string>({ overloads, handler, }: IOverloadNamespaceOptions<K>): Record<string, MacroFunction<IValue | null>>;
17
+ export {};
@@ -1,26 +1,46 @@
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 type BinaryOperator = typeof binaryOperators[number];
6
- export declare const logicalOperators: readonly ["&&", "??", "||"];
7
- export 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 type AssignementOperator = typeof assignmentOperators[number];
13
- export declare const leftRightOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "??=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
14
- export type LeftRightOperator = typeof leftRightOperators[number];
15
- export declare const unaryOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~"];
16
- export type UnaryOperator = typeof unaryOperators[number];
17
- export declare const updateOperators: readonly ["++", "--"];
18
- export type UpdateOperator = typeof updateOperators[number];
19
- export declare const singleOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
20
- export type SingleOperator = typeof singleOperators[number];
21
- export declare const operators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "??=", "<<=", ">>=", ">>>=", "^=", "|=", "=", "!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
22
- export type Operator = typeof operators[number];
23
- export declare const operatorMap: {
24
- [k in Exclude<BinaryOperator, "instanceof" | "in"> | Exclude<LogicalOperator, "??">]: string;
25
- };
26
- export declare const orderIndependentOperators: readonly Operator[];
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 type BinaryOperator = (typeof binaryOperators)[number];
6
+ export declare const logicalOperators: readonly ["&&", "??", "||"];
7
+ export 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 type AssignementOperator = (typeof assignmentOperators)[number];
13
+ export declare const leftRightOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "??=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
14
+ export type LeftRightOperator = (typeof leftRightOperators)[number];
15
+ export declare const unaryOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~"];
16
+ export type UnaryOperator = (typeof unaryOperators)[number];
17
+ export declare const updateOperators: readonly ["++", "--"];
18
+ export type UpdateOperator = (typeof updateOperators)[number];
19
+ export declare const singleOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
20
+ export type SingleOperator = (typeof singleOperators)[number];
21
+ export declare const operators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "??=", "<<=", ">>=", ">>>=", "^=", "|=", "=", "!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
22
+ export type Operator = (typeof operators)[number];
23
+ export declare const operatorMap: {
24
+ readonly "==": "equal";
25
+ readonly "===": "strictEqual";
26
+ readonly "!=": "notEqual";
27
+ readonly "<": "lessThan";
28
+ readonly ">": "greaterThan";
29
+ readonly "<=": "lessThanEq";
30
+ readonly ">=": "greaterThanEq";
31
+ readonly "+": "add";
32
+ readonly "-": "sub";
33
+ readonly "*": "mul";
34
+ readonly "/": "div";
35
+ readonly "%": "mod";
36
+ readonly "**": "pow";
37
+ readonly "|": "or";
38
+ readonly "&": "and";
39
+ readonly "^": "xor";
40
+ readonly ">>": "shr";
41
+ readonly ">>>": "shr";
42
+ readonly "<<": "shl";
43
+ readonly "&&": "land";
44
+ readonly "||": "or";
45
+ };
46
+ export declare const orderIndependentOperators: readonly Operator[];