mlogjs 0.1.10 → 0.2.1
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 +21 -21
- package/README.md +68 -18
- package/build/Compiler.d.ts +18 -18
- package/build/Compiler.js +99 -92
- package/build/Compiler.js.map +1 -1
- package/build/Scope.d.ts +26 -26
- package/build/Scope.js +60 -60
- package/build/Scope.js.map +1 -1
- package/build/bin.d.ts +2 -2
- package/build/bin.js +59 -33
- package/build/bin.js.map +1 -1
- package/build/handlers/BlockStatement.d.ts +2 -2
- package/build/handlers/BlockStatement.js +13 -13
- package/build/handlers/BlockStatement.js.map +1 -1
- package/build/handlers/CallExpression.d.ts +3 -3
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/CallExpression.js.map +1 -1
- package/build/handlers/ForStatement.d.ts +2 -2
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/ForStatement.js.map +1 -1
- package/build/handlers/Function.d.ts +4 -4
- package/build/handlers/Function.js +35 -32
- package/build/handlers/Function.js.map +1 -1
- package/build/handlers/Identifier.d.ts +2 -2
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/Identifier.js.map +1 -1
- package/build/handlers/IfStatement.d.ts +2 -2
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/IfStatement.js.map +1 -1
- package/build/handlers/Literal.d.ts +2 -2
- package/build/handlers/Literal.js +17 -15
- package/build/handlers/Literal.js.map +1 -1
- package/build/handlers/Object.d.ts +4 -4
- package/build/handlers/Object.js +43 -43
- package/build/handlers/Object.js.map +1 -1
- package/build/handlers/OperationExpressions.d.ts +7 -7
- package/build/handlers/OperationExpressions.js +32 -31
- package/build/handlers/OperationExpressions.js.map +1 -1
- package/build/handlers/Program.d.ts +2 -2
- package/build/handlers/Program.js +8 -8
- package/build/handlers/Program.js.map +1 -1
- package/build/handlers/Statements.d.ts +5 -5
- package/build/handlers/Statements.js +29 -27
- package/build/handlers/Statements.js.map +1 -1
- package/build/handlers/TemplateExpression.d.ts +2 -2
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/TemplateExpression.js.map +1 -1
- package/build/handlers/VariableDeclaration.d.ts +3 -3
- package/build/handlers/VariableDeclaration.js +55 -31
- package/build/handlers/VariableDeclaration.js.map +1 -1
- package/build/handlers/WhileStatement.d.ts +2 -2
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/WhileStatement.js.map +1 -1
- package/build/handlers/index.d.ts +14 -14
- package/build/handlers/index.js +30 -26
- package/build/handlers/index.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/initScope.d.ts +2 -0
- package/build/initScope.js +40 -0
- package/build/initScope.js.map +1 -0
- package/build/instructions/AddressResolver.d.ts +12 -12
- package/build/instructions/AddressResolver.js +30 -31
- package/build/instructions/AddressResolver.js.map +1 -1
- package/build/instructions/ControlInstructions.d.ts +11 -11
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/ControlInstructions.js.map +1 -1
- package/build/instructions/EndInstruction.d.ts +4 -4
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/EndInstruction.js.map +1 -1
- package/build/instructions/InstructionBase.d.ts +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/InstructionBase.js.map +1 -1
- package/build/instructions/JumpInstruction.d.ts +15 -15
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/JumpInstruction.js.map +1 -1
- package/build/instructions/OperationInstruction.d.ts +5 -5
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/OperationInstruction.js.map +1 -1
- package/build/instructions/SetCounterInstruction.d.ts +5 -5
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetCounterInstruction.js.map +1 -1
- package/build/instructions/SetInstruction.d.ts +5 -5
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/SetInstruction.js.map +1 -1
- package/build/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.js.map +1 -1
- package/build/instructions/index.d.ts +9 -9
- package/build/instructions/index.js +25 -21
- package/build/instructions/index.js.map +1 -1
- package/build/macros/Building.d.ts +11 -0
- package/build/macros/Building.js +81 -0
- package/build/macros/Building.js.map +1 -0
- package/build/macros/Function.d.ts +12 -12
- package/build/macros/Function.js +19 -19
- package/build/macros/Function.js.map +1 -1
- package/build/macros/Math.d.ts +5 -5
- package/build/macros/Math.js +56 -56
- package/build/macros/Math.js.map +1 -1
- package/build/macros/{Blocks.d.ts → Memory.d.ts} +5 -5
- package/build/macros/Memory.js +61 -0
- package/build/macros/Memory.js.map +1 -0
- package/build/macros/Namespace.d.ts +21 -0
- package/build/macros/Namespace.js +98 -0
- package/build/macros/Namespace.js.map +1 -0
- package/build/macros/Other.d.ts +5 -8
- package/build/macros/Other.js +19 -28
- package/build/macros/Other.js.map +1 -1
- package/build/macros/{Draw.d.ts → RawValue.d.ts} +5 -5
- package/build/macros/RawValue.js +16 -0
- package/build/macros/RawValue.js.map +1 -0
- package/build/macros/commands/Control.d.ts +5 -0
- package/build/macros/commands/Control.js +25 -0
- package/build/macros/commands/Control.js.map +1 -0
- package/build/macros/commands/Draw.d.ts +5 -0
- package/build/macros/{Draw.js → commands/Draw.js} +38 -33
- package/build/macros/commands/Draw.js.map +1 -0
- package/build/macros/commands/DrawFlush.d.ts +5 -0
- package/build/macros/commands/DrawFlush.js +17 -0
- package/build/macros/commands/DrawFlush.js.map +1 -0
- package/build/macros/commands/GetLink.d.ts +5 -0
- package/build/macros/commands/GetLink.js +21 -0
- package/build/macros/commands/GetLink.js.map +1 -0
- package/build/macros/commands/Lookup.d.ts +5 -0
- package/build/macros/commands/Lookup.js +24 -0
- package/build/macros/commands/Lookup.js.map +1 -0
- package/build/macros/commands/Print.d.ts +5 -0
- package/build/macros/commands/Print.js +14 -0
- package/build/macros/commands/Print.js.map +1 -0
- package/build/macros/commands/PrintFlush.d.ts +5 -0
- package/build/macros/commands/PrintFlush.js +17 -0
- package/build/macros/commands/PrintFlush.js.map +1 -0
- package/build/macros/commands/Radar.d.ts +7 -0
- package/build/macros/commands/Radar.js +61 -0
- package/build/macros/commands/Radar.js.map +1 -0
- package/build/macros/commands/Sensor.d.ts +5 -0
- package/build/macros/commands/Sensor.js +20 -0
- package/build/macros/commands/Sensor.js.map +1 -0
- package/build/macros/commands/UnitBind.d.ts +5 -0
- package/build/macros/commands/UnitBind.js +17 -0
- package/build/macros/commands/UnitBind.js.map +1 -0
- package/build/macros/commands/UnitControl.d.ts +5 -0
- package/build/macros/commands/UnitControl.js +68 -0
- package/build/macros/commands/UnitControl.js.map +1 -0
- package/build/macros/commands/UnitLocate.d.ts +5 -0
- package/build/macros/commands/UnitLocate.js +55 -0
- package/build/macros/commands/UnitLocate.js.map +1 -0
- package/build/macros/commands/UnitRadar.d.ts +5 -0
- package/build/macros/commands/UnitRadar.js +41 -0
- package/build/macros/commands/UnitRadar.js.map +1 -0
- package/build/macros/commands/Wait.d.ts +5 -0
- package/build/macros/commands/Wait.js +18 -0
- package/build/macros/commands/Wait.js.map +1 -0
- package/build/macros/commands/index.d.ts +14 -0
- package/build/macros/commands/index.js +33 -0
- package/build/macros/commands/index.js.map +1 -0
- package/build/macros/index.d.ts +7 -5
- package/build/macros/index.js +39 -17
- package/build/macros/index.js.map +1 -1
- package/build/operators.d.ts +25 -22
- package/build/operators.js +101 -38
- package/build/operators.js.map +1 -1
- package/build/types.d.ts +49 -49
- package/build/types.js +27 -23
- package/build/types.js.map +1 -1
- package/build/utils.d.ts +3 -2
- package/build/utils.js +12 -8
- package/build/utils.js.map +1 -1
- package/build/values/BaseValue.d.ts +5 -5
- package/build/values/BaseValue.js +111 -101
- package/build/values/BaseValue.js.map +1 -1
- package/build/values/FunctionValue.d.ts +34 -34
- package/build/values/FunctionValue.js +103 -100
- package/build/values/FunctionValue.js.map +1 -1
- package/build/values/LiteralValue.d.ts +12 -12
- package/build/values/LiteralValue.js +87 -88
- package/build/values/LiteralValue.js.map +1 -1
- package/build/values/ObjectValue.d.ts +17 -17
- package/build/values/ObjectValue.js +49 -49
- package/build/values/ObjectValue.js.map +1 -1
- package/build/values/StoreValue.d.ts +11 -11
- package/build/values/StoreValue.js +30 -30
- package/build/values/StoreValue.js.map +1 -1
- package/build/values/TempValue.d.ts +12 -12
- package/build/values/TempValue.js +66 -52
- package/build/values/TempValue.js.map +1 -1
- package/build/values/VoidValue.d.ts +11 -11
- package/build/values/VoidValue.js +30 -30
- package/build/values/VoidValue.js.map +1 -1
- package/build/values/index.d.ts +6 -6
- package/build/values/index.js +22 -18
- package/build/values/index.js.map +1 -1
- package/dist/mlogjs.es.js +6366 -0
- package/dist/mlogjs.umd.js +8 -0
- package/lib/commands.d.ts +326 -0
- package/lib/eslib/index.d.ts +3 -0
- package/lib/eslib/lib.d.ts +9 -0
- package/lib/eslib/lib.es2015.collection.d.ts +89 -0
- package/lib/eslib/lib.es2015.core.d.ts +16 -0
- package/lib/eslib/lib.es2015.d.ts +30 -0
- package/lib/eslib/lib.es2015.generator.d.ts +79 -0
- package/lib/eslib/lib.es2015.iterable.d.ts +70 -0
- package/lib/eslib/lib.es5.d.ts +295 -0
- package/lib/eslib/lib.es6.d.ts +18 -0
- package/lib/globals.d.ts +328 -0
- package/lib/helpers.d.ts +23 -0
- package/lib/index.d.ts +7 -0
- package/lib/kinds.d.ts +36 -0
- package/lib/memory.d.ts +17 -0
- package/lib/traits.d.ts +121 -0
- package/lib/util.d.ts +32 -0
- package/package.json +73 -37
- package/.gitattributes +0 -2
- package/build/macros/Blocks.js +0 -134
- package/build/macros/Blocks.js.map +0 -1
- package/build/macros/Draw.js.map +0 -1
- package/build/macros/TypeFactory.d.ts +0 -8
- package/build/macros/TypeFactory.js +0 -22
- package/build/macros/TypeFactory.js.map +0 -1
- package/build/scopes/FunctionScope.d.ts +0 -5
- package/build/scopes/FunctionScope.js +0 -13
- package/build/scopes/FunctionScope.js.map +0 -1
- package/build/scopes/LoopScope.d.ts +0 -5
- package/build/scopes/LoopScope.js +0 -13
- package/build/scopes/LoopScope.js.map +0 -1
- package/build/scopes/Scope.d.ts +0 -36
- package/build/scopes/Scope.js +0 -93
- package/build/scopes/Scope.js.map +0 -1
- package/build/scopes/index.d.ts +0 -3
- package/build/scopes/index.js +0 -16
- package/build/scopes/index.js.map +0 -1
- package/dist/bundle.js +0 -553
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -17
- package/docs/_coverpage.md +0 -8
- package/docs/_sidebar.md +0 -3
- package/docs/data-types.md +0 -56
- package/docs/getting-started.md +0 -19
- package/docs/index.html +0 -41
- package/docs/mlogjs.png +0 -0
- package/mlogjs.d.ts +0 -72
- package/tsconfig.json +0 -22
- package/webpack.config.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Object.js","sourceRoot":"","sources":["../../src/handlers/Object.ts"],"names":[],"mappings":";;;AAEA,sCAAsD;AAE/C,MAAM,gBAAgB,GAAa,
|
|
1
|
+
{"version":3,"file":"Object.js","sourceRoot":"","sources":["../../src/handlers/Object.ts"],"names":[],"mappings":";;;AAEA,sCAAsD;AAE/C,MAAM,gBAAgB,GAAa,CACxC,CAAC,EACD,KAAK,EACL,IAAyB,EACzB,EAAE;IACF,MAAM,IAAI,GAAG,EAAE,CAAC;IAChB,MAAM,IAAI,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAA2B,EAAE;QACnD,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACvE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAC5B,IAAI,KAAa,CAAC;QAClB,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY;YAAE,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC;aAC3C,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS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AAQ;QACpC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;QACpC,CAAC,CAAC,CAAC,IAAI,qBAAY,CAAC,KAAK,EAAG,IAAI,CAAC,QAA0B,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzE,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { THandler } from "../types";
|
|
2
|
-
export declare const LRExpression: THandler;
|
|
3
|
-
export declare const BinaryExpression: THandler;
|
|
4
|
-
export declare const LogicalExpression: THandler;
|
|
5
|
-
export declare const AssignmentExpression: THandler;
|
|
6
|
-
export declare const UnaryExpression: THandler;
|
|
7
|
-
export declare const UpdateExpression: THandler;
|
|
1
|
+
import { THandler } from "../types";
|
|
2
|
+
export declare const LRExpression: THandler;
|
|
3
|
+
export declare const BinaryExpression: THandler;
|
|
4
|
+
export declare const LogicalExpression: THandler;
|
|
5
|
+
export declare const AssignmentExpression: THandler;
|
|
6
|
+
export declare const UnaryExpression: THandler;
|
|
7
|
+
export declare const UpdateExpression: THandler;
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateExpression = exports.UnaryExpression = exports.AssignmentExpression = exports.LogicalExpression = exports.BinaryExpression = exports.LRExpression = void 0;
|
|
4
|
-
const LRExpression = (c, scope, node) => {
|
|
5
|
-
const [left, leftInst] = c.handleEval(scope, node.left);
|
|
6
|
-
const [right, rightInst] = c.handleEval(scope, node.right);
|
|
7
|
-
const [op, opInst] = left[node.operator](scope, right);
|
|
8
|
-
return [op, [...leftInst, ...rightInst, ...opInst]];
|
|
9
|
-
};
|
|
10
|
-
exports.LRExpression = LRExpression;
|
|
11
|
-
exports.BinaryExpression = exports.LRExpression;
|
|
12
|
-
exports.LogicalExpression = exports.LRExpression;
|
|
13
|
-
const AssignmentExpression = (c, scope, node) => {
|
|
14
|
-
const [left, leftInst] = c.handle(scope, node.left);
|
|
15
|
-
const [right, rightInst] = c.handleEval(scope, node.right);
|
|
16
|
-
const [op, opInst] = left[node.operator](scope, right);
|
|
17
|
-
return [op, [...leftInst, ...rightInst, ...opInst]];
|
|
18
|
-
};
|
|
19
|
-
exports.AssignmentExpression = AssignmentExpression;
|
|
20
|
-
const UnaryExpression = (c, scope, { argument, operator }) => {
|
|
21
|
-
const [arg, argInst] = c.handleEval(scope, argument);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateExpression = exports.UnaryExpression = exports.AssignmentExpression = exports.LogicalExpression = exports.BinaryExpression = exports.LRExpression = void 0;
|
|
4
|
+
const LRExpression = (c, scope, node) => {
|
|
5
|
+
const [left, leftInst] = c.handleEval(scope, node.left);
|
|
6
|
+
const [right, rightInst] = c.handleEval(scope, node.right);
|
|
7
|
+
const [op, opInst] = left[node.operator](scope, right);
|
|
8
|
+
return [op, [...leftInst, ...rightInst, ...opInst]];
|
|
9
|
+
};
|
|
10
|
+
exports.LRExpression = LRExpression;
|
|
11
|
+
exports.BinaryExpression = exports.LRExpression;
|
|
12
|
+
exports.LogicalExpression = exports.LRExpression;
|
|
13
|
+
const AssignmentExpression = (c, scope, node) => {
|
|
14
|
+
const [left, leftInst] = c.handle(scope, node.left);
|
|
15
|
+
const [right, rightInst] = c.handleEval(scope, node.right);
|
|
16
|
+
const [op, opInst] = left[node.operator](scope, right);
|
|
17
|
+
return [op, [...leftInst, ...rightInst, ...opInst]];
|
|
18
|
+
};
|
|
19
|
+
exports.AssignmentExpression = AssignmentExpression;
|
|
20
|
+
const UnaryExpression = (c, scope, { argument, operator }) => {
|
|
21
|
+
const [arg, argInst] = c.handleEval(scope, argument);
|
|
22
|
+
const operatorId = operator == "+" || operator == "-" ? "u" + operator : operator;
|
|
23
|
+
const [op, opInst] = arg[operatorId](scope);
|
|
24
|
+
return [op, [...argInst, ...opInst]];
|
|
25
|
+
};
|
|
26
|
+
exports.UnaryExpression = UnaryExpression;
|
|
27
|
+
const UpdateExpression = (c, scope, { argument, operator, prefix }) => {
|
|
28
|
+
const [arg, argInst] = c.handle(scope, argument);
|
|
29
|
+
const [op, opInst] = arg[operator](scope, prefix);
|
|
30
|
+
return [op, [...argInst, ...opInst]];
|
|
31
|
+
};
|
|
32
|
+
exports.UpdateExpression = UpdateExpression;
|
|
32
33
|
//# sourceMappingURL=OperationExpressions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationExpressions.js","sourceRoot":"","sources":["../../src/handlers/OperationExpressions.ts"],"names":[],"mappings":";;;AAUO,MAAM,YAAY,GAAa,
|
|
1
|
+
{"version":3,"file":"OperationExpressions.js","sourceRoot":"","sources":["../../src/handlers/OperationExpressions.ts"],"names":[],"mappings":";;;AAUO,MAAM,YAAY,GAAa,CACpC,CAAC,EACD,KAAK,EACL,IAIC,EACD,EAAE;IACF,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,CAAC,EAAE,EAAE,MAAM,C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AM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC;AAXW,QAAA,eAAe,mBAW1B;AACK,MAAM,gBAAgB,GAAa,CACxC,CAAC,EACD,KAAK,EACL,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAuB,EACnD,EAAE;IACF,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACjD,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { THandler } from "../types";
|
|
2
|
-
export declare const Program: THandler;
|
|
1
|
+
import { THandler } from "../types";
|
|
2
|
+
export declare const Program: THandler;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Program = void 0;
|
|
4
|
-
const Scope_1 = require("../Scope");
|
|
5
|
-
const Program = (c, scope, node) => {
|
|
6
|
-
return c.handleMany(scope
|
|
7
|
-
};
|
|
8
|
-
exports.Program = Program;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Program = void 0;
|
|
4
|
+
const Scope_1 = require("../Scope");
|
|
5
|
+
const Program = (c, scope, node) => {
|
|
6
|
+
return c.handleMany(scope ?? new Scope_1.Scope({}), node.body);
|
|
7
|
+
};
|
|
8
|
+
exports.Program = Program;
|
|
9
9
|
//# sourceMappingURL=Program.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Program.js","sourceRoot":"","sources":["../../src/handlers/Program.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AAG1B,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"Program.js","sourceRoot":"","sources":["../../src/handlers/Program.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AAG1B,MAAM,OAAO,GAAa,CAAC,CAAC,EAAE,KAAK,EAAE,IAAgB,EAAE,EAAE;IAC9D,OAAO,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,IAAI,aAAK,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { THandler } from "../types";
|
|
2
|
-
export declare const ExpressionStatement: THandler;
|
|
3
|
-
export declare const BreakStatement: THandler;
|
|
4
|
-
export declare const ContinueStatement: THandler;
|
|
5
|
-
export declare const ReturnStatement: THandler;
|
|
1
|
+
import { THandler } from "../types";
|
|
2
|
+
export declare const ExpressionStatement: THandler;
|
|
3
|
+
export declare const BreakStatement: THandler;
|
|
4
|
+
export declare const ContinueStatement: THandler;
|
|
5
|
+
export declare const ReturnStatement: THandler;
|
|
@@ -1,28 +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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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;
|
|
28
30
|
//# sourceMappingURL=Statements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Statements.js","sourceRoot":"","sources":["../../src/handlers/Statements.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Statements.js","sourceRoot":"","sources":["../../src/handlers/Statements.ts"],"names":[],"mappings":";;;AAAA,kDAAwE;AAExE,sCAAyC;AAElC,MAAM,mBAAmB,GAAa,CAC3C,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,GAAa,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;IACnD,MAAM,IAAI,GAAG,IAAI,qBAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3C,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,GAAa,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;IACtD,MAAM,IAAI,GAAG,IAAI,qBAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3C,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,GAAa,CACvC,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,2 +1,2 @@
|
|
|
1
|
-
import { THandler } from "../types";
|
|
2
|
-
export declare const TemplateLiteral: THandler;
|
|
1
|
+
import { THandler } from "../types";
|
|
2
|
+
export declare const TemplateLiteral: THandler;
|
|
@@ -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;AAShD,MAAM,eAAe,GAAa,CACvC,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,3 +1,3 @@
|
|
|
1
|
-
import { THandler } from "../types";
|
|
2
|
-
export declare const VariableDeclaration: THandler;
|
|
3
|
-
export declare const VariableDeclarator: THandler;
|
|
1
|
+
import { THandler } from "../types";
|
|
2
|
+
export declare const VariableDeclaration: THandler;
|
|
3
|
+
export declare const VariableDeclarator: THandler;
|
|
@@ -1,32 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VariableDeclarator = exports.VariableDeclaration = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
const VariableDeclaration = (c, scope, node) => {
|
|
6
|
-
return c.handleMany(scope, node.declarations, (scope, child) => exports.VariableDeclarator(c, scope, child, node.kind));
|
|
7
|
-
};
|
|
8
|
-
exports.VariableDeclaration = VariableDeclaration;
|
|
9
|
-
const VariableDeclarator = (c, scope, node, kind = "let") => {
|
|
10
|
-
let valinst = node.init
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VariableDeclarator = exports.VariableDeclaration = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const VariableDeclaration = (c, scope, node) => {
|
|
6
|
+
return c.handleMany(scope, node.declarations, (scope, child) => (0, exports.VariableDeclarator)(c, scope, child, node.kind));
|
|
7
|
+
};
|
|
8
|
+
exports.VariableDeclaration = VariableDeclaration;
|
|
9
|
+
const VariableDeclarator = (c, scope, node, kind = "let") => {
|
|
10
|
+
let valinst = node.init
|
|
11
|
+
? c.handleEval(scope, node.init)
|
|
12
|
+
: [null, []];
|
|
13
|
+
switch (node.id.type) {
|
|
14
|
+
case "Identifier": {
|
|
15
|
+
const { name } = node.id;
|
|
16
|
+
const [init] = valinst;
|
|
17
|
+
if (kind === "const" && !init)
|
|
18
|
+
throw Error("Cannot create constant with void value.");
|
|
19
|
+
if (kind === "const" && init.constant) {
|
|
20
|
+
scope.set(name, init);
|
|
21
|
+
return valinst;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const value = scope.make(name, (0, utils_1.nodeName)(node));
|
|
25
|
+
if (init) {
|
|
26
|
+
if (init.macro)
|
|
27
|
+
throw new Error("Macro value must be constant.");
|
|
28
|
+
valinst[1].push(...value["="](scope, valinst[0])[1]);
|
|
29
|
+
}
|
|
30
|
+
if (kind === "const")
|
|
31
|
+
value.constant = true;
|
|
32
|
+
return valinst;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
case "ArrayPattern": {
|
|
36
|
+
const { elements } = node.id;
|
|
37
|
+
const [init] = valinst;
|
|
38
|
+
if (!init)
|
|
39
|
+
throw new Error("Cannot use array destructuring with constant with void value.");
|
|
40
|
+
if (!init.macro)
|
|
41
|
+
throw new Error("Cannot use array destructuring on non macro values");
|
|
42
|
+
for (let i = 0; i < elements.length; i++) {
|
|
43
|
+
const element = elements[i];
|
|
44
|
+
if (!element)
|
|
45
|
+
continue;
|
|
46
|
+
const val = init.data[i];
|
|
47
|
+
scope.set(element.name, val);
|
|
48
|
+
}
|
|
49
|
+
return valinst;
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
throw new Error("");
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.VariableDeclarator = VariableDeclarator;
|
|
32
56
|
//# 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":";;;AAEA,oCAAoC;AAE7B,MAAM,mBAAmB,GAAa,CAC3C,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,KAA8B,EAAE,IAAI,CAAC,IAAI,CAAC,CACxE,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AAEK,MAAM,kBAAkB,GAAa,CAC1C,CAAC,EACD,KAAK,EACL,IAA2B,EAC3B,OAAgC,KAAK,EACrC,EAAE;IACF,IAAI,OAAO,GAAuB,IAAI,CAAC,IAAI;QACzC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC;QAChC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACf,QAAQ,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE;QACpB,KAAK,YAAY,CAAC,CAAC;YACjB,MAAM,E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EAAE;gBACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAkB,CAAC;gBAE7C,IAAI,CAAC,OAAO;oBAAE,SAAS;gBACvB,MAAM,GAAG,GAAI,IAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1C,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC9B;YACD,OAAO,OAAO,CAAC;SAChB;QACD;YACE,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;KACvB;AACH,CAAC,CAAC;AAlDW,QAAA,kBAAkB,sBAkD7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { THandler } from "../types";
|
|
2
|
-
export declare const WhileStatement: THandler;
|
|
1
|
+
import { THandler } from "../types";
|
|
2
|
+
export declare const WhileStatement: THandler;
|
|
@@ -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":";;;
|
|
1
|
+
{"version":3,"file":"WhileStatement.js","sourceRoot":"","sources":["../../src/handlers/WhileStatement.ts"],"names":[],"mappings":";;;AAAA,kDAA8E;AAE9E,sCAAyC;AAElC,MAAM,cAAc,GAAa,CAAC,CAAC,EAAE,KAAK,EAAE,IAAuB,EAAE,EAAE;IAC5E,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEzD,MAAM,aAAa,GAAG,IAAI,qBAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,qBAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,IAAI,8BAAe,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7E,MAAM,WAAW,GAAG,IAAI,8BAAe,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAEtE,IAAI,IAAI,YAAY,qBAAY,EAAE;QAChC,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,KAAK,CAAC,IAAI,CACR,aAAa,EACb,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAChC,IAAI,8BAAe,CAAC,aAAa,EAAE,wBAAS,CAAC,MAAM,CAAC,EACpD,WAAW,CACZ,CAAC;SACH;QACD,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KACtB;IAED,KAAK,CAAC,IAAI,CACR,aAAa,EACb,GAAG,SAAS,EACZ,IAAI,8BAAe,CACjB,WAAW,EACX,wBAAS,CAAC,KAAK,EACf,IAAI,EACJ,IAAI,qBAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAC3B,EACD,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAChC,IAAI,8BAAe,CAAC,aAAa,EAAE,wBAAS,CAAC,MAAM,CAAC,EACpD,WAAW,CACZ,CAAC;IACF,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACvB,CAAC,CAAC;AAnCW,QAAA,cAAc,kBAmCzB"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from "./Program";
|
|
2
|
-
export * from "./VariableDeclaration";
|
|
3
|
-
export * from "./Literal";
|
|
4
|
-
export * from "./OperationExpressions";
|
|
5
|
-
export * from "./Identifier";
|
|
6
|
-
export * from "./Statements";
|
|
7
|
-
export * from "./IfStatement";
|
|
8
|
-
export * from "./WhileStatement";
|
|
9
|
-
export * from "./ForStatement";
|
|
10
|
-
export * from "./Function";
|
|
11
|
-
export * from "./CallExpression";
|
|
12
|
-
export * from "./Object";
|
|
13
|
-
export * from "./TemplateExpression";
|
|
14
|
-
export * from "./BlockStatement";
|
|
1
|
+
export * from "./Program";
|
|
2
|
+
export * from "./VariableDeclaration";
|
|
3
|
+
export * from "./Literal";
|
|
4
|
+
export * from "./OperationExpressions";
|
|
5
|
+
export * from "./Identifier";
|
|
6
|
+
export * from "./Statements";
|
|
7
|
+
export * from "./IfStatement";
|
|
8
|
+
export * from "./WhileStatement";
|
|
9
|
+
export * from "./ForStatement";
|
|
10
|
+
export * from "./Function";
|
|
11
|
+
export * from "./CallExpression";
|
|
12
|
+
export * from "./Object";
|
|
13
|
+
export * from "./TemplateExpression";
|
|
14
|
+
export * from "./BlockStatement";
|
package/build/handlers/index.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
__exportStar(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
__exportStar(require("./
|
|
25
|
-
__exportStar(require("./
|
|
26
|
-
__exportStar(require("./
|
|
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);
|
|
27
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"
|
|
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"}
|
package/build/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const compile: (script: string) => string;
|
|
1
|
+
export declare const compile: (script: string) => [string, Error, import("estree").Node[]];
|
package/build/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compile = void 0;
|
|
4
|
-
const Compiler_1 = require("./Compiler");
|
|
5
|
-
const compiler = new Compiler_1.Compiler();
|
|
6
|
-
const compile = (script) => compiler.compile(script);
|
|
7
|
-
exports.compile = compile;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compile = void 0;
|
|
4
|
+
const Compiler_1 = require("./Compiler");
|
|
5
|
+
const compiler = new Compiler_1.Compiler();
|
|
6
|
+
const compile = (script) => compiler.compile(script);
|
|
7
|
+
exports.compile = compile;
|
|
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,yCAAsC;AACtC,MAAM,QAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;AACzB,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAAvD,QAAA,OAAO,WAAgD"}
|