mlogjs 0.2.0 → 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 -119
- 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 +60 -41
- 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/CallExpression.d.ts +3 -3
- package/build/handlers/CallExpression.js +19 -19
- package/build/handlers/ForStatement.d.ts +2 -2
- package/build/handlers/ForStatement.js +31 -31
- package/build/handlers/Function.d.ts +4 -4
- package/build/handlers/Function.js +35 -35
- package/build/handlers/Identifier.d.ts +2 -2
- package/build/handlers/Identifier.js +7 -7
- package/build/handlers/IfStatement.d.ts +2 -2
- package/build/handlers/IfStatement.js +24 -24
- package/build/handlers/Literal.d.ts +2 -2
- package/build/handlers/Literal.js +17 -17
- package/build/handlers/Object.d.ts +4 -4
- package/build/handlers/Object.js +43 -43
- package/build/handlers/OperationExpressions.d.ts +7 -7
- package/build/handlers/OperationExpressions.js +32 -32
- 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 -29
- package/build/handlers/TemplateExpression.d.ts +2 -2
- package/build/handlers/TemplateExpression.js +17 -17
- package/build/handlers/VariableDeclaration.d.ts +3 -3
- package/build/handlers/VariableDeclaration.js +55 -55
- package/build/handlers/WhileStatement.d.ts +2 -2
- package/build/handlers/WhileStatement.js +22 -22
- package/build/handlers/index.d.ts +14 -14
- package/build/handlers/index.js +30 -30
- package/build/index.d.ts +1 -1
- package/build/index.js +7 -7
- 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 -30
- package/build/instructions/ControlInstructions.d.ts +11 -11
- package/build/instructions/ControlInstructions.js +22 -22
- package/build/instructions/EndInstruction.d.ts +4 -4
- package/build/instructions/EndInstruction.js +10 -10
- package/build/instructions/InstructionBase.d.ts +10 -10
- package/build/instructions/InstructionBase.js +20 -20
- package/build/instructions/JumpInstruction.d.ts +15 -15
- package/build/instructions/JumpInstruction.js +21 -21
- package/build/instructions/OperationInstruction.d.ts +5 -5
- package/build/instructions/OperationInstruction.js +10 -10
- package/build/instructions/SetCounterInstruction.d.ts +5 -5
- package/build/instructions/SetCounterInstruction.js +10 -10
- package/build/instructions/SetInstruction.d.ts +5 -5
- package/build/instructions/SetInstruction.js +10 -10
- package/build/instructions/ZeroSpaceInstruction.d.ts +4 -4
- package/build/instructions/ZeroSpaceInstruction.js +10 -10
- package/build/instructions/index.d.ts +9 -9
- package/build/instructions/index.js +25 -25
- package/build/macros/Building.d.ts +11 -11
- package/build/macros/Building.js +80 -80
- package/build/macros/Function.d.ts +12 -12
- package/build/macros/Function.js +19 -19
- 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/Memory.d.ts +5 -5
- package/build/macros/Memory.js +60 -60
- package/build/macros/Namespace.d.ts +21 -21
- package/build/macros/Namespace.js +97 -97
- package/build/macros/Other.d.ts +5 -5
- package/build/macros/Other.js +19 -19
- package/build/macros/RawValue.d.ts +5 -5
- package/build/macros/RawValue.js +15 -15
- package/build/macros/commands/{control.d.ts → Control.d.ts} +5 -5
- package/build/macros/commands/{control.js → Control.js} +24 -24
- package/build/macros/commands/{control.js.map → Control.js.map} +0 -0
- package/build/macros/commands/Draw.d.ts +5 -5
- package/build/macros/commands/Draw.js +38 -38
- package/build/macros/commands/DrawFlush.d.ts +5 -5
- package/build/macros/commands/DrawFlush.js +16 -16
- package/build/macros/commands/GetLink.d.ts +5 -5
- package/build/macros/commands/GetLink.js +20 -20
- package/build/macros/commands/Lookup.d.ts +5 -5
- package/build/macros/commands/Lookup.js +23 -23
- package/build/macros/commands/Print.d.ts +5 -5
- package/build/macros/commands/Print.js +13 -13
- package/build/macros/commands/PrintFlush.d.ts +5 -5
- package/build/macros/commands/PrintFlush.js +16 -16
- package/build/macros/commands/Radar.d.ts +7 -7
- package/build/macros/commands/Radar.js +60 -60
- package/build/macros/commands/Sensor.d.ts +5 -5
- package/build/macros/commands/Sensor.js +19 -19
- package/build/macros/commands/UnitBind.d.ts +5 -5
- package/build/macros/commands/UnitBind.js +16 -16
- package/build/macros/commands/UnitControl.d.ts +5 -5
- package/build/macros/commands/UnitControl.js +67 -67
- package/build/macros/commands/UnitLocate.d.ts +5 -5
- package/build/macros/commands/UnitLocate.js +54 -54
- package/build/macros/commands/UnitRadar.d.ts +5 -5
- package/build/macros/commands/UnitRadar.js +40 -40
- package/build/macros/commands/Wait.d.ts +5 -5
- package/build/macros/commands/Wait.js +17 -17
- package/build/macros/commands/index.d.ts +14 -14
- package/build/macros/commands/index.js +32 -32
- package/build/macros/index.d.ts +7 -7
- package/build/macros/index.js +39 -39
- package/build/operators.d.ts +25 -25
- package/build/operators.js +101 -101
- package/build/types.d.ts +49 -49
- package/build/types.js +27 -27
- package/build/utils.d.ts +3 -3
- package/build/utils.js +12 -12
- package/build/values/BaseValue.d.ts +5 -5
- package/build/values/BaseValue.js +111 -111
- package/build/values/FunctionValue.d.ts +34 -34
- package/build/values/FunctionValue.js +103 -103
- package/build/values/LiteralValue.d.ts +12 -12
- package/build/values/LiteralValue.js +87 -87
- 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/StoreValue.d.ts +11 -11
- package/build/values/StoreValue.js +30 -30
- package/build/values/TempValue.d.ts +12 -12
- package/build/values/TempValue.js +66 -66
- 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/index.d.ts +6 -6
- package/build/values/index.js +22 -22
- package/dist/mlogjs.es.js +6366 -0
- package/dist/mlogjs.umd.js +8 -0
- package/lib/commands.d.ts +326 -326
- package/lib/eslib/index.d.ts +3 -3
- package/lib/eslib/lib.d.ts +9 -9
- package/lib/eslib/lib.es2015.collection.d.ts +89 -89
- package/lib/eslib/lib.es2015.core.d.ts +16 -16
- package/lib/eslib/lib.es2015.d.ts +30 -30
- package/lib/eslib/lib.es2015.generator.d.ts +79 -79
- package/lib/eslib/lib.es2015.iterable.d.ts +70 -70
- package/lib/eslib/lib.es5.d.ts +295 -295
- package/lib/eslib/lib.es6.d.ts +18 -18
- package/lib/globals.d.ts +328 -328
- package/lib/helpers.d.ts +23 -23
- package/lib/index.d.ts +7 -7
- package/lib/kinds.d.ts +36 -36
- package/lib/memory.d.ts +17 -17
- package/lib/traits.d.ts +121 -121
- package/lib/util.d.ts +32 -32
- package/package.json +73 -48
- package/build/macros/Blocks.d.ts +0 -5
- package/build/macros/Blocks.js +0 -143
- package/build/macros/Blocks.js.map +0 -1
- package/build/macros/Draw.d.ts +0 -5
- package/build/macros/Draw.js +0 -39
- package/build/macros/Draw.js.map +0 -1
- package/build/macros/Items.d.ts +0 -5
- package/build/macros/Items.js +0 -20
- package/build/macros/Items.js.map +0 -1
- package/build/macros/Liquids.d.ts +0 -5
- package/build/macros/Liquids.js +0 -18
- package/build/macros/Liquids.js.map +0 -1
- package/build/macros/Symbol.d.ts +0 -0
- package/build/macros/Symbol.js +0 -1
- package/build/macros/Symbol.js.map +0 -1
- package/build/macros/SymbolNamespace.d.ts +0 -0
- package/build/macros/SymbolNamespace.js +0 -1
- package/build/macros/SymbolNamespace.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/macros/Units.d.ts +0 -5
- package/build/macros/Units.js +0 -18
- package/build/macros/Units.js.map +0 -1
- package/build/macros/Vars.d.ts +0 -5
- package/build/macros/Vars.js +0 -18
- package/build/macros/Vars.js.map +0 -1
- package/build/macros/commands/Asm.d.ts +0 -5
- package/build/macros/commands/Asm.js +0 -21
- package/build/macros/commands/Asm.js.map +0 -1
- package/build/macros/commands/io.d.ts +0 -8
- package/build/macros/commands/io.js +0 -47
- package/build/macros/commands/io.js.map +0 -1
- package/build/macros/helpers/GetBuilding.d.ts +0 -5
- package/build/macros/helpers/GetBuilding.js +0 -16
- package/build/macros/helpers/GetBuilding.js.map +0 -1
- package/build/macros/helpers/GetVar.d.ts +0 -5
- package/build/macros/helpers/GetVar.js +0 -16
- package/build/macros/helpers/GetVar.js.map +0 -1
- package/build/macros/helpers/index.d.ts +0 -2
- package/build/macros/helpers/index.js +0 -15
- package/build/macros/helpers/index.js.map +0 -1
- package/dist/bundle.js +0 -1
package/build/operators.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export declare const arithmeticBinaryOperators: readonly ["*", "**", "+", "-", "/", "%"];
|
|
2
|
-
export declare const comparisonBinaryOperators: readonly ["!=", "!==", "<", "<=", "==", "===", ">", ">="];
|
|
3
|
-
export declare const bitwiseBinaryOperators: readonly ["&", "<<", ">>", ">>>", "^", "|"];
|
|
4
|
-
export declare const binaryOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in"];
|
|
5
|
-
export declare type BinaryOperator = typeof binaryOperators[number];
|
|
6
|
-
export declare const logicalOperators: readonly ["&&", "??", "||"];
|
|
7
|
-
export declare type LogicalOperator = typeof logicalOperators[number];
|
|
8
|
-
export declare const arithmeticAssignmentOperators: readonly ["%=", "&=", "*=", "**=", "+=", "-=", "/="];
|
|
9
|
-
export declare const logicalAssignmentOperators: readonly ["&&=", "||="];
|
|
10
|
-
export declare const bitwiseAssignmentOperators: readonly ["<<=", ">>=", ">>>=", "^=", "|="];
|
|
11
|
-
export declare const assignmentOperators: readonly ["%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
|
|
12
|
-
export declare type AssignementOperator = typeof assignmentOperators[number];
|
|
13
|
-
export declare const leftRightOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
|
|
14
|
-
export declare type LeftRightOperator = typeof leftRightOperators[number];
|
|
15
|
-
export declare const unaryOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~"];
|
|
16
|
-
export declare type UnaryOperator = typeof unaryOperators[number];
|
|
17
|
-
export declare const updateOperators: readonly ["++", "--"];
|
|
18
|
-
export declare type UpdateOperator = typeof updateOperators[number];
|
|
19
|
-
export declare const singleOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
|
|
20
|
-
export declare type SingleOperator = typeof singleOperators[number];
|
|
21
|
-
export declare const operators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "=", "!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
|
|
22
|
-
export declare type Operator = typeof operators[number];
|
|
23
|
-
export declare const operatorMap: {
|
|
24
|
-
[k in BinaryOperator | LogicalOperator]?: string;
|
|
25
|
-
};
|
|
1
|
+
export declare const arithmeticBinaryOperators: readonly ["*", "**", "+", "-", "/", "%"];
|
|
2
|
+
export declare const comparisonBinaryOperators: readonly ["!=", "!==", "<", "<=", "==", "===", ">", ">="];
|
|
3
|
+
export declare const bitwiseBinaryOperators: readonly ["&", "<<", ">>", ">>>", "^", "|"];
|
|
4
|
+
export declare const binaryOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in"];
|
|
5
|
+
export declare type BinaryOperator = typeof binaryOperators[number];
|
|
6
|
+
export declare const logicalOperators: readonly ["&&", "??", "||"];
|
|
7
|
+
export declare type LogicalOperator = typeof logicalOperators[number];
|
|
8
|
+
export declare const arithmeticAssignmentOperators: readonly ["%=", "&=", "*=", "**=", "+=", "-=", "/="];
|
|
9
|
+
export declare const logicalAssignmentOperators: readonly ["&&=", "||="];
|
|
10
|
+
export declare const bitwiseAssignmentOperators: readonly ["<<=", ">>=", ">>>=", "^=", "|="];
|
|
11
|
+
export declare const assignmentOperators: readonly ["%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
|
|
12
|
+
export declare type AssignementOperator = typeof assignmentOperators[number];
|
|
13
|
+
export declare const leftRightOperators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "="];
|
|
14
|
+
export declare type LeftRightOperator = typeof leftRightOperators[number];
|
|
15
|
+
export declare const unaryOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~"];
|
|
16
|
+
export declare type UnaryOperator = typeof unaryOperators[number];
|
|
17
|
+
export declare const updateOperators: readonly ["++", "--"];
|
|
18
|
+
export declare type UpdateOperator = typeof updateOperators[number];
|
|
19
|
+
export declare const singleOperators: readonly ["!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
|
|
20
|
+
export declare type SingleOperator = typeof singleOperators[number];
|
|
21
|
+
export declare const operators: readonly ["*", "**", "+", "-", "/", "%", "!=", "!==", "<", "<=", "==", "===", ">", ">=", "&", "<<", ">>", ">>>", "^", "|", "instanceof", "in", "&&", "??", "||", "%=", "&=", "*=", "**=", "+=", "-=", "/=", "&&=", "||=", "<<=", ">>=", ">>>=", "^=", "|=", "=", "!", "u+", "u-", "delete", "typeof", "void", "~", "++", "--"];
|
|
22
|
+
export declare type Operator = typeof operators[number];
|
|
23
|
+
export declare const operatorMap: {
|
|
24
|
+
[k in BinaryOperator | LogicalOperator]?: string;
|
|
25
|
+
};
|
package/build/operators.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.operatorMap = exports.operators = exports.singleOperators = exports.updateOperators = exports.unaryOperators = exports.leftRightOperators = exports.assignmentOperators = exports.bitwiseAssignmentOperators = exports.logicalAssignmentOperators = exports.arithmeticAssignmentOperators = exports.logicalOperators = exports.binaryOperators = exports.bitwiseBinaryOperators = exports.comparisonBinaryOperators = exports.arithmeticBinaryOperators = void 0;
|
|
4
|
-
exports.arithmeticBinaryOperators = [
|
|
5
|
-
"*",
|
|
6
|
-
"**",
|
|
7
|
-
"+",
|
|
8
|
-
"-",
|
|
9
|
-
"/",
|
|
10
|
-
"%",
|
|
11
|
-
];
|
|
12
|
-
exports.comparisonBinaryOperators = [
|
|
13
|
-
"!=",
|
|
14
|
-
"!==",
|
|
15
|
-
"<",
|
|
16
|
-
"<=",
|
|
17
|
-
"==",
|
|
18
|
-
"===",
|
|
19
|
-
">",
|
|
20
|
-
">=",
|
|
21
|
-
];
|
|
22
|
-
exports.bitwiseBinaryOperators = [
|
|
23
|
-
"&",
|
|
24
|
-
"<<",
|
|
25
|
-
">>",
|
|
26
|
-
">>>",
|
|
27
|
-
"^",
|
|
28
|
-
"|",
|
|
29
|
-
];
|
|
30
|
-
exports.binaryOperators = [
|
|
31
|
-
...exports.arithmeticBinaryOperators,
|
|
32
|
-
...exports.comparisonBinaryOperators,
|
|
33
|
-
...exports.bitwiseBinaryOperators,
|
|
34
|
-
"instanceof",
|
|
35
|
-
"in",
|
|
36
|
-
];
|
|
37
|
-
exports.logicalOperators = ["&&", "??", "||"];
|
|
38
|
-
exports.arithmeticAssignmentOperators = [
|
|
39
|
-
"%=",
|
|
40
|
-
"&=",
|
|
41
|
-
"*=",
|
|
42
|
-
"**=",
|
|
43
|
-
"+=",
|
|
44
|
-
"-=",
|
|
45
|
-
"/=",
|
|
46
|
-
];
|
|
47
|
-
exports.logicalAssignmentOperators = ["&&=", "||="];
|
|
48
|
-
exports.bitwiseAssignmentOperators = [
|
|
49
|
-
"<<=",
|
|
50
|
-
">>=",
|
|
51
|
-
">>>=",
|
|
52
|
-
"^=",
|
|
53
|
-
"|=",
|
|
54
|
-
];
|
|
55
|
-
exports.assignmentOperators = [
|
|
56
|
-
...exports.arithmeticAssignmentOperators,
|
|
57
|
-
...exports.logicalAssignmentOperators,
|
|
58
|
-
...exports.bitwiseAssignmentOperators,
|
|
59
|
-
"=",
|
|
60
|
-
];
|
|
61
|
-
exports.leftRightOperators = [
|
|
62
|
-
...exports.binaryOperators,
|
|
63
|
-
...exports.logicalOperators,
|
|
64
|
-
...exports.assignmentOperators,
|
|
65
|
-
];
|
|
66
|
-
exports.unaryOperators = [
|
|
67
|
-
"!",
|
|
68
|
-
"u+",
|
|
69
|
-
"u-",
|
|
70
|
-
"delete",
|
|
71
|
-
"typeof",
|
|
72
|
-
"void",
|
|
73
|
-
"~",
|
|
74
|
-
];
|
|
75
|
-
exports.updateOperators = ["++", "--"];
|
|
76
|
-
exports.singleOperators = [...exports.unaryOperators, ...exports.updateOperators];
|
|
77
|
-
exports.operators = [...exports.leftRightOperators, ...exports.singleOperators];
|
|
78
|
-
exports.operatorMap = {
|
|
79
|
-
"==": "equal",
|
|
80
|
-
"===": "strictEqual",
|
|
81
|
-
"!=": "notEqual",
|
|
82
|
-
"!==": "notEqual",
|
|
83
|
-
"<": "lessThan",
|
|
84
|
-
">": "greaterThan",
|
|
85
|
-
"<=": "lessThanEq",
|
|
86
|
-
">=": "greaterThanEq",
|
|
87
|
-
"+": "add",
|
|
88
|
-
"-": "sub",
|
|
89
|
-
"*": "mul",
|
|
90
|
-
"/": "div",
|
|
91
|
-
"%": "mod",
|
|
92
|
-
"**": "pow",
|
|
93
|
-
"|": "or",
|
|
94
|
-
"&": "and",
|
|
95
|
-
"^": "xor",
|
|
96
|
-
">>": "shr",
|
|
97
|
-
">>>": "shr",
|
|
98
|
-
"<<": "shl",
|
|
99
|
-
"&&": "land",
|
|
100
|
-
"||": "or",
|
|
101
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operatorMap = exports.operators = exports.singleOperators = exports.updateOperators = exports.unaryOperators = exports.leftRightOperators = exports.assignmentOperators = exports.bitwiseAssignmentOperators = exports.logicalAssignmentOperators = exports.arithmeticAssignmentOperators = exports.logicalOperators = exports.binaryOperators = exports.bitwiseBinaryOperators = exports.comparisonBinaryOperators = exports.arithmeticBinaryOperators = void 0;
|
|
4
|
+
exports.arithmeticBinaryOperators = [
|
|
5
|
+
"*",
|
|
6
|
+
"**",
|
|
7
|
+
"+",
|
|
8
|
+
"-",
|
|
9
|
+
"/",
|
|
10
|
+
"%",
|
|
11
|
+
];
|
|
12
|
+
exports.comparisonBinaryOperators = [
|
|
13
|
+
"!=",
|
|
14
|
+
"!==",
|
|
15
|
+
"<",
|
|
16
|
+
"<=",
|
|
17
|
+
"==",
|
|
18
|
+
"===",
|
|
19
|
+
">",
|
|
20
|
+
">=",
|
|
21
|
+
];
|
|
22
|
+
exports.bitwiseBinaryOperators = [
|
|
23
|
+
"&",
|
|
24
|
+
"<<",
|
|
25
|
+
">>",
|
|
26
|
+
">>>",
|
|
27
|
+
"^",
|
|
28
|
+
"|",
|
|
29
|
+
];
|
|
30
|
+
exports.binaryOperators = [
|
|
31
|
+
...exports.arithmeticBinaryOperators,
|
|
32
|
+
...exports.comparisonBinaryOperators,
|
|
33
|
+
...exports.bitwiseBinaryOperators,
|
|
34
|
+
"instanceof",
|
|
35
|
+
"in",
|
|
36
|
+
];
|
|
37
|
+
exports.logicalOperators = ["&&", "??", "||"];
|
|
38
|
+
exports.arithmeticAssignmentOperators = [
|
|
39
|
+
"%=",
|
|
40
|
+
"&=",
|
|
41
|
+
"*=",
|
|
42
|
+
"**=",
|
|
43
|
+
"+=",
|
|
44
|
+
"-=",
|
|
45
|
+
"/=",
|
|
46
|
+
];
|
|
47
|
+
exports.logicalAssignmentOperators = ["&&=", "||="];
|
|
48
|
+
exports.bitwiseAssignmentOperators = [
|
|
49
|
+
"<<=",
|
|
50
|
+
">>=",
|
|
51
|
+
">>>=",
|
|
52
|
+
"^=",
|
|
53
|
+
"|=",
|
|
54
|
+
];
|
|
55
|
+
exports.assignmentOperators = [
|
|
56
|
+
...exports.arithmeticAssignmentOperators,
|
|
57
|
+
...exports.logicalAssignmentOperators,
|
|
58
|
+
...exports.bitwiseAssignmentOperators,
|
|
59
|
+
"=",
|
|
60
|
+
];
|
|
61
|
+
exports.leftRightOperators = [
|
|
62
|
+
...exports.binaryOperators,
|
|
63
|
+
...exports.logicalOperators,
|
|
64
|
+
...exports.assignmentOperators,
|
|
65
|
+
];
|
|
66
|
+
exports.unaryOperators = [
|
|
67
|
+
"!",
|
|
68
|
+
"u+",
|
|
69
|
+
"u-",
|
|
70
|
+
"delete",
|
|
71
|
+
"typeof",
|
|
72
|
+
"void",
|
|
73
|
+
"~",
|
|
74
|
+
];
|
|
75
|
+
exports.updateOperators = ["++", "--"];
|
|
76
|
+
exports.singleOperators = [...exports.unaryOperators, ...exports.updateOperators];
|
|
77
|
+
exports.operators = [...exports.leftRightOperators, ...exports.singleOperators];
|
|
78
|
+
exports.operatorMap = {
|
|
79
|
+
"==": "equal",
|
|
80
|
+
"===": "strictEqual",
|
|
81
|
+
"!=": "notEqual",
|
|
82
|
+
"!==": "notEqual",
|
|
83
|
+
"<": "lessThan",
|
|
84
|
+
">": "greaterThan",
|
|
85
|
+
"<=": "lessThanEq",
|
|
86
|
+
">=": "greaterThanEq",
|
|
87
|
+
"+": "add",
|
|
88
|
+
"-": "sub",
|
|
89
|
+
"*": "mul",
|
|
90
|
+
"/": "div",
|
|
91
|
+
"%": "mod",
|
|
92
|
+
"**": "pow",
|
|
93
|
+
"|": "or",
|
|
94
|
+
"&": "and",
|
|
95
|
+
"^": "xor",
|
|
96
|
+
">>": "shr",
|
|
97
|
+
">>>": "shr",
|
|
98
|
+
"<<": "shl",
|
|
99
|
+
"&&": "land",
|
|
100
|
+
"||": "or",
|
|
101
|
+
};
|
|
102
102
|
//# sourceMappingURL=operators.js.map
|
package/build/types.d.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
export * as es from "estree";
|
|
2
|
-
import { Compiler } from "./Compiler";
|
|
3
|
-
import { AddressResolver } from "./instructions";
|
|
4
|
-
import { LeftRightOperator, UnaryOperator, UpdateOperator } from "./operators";
|
|
5
|
-
export interface IInstruction {
|
|
6
|
-
hidden: boolean;
|
|
7
|
-
resolve(i: number): void;
|
|
8
|
-
}
|
|
9
|
-
export declare type THandler = (compiler: Compiler, scope: IScope, node: any, arg: any) => TValueInstructions;
|
|
10
|
-
export interface IScope {
|
|
11
|
-
parent: IScope;
|
|
12
|
-
data: {};
|
|
13
|
-
name: string;
|
|
14
|
-
inst: IInstruction[];
|
|
15
|
-
break: AddressResolver;
|
|
16
|
-
continue: AddressResolver;
|
|
17
|
-
function: IFunctionValue;
|
|
18
|
-
ntemp: number;
|
|
19
|
-
createScope(): IScope;
|
|
20
|
-
createFunction(name: string, stacked?: boolean): IScope;
|
|
21
|
-
has(name: string): boolean;
|
|
22
|
-
get(name: string): IValue;
|
|
23
|
-
set(name: string, value: IValue): IValue;
|
|
24
|
-
hardSet(name: string, value: IValue): IValue;
|
|
25
|
-
make(name: string, storeName: string): IValue;
|
|
26
|
-
copy(): IScope;
|
|
27
|
-
}
|
|
28
|
-
export declare type IValue = {
|
|
29
|
-
[k in UnaryOperator]?: (scope: IScope) => TValueInstructions;
|
|
30
|
-
} & {
|
|
31
|
-
[k in UpdateOperator]?: (scope: IScope, prefix: boolean) => TValueInstructions;
|
|
32
|
-
} & {
|
|
33
|
-
[k in LeftRightOperator]?: (scope: IScope, value: IValue) => TValueInstructions;
|
|
34
|
-
} & {
|
|
35
|
-
scope: IScope;
|
|
36
|
-
constant: boolean;
|
|
37
|
-
macro: boolean;
|
|
38
|
-
eval(scope: IScope): TValueInstructions;
|
|
39
|
-
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
40
|
-
get(scope: IScope, name: IValue): TValueInstructions;
|
|
41
|
-
};
|
|
42
|
-
export declare type TLiteral = string | number;
|
|
43
|
-
export interface IBindableValue extends IValue {
|
|
44
|
-
data: TLiteral;
|
|
45
|
-
}
|
|
46
|
-
export interface IFunctionValue extends IValue {
|
|
47
|
-
return(scope: IScope, argument: IValue): TValueInstructions;
|
|
48
|
-
}
|
|
49
|
-
export declare type TValueInstructions = [IValue, IInstruction[]];
|
|
1
|
+
export * as es from "estree";
|
|
2
|
+
import { Compiler } from "./Compiler";
|
|
3
|
+
import { AddressResolver } from "./instructions";
|
|
4
|
+
import { LeftRightOperator, UnaryOperator, UpdateOperator } from "./operators";
|
|
5
|
+
export interface IInstruction {
|
|
6
|
+
hidden: boolean;
|
|
7
|
+
resolve(i: number): void;
|
|
8
|
+
}
|
|
9
|
+
export declare type THandler = (compiler: Compiler, scope: IScope, node: any, arg: any) => TValueInstructions;
|
|
10
|
+
export interface IScope {
|
|
11
|
+
parent: IScope;
|
|
12
|
+
data: {};
|
|
13
|
+
name: string;
|
|
14
|
+
inst: IInstruction[];
|
|
15
|
+
break: AddressResolver;
|
|
16
|
+
continue: AddressResolver;
|
|
17
|
+
function: IFunctionValue;
|
|
18
|
+
ntemp: number;
|
|
19
|
+
createScope(): IScope;
|
|
20
|
+
createFunction(name: string, stacked?: boolean): IScope;
|
|
21
|
+
has(name: string): boolean;
|
|
22
|
+
get(name: string): IValue;
|
|
23
|
+
set(name: string, value: IValue): IValue;
|
|
24
|
+
hardSet(name: string, value: IValue): IValue;
|
|
25
|
+
make(name: string, storeName: string): IValue;
|
|
26
|
+
copy(): IScope;
|
|
27
|
+
}
|
|
28
|
+
export declare type IValue = {
|
|
29
|
+
[k in UnaryOperator]?: (scope: IScope) => TValueInstructions;
|
|
30
|
+
} & {
|
|
31
|
+
[k in UpdateOperator]?: (scope: IScope, prefix: boolean) => TValueInstructions;
|
|
32
|
+
} & {
|
|
33
|
+
[k in LeftRightOperator]?: (scope: IScope, value: IValue) => TValueInstructions;
|
|
34
|
+
} & {
|
|
35
|
+
scope: IScope;
|
|
36
|
+
constant: boolean;
|
|
37
|
+
macro: boolean;
|
|
38
|
+
eval(scope: IScope): TValueInstructions;
|
|
39
|
+
call(scope: IScope, args: IValue[]): TValueInstructions;
|
|
40
|
+
get(scope: IScope, name: IValue): TValueInstructions;
|
|
41
|
+
};
|
|
42
|
+
export declare type TLiteral = string | number;
|
|
43
|
+
export interface IBindableValue extends IValue {
|
|
44
|
+
data: TLiteral;
|
|
45
|
+
}
|
|
46
|
+
export interface IFunctionValue extends IValue {
|
|
47
|
+
return(scope: IScope, argument: IValue): TValueInstructions;
|
|
48
|
+
}
|
|
49
|
+
export declare type TValueInstructions = [IValue, IInstruction[]];
|
package/build/types.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.es = void 0;
|
|
27
|
-
exports.es = __importStar(require("estree"));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.es = void 0;
|
|
27
|
+
exports.es = __importStar(require("estree"));
|
|
28
28
|
//# sourceMappingURL=types.js.map
|
package/build/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { es } from "./types";
|
|
2
|
-
export declare function nodeName(node: es.Node): string;
|
|
3
|
-
export declare function camelToDashCase(name: string): string;
|
|
1
|
+
import { es } from "./types";
|
|
2
|
+
export declare function nodeName(node: es.Node): string;
|
|
3
|
+
export declare function camelToDashCase(name: string): string;
|
package/build/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.camelToDashCase = exports.nodeName = void 0;
|
|
4
|
-
function nodeName(node) {
|
|
5
|
-
const { line, column } = node.loc.start;
|
|
6
|
-
return line + ":" + column;
|
|
7
|
-
}
|
|
8
|
-
exports.nodeName = nodeName;
|
|
9
|
-
function camelToDashCase(name) {
|
|
10
|
-
return name.replace(/[A-Z]/g, str => `-${str.toLowerCase()}`);
|
|
11
|
-
}
|
|
12
|
-
exports.camelToDashCase = camelToDashCase;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelToDashCase = exports.nodeName = void 0;
|
|
4
|
+
function nodeName(node) {
|
|
5
|
+
const { line, column } = node.loc.start;
|
|
6
|
+
return line + ":" + column;
|
|
7
|
+
}
|
|
8
|
+
exports.nodeName = nodeName;
|
|
9
|
+
function camelToDashCase(name) {
|
|
10
|
+
return name.replace(/[A-Z]/g, str => `-${str.toLowerCase()}`);
|
|
11
|
+
}
|
|
12
|
+
exports.camelToDashCase = camelToDashCase;
|
|
13
13
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
-
import { VoidValue } from ".";
|
|
3
|
-
export declare class BaseValue extends VoidValue implements IValue {
|
|
4
|
-
"u-"(scope: IScope): TValueInstructions;
|
|
5
|
-
}
|
|
1
|
+
import { IScope, IValue, TValueInstructions } from "../types";
|
|
2
|
+
import { VoidValue } from ".";
|
|
3
|
+
export declare class BaseValue extends VoidValue implements IValue {
|
|
4
|
+
"u-"(scope: IScope): TValueInstructions;
|
|
5
|
+
}
|