mlogjs 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/build/Compiler.js +104 -99
- package/build/Compiler.js.map +1 -1
- package/build/CompilerError.js +11 -0
- package/build/CompilerError.js.map +1 -0
- package/build/Scope.js +70 -60
- package/build/Scope.js.map +1 -1
- package/build/bin.js +74 -60
- package/build/bin.js.map +1 -1
- package/build/handlers/BlockStatement.js +13 -13
- package/build/handlers/BlockStatement.js.map +1 -1
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/CallExpression.js.map +1 -1
- package/build/handlers/File.js +9 -0
- package/build/handlers/File.js.map +1 -0
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/ForStatement.js.map +1 -1
- package/build/handlers/Function.js +46 -35
- package/build/handlers/Function.js.map +1 -1
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/IfStatement.js.map +1 -1
- package/build/handlers/Literal.js +14 -17
- package/build/handlers/Literal.js.map +1 -1
- package/build/handlers/Object.js +54 -43
- package/build/handlers/Object.js.map +1 -1
- package/build/handlers/OperationExpressions.js +37 -32
- package/build/handlers/OperationExpressions.js.map +1 -1
- package/build/handlers/Program.js +8 -8
- package/build/handlers/Program.js.map +1 -1
- package/build/handlers/Statements.js +29 -29
- package/build/handlers/Statements.js.map +1 -1
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/TemplateExpression.js.map +1 -1
- package/build/handlers/VariableDeclaration.js +71 -55
- package/build/handlers/VariableDeclaration.js.map +1 -1
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/WhileStatement.js.map +1 -1
- package/build/handlers/index.js +31 -30
- package/build/handlers/index.js.map +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/initScope.js +39 -39
- package/build/instructions/AddressResolver.js +30 -30
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/InstructionBase.js.map +1 -1
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/JumpInstruction.js.map +1 -1
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/OperationInstruction.js.map +1 -1
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/index.js +25 -25
- package/build/macros/Building.js +88 -80
- package/build/macros/Building.js.map +1 -1
- package/build/macros/Function.js +19 -19
- package/build/macros/Function.js.map +1 -1
- package/build/macros/Math.js +61 -56
- package/build/macros/Math.js.map +1 -1
- package/build/macros/Memory.js +62 -60
- package/build/macros/Memory.js.map +1 -1
- package/build/macros/Namespace.js +110 -97
- package/build/macros/Namespace.js.map +1 -1
- package/build/macros/Other.js +20 -19
- package/build/macros/Other.js.map +1 -1
- package/build/macros/RawValue.js +16 -15
- package/build/macros/RawValue.js.map +1 -1
- package/build/macros/commands/Control.js +25 -24
- package/build/macros/commands/Control.js.map +1 -1
- package/build/macros/commands/Draw.js +39 -38
- package/build/macros/commands/Draw.js.map +1 -1
- package/build/macros/commands/DrawFlush.js +17 -16
- package/build/macros/commands/DrawFlush.js.map +1 -1
- package/build/macros/commands/GetLink.js +24 -20
- package/build/macros/commands/GetLink.js.map +1 -1
- package/build/macros/commands/Lookup.js +24 -23
- package/build/macros/commands/Lookup.js.map +1 -1
- package/build/macros/commands/Print.js +17 -13
- package/build/macros/commands/Print.js.map +1 -1
- package/build/macros/commands/PrintFlush.js +17 -16
- package/build/macros/commands/PrintFlush.js.map +1 -1
- package/build/macros/commands/Radar.js +64 -60
- package/build/macros/commands/Radar.js.map +1 -1
- package/build/macros/commands/Sensor.js +20 -19
- package/build/macros/commands/Sensor.js.map +1 -1
- package/build/macros/commands/UnitBind.js +17 -16
- package/build/macros/commands/UnitBind.js.map +1 -1
- package/build/macros/commands/UnitControl.js +72 -67
- package/build/macros/commands/UnitControl.js.map +1 -1
- package/build/macros/commands/UnitLocate.js +75 -54
- package/build/macros/commands/UnitLocate.js.map +1 -1
- package/build/macros/commands/UnitRadar.js +47 -40
- package/build/macros/commands/UnitRadar.js.map +1 -1
- package/build/macros/commands/Wait.js +18 -17
- package/build/macros/commands/Wait.js.map +1 -1
- package/build/macros/commands/index.js +32 -32
- package/build/macros/index.js +39 -39
- package/build/operators.js +101 -101
- package/build/operators.js.map +1 -1
- package/build/types.js +27 -27
- package/build/types.js.map +1 -1
- package/build/utils.js +17 -12
- package/build/utils.js.map +1 -1
- package/build/values/BaseValue.js +111 -111
- package/build/values/BaseValue.js.map +1 -1
- package/build/values/FunctionValue.js +115 -103
- package/build/values/FunctionValue.js.map +1 -1
- package/build/values/LiteralValue.js +88 -87
- package/build/values/LiteralValue.js.map +1 -1
- package/build/values/ObjectValue.js +54 -49
- package/build/values/ObjectValue.js.map +1 -1
- package/build/values/StoreValue.js +31 -30
- package/build/values/StoreValue.js.map +1 -1
- package/build/values/TempValue.js +77 -66
- package/build/values/TempValue.js.map +1 -1
- package/build/values/VoidValue.js +31 -30
- package/build/values/VoidValue.js.map +1 -1
- package/build/values/index.js +22 -22
- package/dist/bin.cjs +82 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/index.cjs +2220 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +2195 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/Compiler.d.ts +26 -0
- package/dist/types/CompilerError.d.ts +9 -0
- package/dist/types/Scope.d.ts +24 -0
- package/dist/types/bin.d.ts +1 -0
- package/dist/types/handlers/BlockStatement.d.ts +2 -0
- package/dist/types/handlers/CallExpression.d.ts +3 -0
- package/dist/types/handlers/File.d.ts +2 -0
- package/dist/types/handlers/ForStatement.d.ts +2 -0
- package/{build → dist/types}/handlers/Function.d.ts +5 -4
- package/{build → dist/types}/handlers/Identifier.d.ts +2 -2
- package/dist/types/handlers/IfStatement.d.ts +2 -0
- package/dist/types/handlers/Literal.d.ts +5 -0
- package/{build → dist/types}/handlers/Object.d.ts +6 -4
- package/{build → dist/types}/handlers/OperationExpressions.d.ts +8 -7
- package/dist/types/handlers/Program.d.ts +2 -0
- package/dist/types/handlers/Statements.d.ts +5 -0
- package/dist/types/handlers/TemplateExpression.d.ts +2 -0
- package/dist/types/handlers/Typescript.d.ts +7 -0
- package/dist/types/handlers/VariableDeclaration.d.ts +3 -0
- package/dist/types/handlers/WhileStatement.d.ts +3 -0
- package/{build → dist/types}/handlers/index.d.ts +16 -14
- package/dist/types/index.d.ts +2 -0
- package/{build → dist/types}/initScope.d.ts +5 -2
- package/{build → dist/types}/instructions/AddressResolver.d.ts +12 -12
- package/{build → dist/types}/instructions/ControlInstructions.d.ts +8 -11
- package/{build → dist/types}/instructions/EndInstruction.d.ts +4 -4
- package/{build → dist/types}/instructions/InstructionBase.d.ts +10 -10
- package/{build → dist/types}/instructions/JumpInstruction.d.ts +15 -15
- package/{build → dist/types}/instructions/OperationInstruction.d.ts +5 -5
- package/{build → dist/types}/instructions/SetCounterInstruction.d.ts +5 -5
- package/{build → dist/types}/instructions/SetInstruction.d.ts +6 -5
- package/{build → dist/types}/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/{build → dist/types}/instructions/index.d.ts +9 -9
- package/{build → dist/types}/macros/Building.d.ts +10 -11
- package/dist/types/macros/Entities.d.ts +11 -0
- package/dist/types/macros/Function.d.ts +13 -0
- package/dist/types/macros/GetGlobal.d.ts +5 -0
- package/{build → dist/types}/macros/Math.d.ts +5 -5
- package/{build → dist/types}/macros/Memory.d.ts +5 -5
- package/{build → dist/types}/macros/Namespace.d.ts +16 -21
- package/{build → dist/types}/macros/Other.d.ts +5 -5
- package/{build → dist/types}/macros/RawValue.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Control.d.ts +5 -5
- package/dist/types/macros/commands/Draw.d.ts +5 -0
- package/{build → dist/types}/macros/commands/DrawFlush.d.ts +5 -5
- package/{build/macros/commands/Draw.d.ts → dist/types/macros/commands/End.d.ts} +5 -5
- package/{build → dist/types}/macros/commands/GetLink.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Lookup.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Print.d.ts +5 -5
- package/{build → dist/types}/macros/commands/PrintFlush.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Radar.d.ts +7 -7
- package/{build → dist/types}/macros/commands/Sensor.d.ts +5 -5
- package/{build → dist/types}/macros/commands/UnitBind.d.ts +5 -5
- package/dist/types/macros/commands/UnitControl.d.ts +5 -0
- package/{build → dist/types}/macros/commands/UnitLocate.d.ts +5 -5
- package/{build → dist/types}/macros/commands/UnitRadar.d.ts +5 -5
- package/{build → dist/types}/macros/commands/Wait.d.ts +5 -5
- package/{build → dist/types}/macros/commands/index.d.ts +15 -14
- package/{build → dist/types}/macros/index.d.ts +6 -7
- package/{build → dist/types}/operators.d.ts +25 -25
- package/dist/types/types.d.ts +224 -0
- package/dist/types/utils.d.ts +30 -0
- package/dist/types/values/BaseValue.d.ts +7 -0
- package/dist/types/values/DestructuringValue.d.ts +17 -0
- package/dist/types/values/FunctionValue.d.ts +47 -0
- package/{build → dist/types}/values/LiteralValue.d.ts +13 -12
- package/dist/types/values/ObjectValue.d.ts +23 -0
- package/dist/types/values/SenseableValue.d.ts +23 -0
- package/dist/types/values/StackValue.d.ts +16 -0
- package/dist/types/values/StoreValue.d.ts +15 -0
- package/{build → dist/types}/values/TempValue.d.ts +19 -12
- package/dist/types/values/ValueOwner.d.ts +27 -0
- package/dist/types/values/VoidValue.d.ts +16 -0
- package/{build → dist/types}/values/index.d.ts +7 -6
- package/lib/commands.d.ts +242 -36
- package/lib/eslib/lib.es5.d.ts +1 -1
- package/lib/globals.d.ts +172 -159
- package/lib/helpers.d.ts +2 -2
- package/lib/memory.d.ts +1 -1
- package/lib/traits.d.ts +130 -110
- package/package.json +33 -38
- package/build/Compiler.d.ts +0 -18
- package/build/Scope.d.ts +0 -26
- package/build/bin.d.ts +0 -2
- package/build/handlers/BlockStatement.d.ts +0 -2
- package/build/handlers/CallExpression.d.ts +0 -3
- package/build/handlers/ForStatement.d.ts +0 -2
- package/build/handlers/IfStatement.d.ts +0 -2
- package/build/handlers/Literal.d.ts +0 -2
- package/build/handlers/Program.d.ts +0 -2
- package/build/handlers/Statements.d.ts +0 -5
- package/build/handlers/TemplateExpression.d.ts +0 -2
- package/build/handlers/VariableDeclaration.d.ts +0 -3
- package/build/handlers/WhileStatement.d.ts +0 -2
- package/build/index.d.ts +0 -1
- package/build/macros/Function.d.ts +0 -12
- package/build/macros/commands/UnitControl.d.ts +0 -5
- package/build/types.d.ts +0 -49
- package/build/utils.d.ts +0 -3
- package/build/values/BaseValue.d.ts +0 -5
- package/build/values/FunctionValue.d.ts +0 -34
- package/build/values/ObjectValue.d.ts +0 -17
- package/build/values/StoreValue.d.ts +0 -11
- package/build/values/VoidValue.d.ts +0 -11
- package/dist/mlogjs.es.js +0 -6366
- package/dist/mlogjs.umd.js +0 -8
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReturnStatement = exports.ContinueStatement = exports.BreakStatement = exports.ExpressionStatement = void 0;
|
|
4
|
-
const instructions_1 = require("../instructions");
|
|
5
|
-
const values_1 = require("../values");
|
|
6
|
-
const ExpressionStatement = (c, scope, node) => {
|
|
7
|
-
return c.handle(scope, node.expression);
|
|
8
|
-
};
|
|
9
|
-
exports.ExpressionStatement = ExpressionStatement;
|
|
10
|
-
const BreakStatement = (_, scope) => {
|
|
11
|
-
const addr = new values_1.LiteralValue(scope, null);
|
|
12
|
-
scope.break.bind(addr);
|
|
13
|
-
return [null, [new instructions_1.BreakInstruction(addr)]];
|
|
14
|
-
};
|
|
15
|
-
exports.BreakStatement = BreakStatement;
|
|
16
|
-
const ContinueStatement = (_, scope) => {
|
|
17
|
-
const addr = new values_1.LiteralValue(scope, null);
|
|
18
|
-
scope.continue.bind(addr);
|
|
19
|
-
return [null, [new instructions_1.ContinueInstruction(addr)]];
|
|
20
|
-
};
|
|
21
|
-
exports.ContinueStatement = ContinueStatement;
|
|
22
|
-
const ReturnStatement = (c, scope, node) => {
|
|
23
|
-
const [arg, argInst] = node.argument
|
|
24
|
-
? c.handle(scope, node.argument)
|
|
25
|
-
: [null, []];
|
|
26
|
-
const [ret, retInst] = scope.function.return(scope, arg);
|
|
27
|
-
return [ret, [...argInst, ...retInst]];
|
|
28
|
-
};
|
|
29
|
-
exports.ReturnStatement = ReturnStatement;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReturnStatement = exports.ContinueStatement = exports.BreakStatement = exports.ExpressionStatement = void 0;
|
|
4
|
+
const instructions_1 = require("../instructions");
|
|
5
|
+
const values_1 = require("../values");
|
|
6
|
+
const ExpressionStatement = (c, scope, node) => {
|
|
7
|
+
return c.handle(scope, node.expression);
|
|
8
|
+
};
|
|
9
|
+
exports.ExpressionStatement = ExpressionStatement;
|
|
10
|
+
const BreakStatement = (_, scope) => {
|
|
11
|
+
const addr = new values_1.LiteralValue(scope, null);
|
|
12
|
+
scope.break.bind(addr);
|
|
13
|
+
return [null, [new instructions_1.BreakInstruction(addr)]];
|
|
14
|
+
};
|
|
15
|
+
exports.BreakStatement = BreakStatement;
|
|
16
|
+
const ContinueStatement = (_, scope) => {
|
|
17
|
+
const addr = new values_1.LiteralValue(scope, null);
|
|
18
|
+
scope.continue.bind(addr);
|
|
19
|
+
return [null, [new instructions_1.ContinueInstruction(addr)]];
|
|
20
|
+
};
|
|
21
|
+
exports.ContinueStatement = ContinueStatement;
|
|
22
|
+
const ReturnStatement = (c, scope, node) => {
|
|
23
|
+
const [arg, argInst] = node.argument
|
|
24
|
+
? c.handle(scope, node.argument)
|
|
25
|
+
: [null, []];
|
|
26
|
+
const [ret, retInst] = scope.function.return(scope, arg);
|
|
27
|
+
return [ret, [...argInst, ...retInst]];
|
|
28
|
+
};
|
|
29
|
+
exports.ReturnStatement = ReturnStatement;
|
|
30
30
|
//# sourceMappingURL=Statements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Statements.js","sourceRoot":"","sources":["../../src/handlers/Statements.ts"],"names":[],"mappings":";;;AAAA,kDAAwE;AAExE,sCAAyC;AAElC,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Statements.js","sourceRoot":"","sources":["../../src/handlers/Statements.ts"],"names":[],"mappings":";;;AAAA,kDAAwE;AAExE,sCAAyC;AAElC,MAAM,mBAAmB,GAA4B,CAC1D,CAAC,EACD,KAAK,EACL,IAA4B,EAC5B,EAAE;IACF,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B;AAEK,MAAM,cAAc,GAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;IACzD,MAAM,IAAI,GAAG,IAAI,qBAAY,CAAC,KAAK,EAAE,IAAa,CAAC,CAAC;IACpD,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,+BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB;AAEK,MAAM,iBAAiB,GAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;IAC5D,MAAM,IAAI,GAAG,IAAI,qBAAY,CAAC,KAAK,EAAE,IAAa,CAAC,CAAC;IACpD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,kCAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAJW,QAAA,iBAAiB,qBAI5B;AAEK,MAAM,eAAe,GAA4B,CACtD,CAAC,EACD,KAAK,EACL,IAAwB,EACxB,EAAE;IACF,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ;QAClC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;QAChC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACf,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC;AAVW,QAAA,eAAe,mBAU1B"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TemplateLiteral = void 0;
|
|
4
|
-
const instructions_1 = require("../instructions");
|
|
5
|
-
const TemplateLiteral = (c, scope, node) => {
|
|
6
|
-
const args = [];
|
|
7
|
-
const inst = [];
|
|
8
|
-
node.expressions.forEach((expression, i) => {
|
|
9
|
-
const [v, vi] = c.handleEval(scope, expression);
|
|
10
|
-
inst.push(...vi);
|
|
11
|
-
args.push(node.quasis[i].value.raw, v);
|
|
12
|
-
});
|
|
13
|
-
args.push(node.quasis.slice(-1)[0].value.raw);
|
|
14
|
-
inst.push(new instructions_1.ZeroSpaceInstruction(...args));
|
|
15
|
-
return [null, inst];
|
|
16
|
-
};
|
|
17
|
-
exports.TemplateLiteral = TemplateLiteral;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateLiteral = void 0;
|
|
4
|
+
const instructions_1 = require("../instructions");
|
|
5
|
+
const TemplateLiteral = (c, scope, node) => {
|
|
6
|
+
const args = [];
|
|
7
|
+
const inst = [];
|
|
8
|
+
node.expressions.forEach((expression, i) => {
|
|
9
|
+
const [v, vi] = c.handleEval(scope, expression);
|
|
10
|
+
inst.push(...vi);
|
|
11
|
+
args.push(node.quasis[i].value.raw, v);
|
|
12
|
+
});
|
|
13
|
+
args.push(node.quasis.slice(-1)[0].value.raw);
|
|
14
|
+
inst.push(new instructions_1.ZeroSpaceInstruction(...args));
|
|
15
|
+
return [null, inst];
|
|
16
|
+
};
|
|
17
|
+
exports.TemplateLiteral = TemplateLiteral;
|
|
18
18
|
//# sourceMappingURL=TemplateExpression.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateExpression.js","sourceRoot":"","sources":["../../src/handlers/TemplateExpression.ts"],"names":[],"mappings":";;;AAAA,kDAAuD;
|
|
1
|
+
{"version":3,"file":"TemplateExpression.js","sourceRoot":"","sources":["../../src/handlers/TemplateExpression.ts"],"names":[],"mappings":";;;AAAA,kDAAuD;AAGhD,MAAM,eAAe,GAAmB,CAC7C,CAAC,EACD,KAAK,EACL,IAAwB,EACxB,EAAE;IACF,MAAM,IAAI,GAAwB,EAAE,CAAC;IACrC,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,CAAC,IAAI,mCAAoB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtB,CAAC,CAAC;AAfW,QAAA,eAAe,mBAe1B"}
|
|
@@ -1,56 +1,72 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VariableDeclarator = exports.VariableDeclaration = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
scope.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VariableDeclarator = exports.VariableDeclaration = void 0;
|
|
4
|
+
const values_1 = require("../values");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const CompilerError_1 = require("../CompilerError");
|
|
7
|
+
const VariableDeclaration = (c, scope, node) => {
|
|
8
|
+
return c.handleMany(scope, node.declarations, (scope, child) => (0, exports.VariableDeclarator)(c, scope, child, node.kind));
|
|
9
|
+
};
|
|
10
|
+
exports.VariableDeclaration = VariableDeclaration;
|
|
11
|
+
const VariableDeclarator = (c, scope, node, kind = "let") => {
|
|
12
|
+
const valinst = node.init
|
|
13
|
+
? c.handleEval(scope, node.init)
|
|
14
|
+
: [null, []];
|
|
15
|
+
switch (node.id.type) {
|
|
16
|
+
case "Identifier": {
|
|
17
|
+
const { name } = node.id;
|
|
18
|
+
const identifier = c.compactNames
|
|
19
|
+
? (0, utils_1.nodeName)(node)
|
|
20
|
+
: scope.formatName(name);
|
|
21
|
+
const [init] = valinst;
|
|
22
|
+
if (kind === "const" && !init)
|
|
23
|
+
throw new CompilerError_1.CompilerError("Cannot create constant with void value.");
|
|
24
|
+
if (kind === "const" && init?.constant) {
|
|
25
|
+
init.rename?.(identifier);
|
|
26
|
+
scope.set(name, init);
|
|
27
|
+
return valinst;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const value = scope.make(name, identifier);
|
|
31
|
+
if (init) {
|
|
32
|
+
if (init.macro)
|
|
33
|
+
throw new CompilerError_1.CompilerError("Macro value must be constant.");
|
|
34
|
+
valinst[1].push(...value["="](scope, init)[1]);
|
|
35
|
+
}
|
|
36
|
+
if (kind === "const")
|
|
37
|
+
value.constant = true;
|
|
38
|
+
return valinst;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
case "ArrayPattern": {
|
|
42
|
+
const { elements } = node.id;
|
|
43
|
+
const [init] = valinst;
|
|
44
|
+
if (!init)
|
|
45
|
+
throw new CompilerError_1.CompilerError("Cannot use array destructuring with constant with void value.");
|
|
46
|
+
if (!init.macro)
|
|
47
|
+
throw new CompilerError_1.CompilerError("Cannot use array destructuring on non macro values");
|
|
48
|
+
if (kind !== "const")
|
|
49
|
+
throw new CompilerError_1.CompilerError("Macro value must be constant.");
|
|
50
|
+
if (!(init instanceof values_1.ObjectValue)) {
|
|
51
|
+
throw new CompilerError_1.CompilerError("Array destructuring target must be an object value");
|
|
52
|
+
}
|
|
53
|
+
for (let i = 0; i < elements.length; i++) {
|
|
54
|
+
const element = elements[i];
|
|
55
|
+
if (!element)
|
|
56
|
+
continue;
|
|
57
|
+
if (element.type !== "Identifier") {
|
|
58
|
+
throw new CompilerError_1.CompilerError("Array destructuring expression can only have empty items or identifiers");
|
|
59
|
+
}
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
61
|
+
const val = init.data[i];
|
|
62
|
+
val.rename?.(c.compactNames ? (0, utils_1.nodeName)(element) : scope.formatName(element.name));
|
|
63
|
+
scope.set(element.name, val);
|
|
64
|
+
}
|
|
65
|
+
return valinst;
|
|
66
|
+
}
|
|
67
|
+
default:
|
|
68
|
+
throw new CompilerError_1.CompilerError("");
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.VariableDeclarator = VariableDeclarator;
|
|
56
72
|
//# sourceMappingURL=VariableDeclaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariableDeclaration.js","sourceRoot":"","sources":["../../src/handlers/VariableDeclaration.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"VariableDeclaration.js","sourceRoot":"","sources":["../../src/handlers/VariableDeclaration.ts"],"names":[],"mappings":";;;AAAA,sCAAwC;AAExC,oCAAoC;AACpC,oDAAiD;AAE1C,MAAM,mBAAmB,GAAmB,CACjD,CAAC,EACD,KAAK,EACL,IAA4B,EAC5B,EAAE;IACF,OAAO,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAC7D,IAAA,0BAAkB,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAC/C,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ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AAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC9B;YACD,OAAO,OAAO,CAAC;SAChB;QACD;YACE,MAAM,IAAI,6BAAa,CAAC,EAAE,CAAC,CAAC;KAC/B;AACH,CAAC,CAAC;AA5EW,QAAA,kBAAkB,sBA4E7B"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WhileStatement = void 0;
|
|
4
|
-
const instructions_1 = require("../instructions");
|
|
5
|
-
const values_1 = require("../values");
|
|
6
|
-
const WhileStatement = (c, scope, node) => {
|
|
7
|
-
const lines = [];
|
|
8
|
-
const [test, testLines] = c.handleEval(scope, node.test);
|
|
9
|
-
const startLoopAddr = new values_1.LiteralValue(scope, null);
|
|
10
|
-
const endLoopAddr = new values_1.LiteralValue(scope, null);
|
|
11
|
-
const startLoopLine = new instructions_1.AddressResolver(startLoopAddr).bindContinue(scope);
|
|
12
|
-
const endLoopLine = new instructions_1.AddressResolver(endLoopAddr).bindBreak(scope);
|
|
13
|
-
if (test instanceof values_1.LiteralValue) {
|
|
14
|
-
if (test.data) {
|
|
15
|
-
lines.push(startLoopLine, ...c.handle(scope, node.body)[1], new instructions_1.JumpInstruction(startLoopAddr, instructions_1.EJumpKind.Always), endLoopLine);
|
|
16
|
-
}
|
|
17
|
-
return [null, lines];
|
|
18
|
-
}
|
|
19
|
-
lines.push(startLoopLine, ...testLines, new instructions_1.JumpInstruction(endLoopAddr, instructions_1.EJumpKind.Equal, test, new values_1.LiteralValue(scope, 0)), ...c.handle(scope, node.body)[1], new instructions_1.JumpInstruction(startLoopAddr, instructions_1.EJumpKind.Always), endLoopLine);
|
|
20
|
-
return [null, lines];
|
|
21
|
-
};
|
|
22
|
-
exports.WhileStatement = WhileStatement;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WhileStatement = void 0;
|
|
4
|
+
const instructions_1 = require("../instructions");
|
|
5
|
+
const values_1 = require("../values");
|
|
6
|
+
const WhileStatement = (c, scope, node) => {
|
|
7
|
+
const lines = [];
|
|
8
|
+
const [test, testLines] = c.handleEval(scope, node.test);
|
|
9
|
+
const startLoopAddr = new values_1.LiteralValue(scope, null);
|
|
10
|
+
const endLoopAddr = new values_1.LiteralValue(scope, null);
|
|
11
|
+
const startLoopLine = new instructions_1.AddressResolver(startLoopAddr).bindContinue(scope);
|
|
12
|
+
const endLoopLine = new instructions_1.AddressResolver(endLoopAddr).bindBreak(scope);
|
|
13
|
+
if (test instanceof values_1.LiteralValue) {
|
|
14
|
+
if (test.data) {
|
|
15
|
+
lines.push(startLoopLine, ...c.handle(scope, node.body)[1], new instructions_1.JumpInstruction(startLoopAddr, instructions_1.EJumpKind.Always), endLoopLine);
|
|
16
|
+
}
|
|
17
|
+
return [null, lines];
|
|
18
|
+
}
|
|
19
|
+
lines.push(startLoopLine, ...testLines, new instructions_1.JumpInstruction(endLoopAddr, instructions_1.EJumpKind.Equal, test, new values_1.LiteralValue(scope, 0)), ...c.handle(scope, node.body)[1], new instructions_1.JumpInstruction(startLoopAddr, instructions_1.EJumpKind.Always), endLoopLine);
|
|
20
|
+
return [null, lines];
|
|
21
|
+
};
|
|
22
|
+
exports.WhileStatement = WhileStatement;
|
|
23
23
|
//# sourceMappingURL=WhileStatement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhileStatement.js","sourceRoot":"","sources":["../../src/handlers/WhileStatement.ts"],"names":[],"mappings":";;;AAAA,kDAA8E;AAE9E,sCAAyC;AAElC,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"WhileStatement.js","sourceRoot":"","sources":["../../src/handlers/WhileStatement.ts"],"names":[],"mappings":";;;AAAA,kDAA8E;AAE9E,sCAAyC;AAElC,MAAM,cAAc,GAAmB,CAC5C,CAAC,EACD,KAAK,EACL,IAAuB,EACvB,EA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CAAC,CAAC;AAvCW,QAAA,cAAc,kBAuCzB"}
|
package/build/handlers/index.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
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
|
-
__exportStar(require("./Program"), exports);
|
|
18
|
-
__exportStar(require("./VariableDeclaration"), exports);
|
|
19
|
-
__exportStar(require("./Literal"), exports);
|
|
20
|
-
__exportStar(require("./OperationExpressions"), exports);
|
|
21
|
-
__exportStar(require("./Identifier"), exports);
|
|
22
|
-
__exportStar(require("./Statements"), exports);
|
|
23
|
-
__exportStar(require("./IfStatement"), exports);
|
|
24
|
-
__exportStar(require("./WhileStatement"), exports);
|
|
25
|
-
__exportStar(require("./ForStatement"), exports);
|
|
26
|
-
__exportStar(require("./Function"), exports);
|
|
27
|
-
__exportStar(require("./CallExpression"), exports);
|
|
28
|
-
__exportStar(require("./Object"), exports);
|
|
29
|
-
__exportStar(require("./TemplateExpression"), exports);
|
|
30
|
-
__exportStar(require("./BlockStatement"), exports);
|
|
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
|
+
__exportStar(require("./Program"), exports);
|
|
18
|
+
__exportStar(require("./VariableDeclaration"), exports);
|
|
19
|
+
__exportStar(require("./Literal"), exports);
|
|
20
|
+
__exportStar(require("./OperationExpressions"), exports);
|
|
21
|
+
__exportStar(require("./Identifier"), exports);
|
|
22
|
+
__exportStar(require("./Statements"), exports);
|
|
23
|
+
__exportStar(require("./IfStatement"), exports);
|
|
24
|
+
__exportStar(require("./WhileStatement"), exports);
|
|
25
|
+
__exportStar(require("./ForStatement"), exports);
|
|
26
|
+
__exportStar(require("./Function"), exports);
|
|
27
|
+
__exportStar(require("./CallExpression"), exports);
|
|
28
|
+
__exportStar(require("./Object"), exports);
|
|
29
|
+
__exportStar(require("./TemplateExpression"), exports);
|
|
30
|
+
__exportStar(require("./BlockStatement"), exports);
|
|
31
|
+
__exportStar(require("./File"), exports);
|
|
31
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,wDAAsC;AACtC,4CAA0B;AAC1B,yDAAuC;AACvC,+CAA6B;AAC7B,+CAA6B;AAC7B,gDAA8B;AAC9B,mDAAiC;AACjC,iDAA+B;AAC/B,6CAA2B;AAC3B,mDAAiC;AACjC,2CAAyB;AACzB,uDAAqC;AACrC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,wDAAsC;AACtC,4CAA0B;AAC1B,yDAAuC;AACvC,+CAA6B;AAC7B,+CAA6B;AAC7B,gDAA8B;AAC9B,mDAAiC;AACjC,iDAA+B;AAC/B,6CAA2B;AAC3B,mDAAiC;AACjC,2CAAyB;AACzB,uDAAqC;AACrC,mDAAiC;AACjC,yCAAuB"}
|
package/build/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompilerError = exports.Compiler = void 0;
|
|
4
|
+
var Compiler_1 = require("./Compiler");
|
|
5
|
+
Object.defineProperty(exports, "Compiler", { enumerable: true, get: function () { return Compiler_1.Compiler; } });
|
|
6
|
+
var CompilerError_1 = require("./CompilerError");
|
|
7
|
+
Object.defineProperty(exports, "CompilerError", { enumerable: true, get: function () { return CompilerError_1.CompilerError; } });
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAuD;AAA9C,oGAAA,QAAQ,OAAA;AACjB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA"}
|
package/build/initScope.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initScope = void 0;
|
|
4
|
-
const macros_1 = require("./macros");
|
|
5
|
-
const Namespace_1 = require("./macros/Namespace");
|
|
6
|
-
const RawValue_1 = require("./macros/RawValue");
|
|
7
|
-
function initScope(scope) {
|
|
8
|
-
// namespaces
|
|
9
|
-
scope.hardSet("ControlKind", new macros_1.NamespaceMacro(scope));
|
|
10
|
-
scope.hardSet("Vars", new macros_1.VarsNamespace(scope));
|
|
11
|
-
scope.hardSet("Items", new macros_1.NamespaceMacro(scope, { changeCasing: true }));
|
|
12
|
-
scope.hardSet("Liquids", new macros_1.NamespaceMacro(scope));
|
|
13
|
-
scope.hardSet("Units", new macros_1.NamespaceMacro(scope));
|
|
14
|
-
scope.hardSet("LAccess", new macros_1.NamespaceMacro(scope));
|
|
15
|
-
scope.hardSet("UnitCommands", new Namespace_1.UCommandsNamespace(scope));
|
|
16
|
-
scope.hardSet("Blocks", new macros_1.NamespaceMacro(scope, { changeCasing: true }));
|
|
17
|
-
// helper methods
|
|
18
|
-
scope.hardSet("getBuilding", new macros_1.BuildingBuilder(scope));
|
|
19
|
-
scope.hardSet("getVar", new RawValue_1.RawValueMacro(scope));
|
|
20
|
-
scope.hardSet("concat", new macros_1.Concat(scope));
|
|
21
|
-
scope.hardSet("Math", new macros_1.MlogMath(scope));
|
|
22
|
-
scope.hardSet("Memory", new macros_1.MemoryBuilder(scope));
|
|
23
|
-
// commands
|
|
24
|
-
scope.hardSet("draw", new macros_1.commands.Draw(scope));
|
|
25
|
-
scope.hardSet("print", new macros_1.commands.Print(scope));
|
|
26
|
-
scope.hardSet("printFlush", new macros_1.commands.PrintFlush(scope));
|
|
27
|
-
scope.hardSet("drawFlush", new macros_1.commands.DrawFlush(scope));
|
|
28
|
-
scope.hardSet("getLink", new macros_1.commands.GetLink(scope));
|
|
29
|
-
scope.hardSet("control", new macros_1.commands.Control(scope));
|
|
30
|
-
scope.hardSet("radar", new macros_1.commands.Radar(scope));
|
|
31
|
-
scope.hardSet("sensor", new macros_1.commands.Sensor(scope));
|
|
32
|
-
scope.hardSet("wait", new macros_1.commands.Wait(scope));
|
|
33
|
-
scope.hardSet("lookup", new macros_1.commands.Lookup(scope));
|
|
34
|
-
scope.hardSet("unitBind", new macros_1.commands.UnitBind(scope));
|
|
35
|
-
scope.hardSet("unitControl", new macros_1.commands.UnitControl(scope));
|
|
36
|
-
scope.hardSet("unitRadar", new macros_1.commands.UnitRadar(scope));
|
|
37
|
-
scope.hardSet("unitLocate", new macros_1.commands.UnitLocate(scope));
|
|
38
|
-
}
|
|
39
|
-
exports.initScope = initScope;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initScope = void 0;
|
|
4
|
+
const macros_1 = require("./macros");
|
|
5
|
+
const Namespace_1 = require("./macros/Namespace");
|
|
6
|
+
const RawValue_1 = require("./macros/RawValue");
|
|
7
|
+
function initScope(scope) {
|
|
8
|
+
// namespaces
|
|
9
|
+
scope.hardSet("ControlKind", new macros_1.NamespaceMacro(scope));
|
|
10
|
+
scope.hardSet("Vars", new macros_1.VarsNamespace(scope));
|
|
11
|
+
scope.hardSet("Items", new macros_1.NamespaceMacro(scope, { changeCasing: true }));
|
|
12
|
+
scope.hardSet("Liquids", new macros_1.NamespaceMacro(scope));
|
|
13
|
+
scope.hardSet("Units", new macros_1.NamespaceMacro(scope));
|
|
14
|
+
scope.hardSet("LAccess", new macros_1.NamespaceMacro(scope));
|
|
15
|
+
scope.hardSet("UnitCommands", new Namespace_1.UCommandsNamespace(scope));
|
|
16
|
+
scope.hardSet("Blocks", new macros_1.NamespaceMacro(scope, { changeCasing: true }));
|
|
17
|
+
// helper methods
|
|
18
|
+
scope.hardSet("getBuilding", new macros_1.BuildingBuilder(scope));
|
|
19
|
+
scope.hardSet("getVar", new RawValue_1.RawValueMacro(scope));
|
|
20
|
+
scope.hardSet("concat", new macros_1.Concat(scope));
|
|
21
|
+
scope.hardSet("Math", new macros_1.MlogMath(scope));
|
|
22
|
+
scope.hardSet("Memory", new macros_1.MemoryBuilder(scope));
|
|
23
|
+
// commands
|
|
24
|
+
scope.hardSet("draw", new macros_1.commands.Draw(scope));
|
|
25
|
+
scope.hardSet("print", new macros_1.commands.Print(scope));
|
|
26
|
+
scope.hardSet("printFlush", new macros_1.commands.PrintFlush(scope));
|
|
27
|
+
scope.hardSet("drawFlush", new macros_1.commands.DrawFlush(scope));
|
|
28
|
+
scope.hardSet("getLink", new macros_1.commands.GetLink(scope));
|
|
29
|
+
scope.hardSet("control", new macros_1.commands.Control(scope));
|
|
30
|
+
scope.hardSet("radar", new macros_1.commands.Radar(scope));
|
|
31
|
+
scope.hardSet("sensor", new macros_1.commands.Sensor(scope));
|
|
32
|
+
scope.hardSet("wait", new macros_1.commands.Wait(scope));
|
|
33
|
+
scope.hardSet("lookup", new macros_1.commands.Lookup(scope));
|
|
34
|
+
scope.hardSet("unitBind", new macros_1.commands.UnitBind(scope));
|
|
35
|
+
scope.hardSet("unitControl", new macros_1.commands.UnitControl(scope));
|
|
36
|
+
scope.hardSet("unitRadar", new macros_1.commands.UnitRadar(scope));
|
|
37
|
+
scope.hardSet("unitLocate", new macros_1.commands.UnitLocate(scope));
|
|
38
|
+
}
|
|
39
|
+
exports.initScope = initScope;
|
|
40
40
|
//# sourceMappingURL=initScope.js.map
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AddressResolver = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
class AddressResolver extends _1.InstructionBase {
|
|
6
|
-
constructor(...bonds) {
|
|
7
|
-
super();
|
|
8
|
-
this.bonds = bonds;
|
|
9
|
-
}
|
|
10
|
-
get hidden() {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
set hidden(value) { }
|
|
14
|
-
resolve(i) {
|
|
15
|
-
for (const literal of this.bonds)
|
|
16
|
-
literal.data = i;
|
|
17
|
-
}
|
|
18
|
-
bind(bond) {
|
|
19
|
-
this.bonds.push(bond);
|
|
20
|
-
}
|
|
21
|
-
bindBreak(scope) {
|
|
22
|
-
scope.break = this;
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
bindContinue(scope) {
|
|
26
|
-
scope.continue = this;
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.AddressResolver = AddressResolver;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressResolver = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class AddressResolver extends _1.InstructionBase {
|
|
6
|
+
constructor(...bonds) {
|
|
7
|
+
super();
|
|
8
|
+
this.bonds = bonds;
|
|
9
|
+
}
|
|
10
|
+
get hidden() {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
set hidden(value) { }
|
|
14
|
+
resolve(i) {
|
|
15
|
+
for (const literal of this.bonds)
|
|
16
|
+
literal.data = i;
|
|
17
|
+
}
|
|
18
|
+
bind(bond) {
|
|
19
|
+
this.bonds.push(bond);
|
|
20
|
+
}
|
|
21
|
+
bindBreak(scope) {
|
|
22
|
+
scope.break = this;
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
bindContinue(scope) {
|
|
26
|
+
scope.continue = this;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.AddressResolver = AddressResolver;
|
|
31
31
|
//# sourceMappingURL=AddressResolver.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReturnInstruction = exports.ContinueInstruction = exports.BreakInstruction = void 0;
|
|
4
|
-
const JumpInstruction_1 = require("./JumpInstruction");
|
|
5
|
-
class BreakInstruction extends JumpInstruction_1.JumpInstruction {
|
|
6
|
-
constructor(address) {
|
|
7
|
-
super(address, JumpInstruction_1.EJumpKind.Always);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.BreakInstruction = BreakInstruction;
|
|
11
|
-
class ContinueInstruction extends JumpInstruction_1.JumpInstruction {
|
|
12
|
-
constructor(address) {
|
|
13
|
-
super(address, JumpInstruction_1.EJumpKind.Always);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.ContinueInstruction = ContinueInstruction;
|
|
17
|
-
class ReturnInstruction extends JumpInstruction_1.JumpInstruction {
|
|
18
|
-
constructor(address) {
|
|
19
|
-
super(address, JumpInstruction_1.EJumpKind.Always);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.ReturnInstruction = ReturnInstruction;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReturnInstruction = exports.ContinueInstruction = exports.BreakInstruction = void 0;
|
|
4
|
+
const JumpInstruction_1 = require("./JumpInstruction");
|
|
5
|
+
class BreakInstruction extends JumpInstruction_1.JumpInstruction {
|
|
6
|
+
constructor(address) {
|
|
7
|
+
super(address, JumpInstruction_1.EJumpKind.Always);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.BreakInstruction = BreakInstruction;
|
|
11
|
+
class ContinueInstruction extends JumpInstruction_1.JumpInstruction {
|
|
12
|
+
constructor(address) {
|
|
13
|
+
super(address, JumpInstruction_1.EJumpKind.Always);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ContinueInstruction = ContinueInstruction;
|
|
17
|
+
class ReturnInstruction extends JumpInstruction_1.JumpInstruction {
|
|
18
|
+
constructor(address) {
|
|
19
|
+
super(address, JumpInstruction_1.EJumpKind.Always);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ReturnInstruction = ReturnInstruction;
|
|
23
23
|
//# sourceMappingURL=ControlInstructions.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EndInstruction = void 0;
|
|
4
|
-
const InstructionBase_1 = require("./InstructionBase");
|
|
5
|
-
class EndInstruction extends InstructionBase_1.InstructionBase {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("end");
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.EndInstruction = EndInstruction;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EndInstruction = void 0;
|
|
4
|
+
const InstructionBase_1 = require("./InstructionBase");
|
|
5
|
+
class EndInstruction extends InstructionBase_1.InstructionBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("end");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.EndInstruction = EndInstruction;
|
|
11
11
|
//# sourceMappingURL=EndInstruction.js.map
|