asajs 4.0.5-indev → 4.0.6-indev
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/dist/js/compilers/bindings/Checker.js +3 -0
- package/dist/js/compilers/bindings/Lexer.js +2 -0
- package/dist/js/compilers/bindings/Parser.js +52 -6
- package/dist/js/compilers/ui/installer.js +8 -0
- package/dist/types/compilers/bindings/Checker.d.ts +1 -0
- package/dist/types/compilers/bindings/Parser.d.ts +1 -0
- package/dist/types/components/AnimationKeyframe.d.ts +4 -4
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { BindingType } from "../../types/enums/BindingType.js";
|
|
|
3
3
|
import { FunctionMap } from "./Function.js";
|
|
4
4
|
import { Lexer } from "./Lexer.js";
|
|
5
5
|
import { RandomBindingString } from "../../components/Utils.js";
|
|
6
|
+
import { isHasBinding } from "./Checker.js";
|
|
6
7
|
export class Parser {
|
|
7
8
|
input;
|
|
8
9
|
cache;
|
|
@@ -60,11 +61,56 @@ export class Parser {
|
|
|
60
61
|
return this.tokens[this.tokens.length - 1];
|
|
61
62
|
}
|
|
62
63
|
parseExpression() {
|
|
63
|
-
return this.
|
|
64
|
+
return this.parseBinaryExpression();
|
|
65
|
+
}
|
|
66
|
+
parseBinaryExpression() {
|
|
67
|
+
let left = this.parseOrExpression(), current;
|
|
68
|
+
while ((current = this.at()) && current.kind === TokenKind.OPERATOR && current.value === "?") {
|
|
69
|
+
this.eat();
|
|
70
|
+
let middle = this.parseExpression(), right;
|
|
71
|
+
if ((current = this.at()) && current.kind === TokenKind.OPERATOR && current.value === ":") {
|
|
72
|
+
this.eat();
|
|
73
|
+
right = this.parseExpression();
|
|
74
|
+
}
|
|
75
|
+
else
|
|
76
|
+
this.expect(TokenKind.OPERATOR, "Unexpected token!");
|
|
77
|
+
let leftBind, middleBind, rightBind;
|
|
78
|
+
if (isHasBinding(left)) {
|
|
79
|
+
leftBind = RandomBindingString();
|
|
80
|
+
this.genBindings.push({
|
|
81
|
+
source: `((0 + ${left}) > 0)`,
|
|
82
|
+
target: leftBind,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else
|
|
86
|
+
this.expect(TokenKind.WORD, "Unexpected token!");
|
|
87
|
+
if (isHasBinding(middle)) {
|
|
88
|
+
middleBind = RandomBindingString();
|
|
89
|
+
this.genBindings.push({
|
|
90
|
+
source: middle,
|
|
91
|
+
target: middleBind,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else
|
|
95
|
+
this.expect(TokenKind.WORD, "Unexpected token!");
|
|
96
|
+
if (isHasBinding(right)) {
|
|
97
|
+
rightBind = RandomBindingString();
|
|
98
|
+
this.genBindings.push({
|
|
99
|
+
source: right,
|
|
100
|
+
target: rightBind,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else
|
|
104
|
+
this.expect(TokenKind.WORD, "Unexpected token!");
|
|
105
|
+
const ifTrueExpression = `(('prefix' + ${leftBind} + ${middleBind}) - ('prefixfalse' + ${middleBind})) - 'prefixtrue')`;
|
|
106
|
+
const ifFalseExpression = `(('prefix' + ${leftBind} + ${rightBind}) - ('prefixtrue' + ${rightBind})) - 'prefixfalse')`;
|
|
107
|
+
return `(${ifTrueExpression} + ${ifFalseExpression})`;
|
|
108
|
+
}
|
|
109
|
+
return left;
|
|
64
110
|
}
|
|
65
111
|
parseOrExpression() {
|
|
66
112
|
let left = this.parseAndExpression(), current;
|
|
67
|
-
while ((current = this.at()) &&
|
|
113
|
+
while ((current = this.at()) && current.kind === TokenKind.OPERATOR && current.value === "||") {
|
|
68
114
|
this.eat();
|
|
69
115
|
left = `(${left} or ${this.parseAndExpression()})`;
|
|
70
116
|
}
|
|
@@ -72,7 +118,7 @@ export class Parser {
|
|
|
72
118
|
}
|
|
73
119
|
parseAndExpression() {
|
|
74
120
|
let left = this.parseComparisonExpression(), current;
|
|
75
|
-
while ((current = this.at()) &&
|
|
121
|
+
while ((current = this.at()) && current.kind === TokenKind.OPERATOR && current.value === "&&") {
|
|
76
122
|
this.eat();
|
|
77
123
|
left = `(${left} and ${this.parseComparisonExpression()})`;
|
|
78
124
|
}
|
|
@@ -81,7 +127,7 @@ export class Parser {
|
|
|
81
127
|
parseComparisonExpression() {
|
|
82
128
|
let left = this.parseAdditiveExpression(), current;
|
|
83
129
|
while ((current = this.at()) &&
|
|
84
|
-
|
|
130
|
+
current.kind === TokenKind.OPERATOR &&
|
|
85
131
|
["==", ">", "<", ">=", "<=", "!="].includes(current.value)) {
|
|
86
132
|
const operator = this.eat();
|
|
87
133
|
const right = this.parseAdditiveExpression();
|
|
@@ -106,7 +152,7 @@ export class Parser {
|
|
|
106
152
|
parseAdditiveExpression() {
|
|
107
153
|
let left = this.parseMultiplicativeExpression(), current;
|
|
108
154
|
while ((current = this.at()) &&
|
|
109
|
-
|
|
155
|
+
current?.kind === TokenKind.OPERATOR &&
|
|
110
156
|
["+", "-"].includes(current.value)) {
|
|
111
157
|
const operator = this.eat();
|
|
112
158
|
const right = this.parseMultiplicativeExpression();
|
|
@@ -117,7 +163,7 @@ export class Parser {
|
|
|
117
163
|
parseMultiplicativeExpression() {
|
|
118
164
|
let left = this.parseBitwiseLogicExpression(), current;
|
|
119
165
|
while ((current = this.at()) &&
|
|
120
|
-
|
|
166
|
+
current?.kind === TokenKind.OPERATOR &&
|
|
121
167
|
["*", "/", "%"].includes(current.value)) {
|
|
122
168
|
const operator = this.eat();
|
|
123
169
|
const right = this.parsePrimaryExpression();
|
|
@@ -143,6 +143,14 @@ export function getGamedataPath() {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
case "linux": {
|
|
147
|
+
const gamedata = path.join(process.env.HOME, "\\.local\\share\\mcpelauncher\\games\\com.mojang");
|
|
148
|
+
if (fs.existsSync(gamedata))
|
|
149
|
+
return (pathinfo.gamepath = gamedata);
|
|
150
|
+
else {
|
|
151
|
+
return (pathinfo.gamepath = path.join(process.env.HOME, "\\.var\\app\\io.mrarm.mcpelauncher\\data\\mcpelauncher\\games\\com.mojang"));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
146
154
|
default: {
|
|
147
155
|
console.warn(`Your platform is not supported the install feature yet! \nYour OS version: ${os.version()}`);
|
|
148
156
|
}
|
|
@@ -5,3 +5,4 @@ export declare function isHexChar(char: string): boolean;
|
|
|
5
5
|
export declare function isBinaryChar(char: string): boolean;
|
|
6
6
|
export declare function isOctalChar(char: string): boolean;
|
|
7
7
|
export declare function isCompileBinding(input: string): boolean;
|
|
8
|
+
export declare function isHasBinding(input: string): boolean;
|
|
@@ -15,8 +15,8 @@ export declare class AnimationKeyframe<T extends AnimType> extends Class {
|
|
|
15
15
|
clearNext(): this;
|
|
16
16
|
protected toJsonUI(): KeyframeAnimationProperties<AnimType>;
|
|
17
17
|
protected toJSON(): (Partial<import("../types/properties/element/Animation.js").DurationAnimation> & import("../types/properties/element/Animation.js").KeyframeAnimationPropertiesItem) | (Partial<import("../types/properties/element/Animation.js").AsepriteFlipBookAnimation> & import("../types/properties/element/Animation.js").KeyframeAnimationPropertiesItem) | {
|
|
18
|
-
from?: import("../types/properties/value.js").
|
|
19
|
-
to?: import("../types/properties/value.js").
|
|
18
|
+
from?: import("../types/properties/value.js").Array2<string | number> | undefined;
|
|
19
|
+
to?: import("../types/properties/value.js").Array2<string | number> | undefined;
|
|
20
20
|
duration?: import("../types/properties/value.js").Value<number> | undefined;
|
|
21
21
|
easing?: import("../types/properties/value.js").Value<string | import("../index.js").Easing> | undefined;
|
|
22
22
|
next?: import("../types/properties/value.js").Value<string | AnimationKeyframe<AnimType> | Animation<AnimType>>;
|
|
@@ -33,8 +33,8 @@ export declare class AnimationKeyframe<T extends AnimType> extends Class {
|
|
|
33
33
|
wait_until_rendered_to_play?: import("../types/properties/value.js").Value<boolean>;
|
|
34
34
|
anim_type: T;
|
|
35
35
|
} | {
|
|
36
|
-
from?: import("../types/properties/value.js").
|
|
37
|
-
to?: import("../types/properties/value.js").
|
|
36
|
+
from?: import("../types/properties/value.js").Value<number> | undefined;
|
|
37
|
+
to?: import("../types/properties/value.js").Value<number> | undefined;
|
|
38
38
|
duration?: import("../types/properties/value.js").Value<number> | undefined;
|
|
39
39
|
easing?: import("../types/properties/value.js").Value<string | import("../index.js").Easing> | undefined;
|
|
40
40
|
next?: import("../types/properties/value.js").Value<string | AnimationKeyframe<AnimType> | Animation<AnimType>>;
|