mevento 1.0.0 → 1.2.2
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/README.md +47 -12
- package/esm2020/lib/mevento.mjs +363 -49
- package/fesm2015/mevento.mjs +350 -31
- package/fesm2015/mevento.mjs.map +1 -1
- package/fesm2020/mevento.mjs +343 -29
- package/fesm2020/mevento.mjs.map +1 -1
- package/lib/mevento.d.ts +127 -16
- package/package.json +1 -1
package/lib/mevento.d.ts
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
import { Type } from "@angular/core";
|
|
2
|
-
declare class
|
|
2
|
+
export declare class TokenType {
|
|
3
|
+
static id: number;
|
|
4
|
+
static comma: number;
|
|
5
|
+
static semi: number;
|
|
6
|
+
static numberConst: number;
|
|
7
|
+
static stringConst: number;
|
|
8
|
+
static equal: number;
|
|
9
|
+
static lparen: number;
|
|
10
|
+
static rparen: number;
|
|
11
|
+
static eol: number;
|
|
12
|
+
static eof: number;
|
|
13
|
+
static lbrace: number;
|
|
14
|
+
static rbrace: number;
|
|
15
|
+
static lbracket: number;
|
|
16
|
+
static rbracket: number;
|
|
17
|
+
static great: number;
|
|
18
|
+
static greatEq: number;
|
|
19
|
+
static less: number;
|
|
20
|
+
static lessEq: number;
|
|
21
|
+
static eqeq: number;
|
|
22
|
+
static IF: number;
|
|
23
|
+
static ELSE: number;
|
|
24
|
+
static TRUE: number;
|
|
25
|
+
static FALSE: number;
|
|
26
|
+
static NULL: number;
|
|
27
|
+
static not: number;
|
|
28
|
+
static notEq: number;
|
|
29
|
+
static and: number;
|
|
30
|
+
static or: number;
|
|
31
|
+
static plus: number;
|
|
32
|
+
static minus: number;
|
|
33
|
+
static div: number;
|
|
34
|
+
static mult: number;
|
|
35
|
+
static mod: number;
|
|
36
|
+
static invalid: number;
|
|
37
|
+
static colon: number;
|
|
38
|
+
static WHILE_TILL: number;
|
|
39
|
+
static FOR_LOOP: number;
|
|
40
|
+
static up: number;
|
|
41
|
+
static down: number;
|
|
42
|
+
static with: number;
|
|
43
|
+
static in: number;
|
|
44
|
+
static TILL: number;
|
|
45
|
+
static BREAK: number;
|
|
46
|
+
}
|
|
47
|
+
export declare class Token {
|
|
3
48
|
type: number;
|
|
4
49
|
value: any;
|
|
5
50
|
line?: number;
|
|
@@ -8,89 +53,145 @@ declare class Token {
|
|
|
8
53
|
static from(type: number, value: any): Token;
|
|
9
54
|
toString(): string;
|
|
10
55
|
}
|
|
56
|
+
export declare class LexerDictionary {
|
|
57
|
+
lang: string;
|
|
58
|
+
keywords: {
|
|
59
|
+
[key: string]: string;
|
|
60
|
+
};
|
|
61
|
+
constructor(lang: string, keywords: {
|
|
62
|
+
[key: string]: string;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
11
65
|
/**
|
|
12
66
|
* Parser
|
|
13
67
|
*/
|
|
14
|
-
declare abstract class AST {
|
|
68
|
+
export declare abstract class AST {
|
|
15
69
|
line?: number;
|
|
16
70
|
col?: number;
|
|
17
71
|
constructor(line?: number, col?: number);
|
|
18
72
|
dump(): string;
|
|
19
73
|
}
|
|
20
|
-
declare class RootAST extends AST {
|
|
74
|
+
export declare class RootAST extends AST {
|
|
21
75
|
body: AST[];
|
|
22
76
|
source: string;
|
|
23
77
|
name: string;
|
|
24
78
|
constructor(body: AST[], name: string, source: string);
|
|
25
79
|
dump(): string;
|
|
26
80
|
}
|
|
27
|
-
declare class BlockStatementAST extends AST {
|
|
81
|
+
export declare class BlockStatementAST extends AST {
|
|
28
82
|
body: AST[];
|
|
29
83
|
constructor(body: AST[], token: Token);
|
|
30
84
|
toString(): string;
|
|
31
85
|
}
|
|
32
|
-
declare class IdentifierAST extends AST {
|
|
86
|
+
export declare class IdentifierAST extends AST {
|
|
33
87
|
value: string;
|
|
34
88
|
constructor(token: Token);
|
|
35
89
|
toString(): string;
|
|
36
90
|
}
|
|
37
|
-
declare class LiteralAST extends AST {
|
|
91
|
+
export declare class LiteralAST extends AST {
|
|
38
92
|
value: any;
|
|
39
93
|
raw: string;
|
|
40
94
|
constructor(token: Token, raw: string);
|
|
41
95
|
toString(): string;
|
|
42
96
|
}
|
|
43
|
-
declare class AssignmentExpressionAST extends AST {
|
|
97
|
+
export declare class AssignmentExpressionAST extends AST {
|
|
44
98
|
identifier: AST;
|
|
45
99
|
init: AST;
|
|
46
100
|
constructor(identifier: AST, init: AST);
|
|
47
101
|
toString(): string;
|
|
48
102
|
}
|
|
49
|
-
declare class ExpressionStatementAST extends AST {
|
|
103
|
+
export declare class ExpressionStatementAST extends AST {
|
|
50
104
|
expression: AST;
|
|
51
105
|
constructor(expression: AST);
|
|
52
106
|
toString(): string;
|
|
53
107
|
}
|
|
54
|
-
declare class CallExpressionAST extends AST {
|
|
108
|
+
export declare class CallExpressionAST extends AST {
|
|
55
109
|
callee: IdentifierAST;
|
|
56
110
|
arguments: AST[];
|
|
57
111
|
constructor(callee: IdentifierAST, ags: AST[]);
|
|
58
112
|
toString(): string;
|
|
59
113
|
}
|
|
60
|
-
declare class BinaryExpressionAST extends AST {
|
|
114
|
+
export declare class BinaryExpressionAST extends AST {
|
|
61
115
|
left: AST;
|
|
62
116
|
operation: Token;
|
|
63
117
|
right: AST;
|
|
64
118
|
constructor(left: AST, operation: Token, right: AST);
|
|
65
119
|
toString(): string;
|
|
66
120
|
}
|
|
67
|
-
declare class UnaryExpressionAST extends AST {
|
|
121
|
+
export declare class UnaryExpressionAST extends AST {
|
|
68
122
|
operation: Token;
|
|
69
123
|
argument: AST;
|
|
70
124
|
constructor(operation: Token, argument: AST);
|
|
71
125
|
toString(): string;
|
|
72
126
|
}
|
|
73
|
-
declare class IfStatementAST extends AST {
|
|
127
|
+
export declare class IfStatementAST extends AST {
|
|
74
128
|
test: AST;
|
|
75
129
|
consequent: AST;
|
|
76
130
|
alternate?: AST;
|
|
77
131
|
constructor(test: AST, consequent: AST, alternate?: AST);
|
|
78
132
|
toString(): string;
|
|
79
133
|
}
|
|
80
|
-
declare class LogicalExpressionAST extends AST {
|
|
134
|
+
export declare class LogicalExpressionAST extends AST {
|
|
81
135
|
left: AST;
|
|
82
136
|
operator: Token;
|
|
83
137
|
right: AST;
|
|
84
138
|
constructor(left: AST, operator: Token, right: AST);
|
|
85
139
|
toString(): string;
|
|
86
140
|
}
|
|
87
|
-
declare class IndexAccessorAST extends AST {
|
|
141
|
+
export declare class IndexAccessorAST extends AST {
|
|
88
142
|
owner: AST;
|
|
89
143
|
key: AST;
|
|
90
144
|
computed: boolean;
|
|
91
145
|
constructor(owner: AST, key: AST, computed?: boolean);
|
|
92
146
|
toString(): string;
|
|
93
147
|
}
|
|
148
|
+
export declare class ObjectExpression extends AST {
|
|
149
|
+
properties: AST[];
|
|
150
|
+
constructor(props: AST[], startToken?: Token, endToken?: Token);
|
|
151
|
+
toString(): string;
|
|
152
|
+
}
|
|
153
|
+
export declare class ArrayExpression extends AST {
|
|
154
|
+
elements: AST[];
|
|
155
|
+
constructor(props: AST[], start?: AST, end?: AST);
|
|
156
|
+
toString(): string;
|
|
157
|
+
}
|
|
158
|
+
export declare class ObjectProperty extends AST {
|
|
159
|
+
key: AST;
|
|
160
|
+
value: AST;
|
|
161
|
+
constructor(key: AST, value: AST);
|
|
162
|
+
}
|
|
163
|
+
export declare class WhileLoopStatement extends AST {
|
|
164
|
+
test: AST;
|
|
165
|
+
body: AST;
|
|
166
|
+
retain: boolean;
|
|
167
|
+
constructor(test: AST, body: AST, startToken?: Token, endToken?: Token, retain?: boolean);
|
|
168
|
+
}
|
|
169
|
+
export declare class ForLoopStatement extends AST {
|
|
170
|
+
init: AssignmentExpressionAST;
|
|
171
|
+
test: AST;
|
|
172
|
+
update: AST;
|
|
173
|
+
direction: Token;
|
|
174
|
+
body: AST;
|
|
175
|
+
retain: boolean;
|
|
176
|
+
constructor(init: AssignmentExpressionAST, test: AST, update: AST, direction: Token, body: AST, startToken?: Token, endToken?: Token, retain?: boolean);
|
|
177
|
+
}
|
|
178
|
+
export declare class ForOfStatement extends AST {
|
|
179
|
+
identifier: AST;
|
|
180
|
+
collection: AST;
|
|
181
|
+
body: AST;
|
|
182
|
+
retain: boolean;
|
|
183
|
+
constructor(identifier: AST, collection: AST, body: AST, startToken?: Token, endToken?: Token, retain?: boolean);
|
|
184
|
+
}
|
|
185
|
+
export declare class TupleExpression extends AST {
|
|
186
|
+
first: AST;
|
|
187
|
+
second: AST;
|
|
188
|
+
constructor(first: AST, second: AST);
|
|
189
|
+
}
|
|
190
|
+
export declare class BreakAST extends AST {
|
|
191
|
+
constructor(line?: number, col?: number);
|
|
192
|
+
}
|
|
193
|
+
export declare class BreakBranch {
|
|
194
|
+
}
|
|
94
195
|
declare type Func = (node: any) => any;
|
|
95
196
|
declare abstract class ANodeVisitor {
|
|
96
197
|
protected _nodesVisitors: {
|
|
@@ -99,20 +200,22 @@ declare abstract class ANodeVisitor {
|
|
|
99
200
|
protected registerVisitor(type: Type<AST>, visitor: Func): void;
|
|
100
201
|
abstract visit(node: AST): any;
|
|
101
202
|
}
|
|
102
|
-
declare abstract class NodeVisitor extends ANodeVisitor {
|
|
203
|
+
export declare abstract class NodeVisitor extends ANodeVisitor {
|
|
103
204
|
visit(node: AST): any;
|
|
104
205
|
}
|
|
105
|
-
declare type MEventoFBinding = (args: any[], vm: MEvento) => any;
|
|
206
|
+
export declare type MEventoFBinding = (args: any[], vm: MEvento) => any;
|
|
106
207
|
export declare class MEvento extends NodeVisitor {
|
|
107
208
|
_memory: {
|
|
108
209
|
[k: string]: any;
|
|
109
210
|
};
|
|
211
|
+
debug: boolean;
|
|
110
212
|
private static _globalFunctionsRegistry;
|
|
111
213
|
private static _cache;
|
|
112
214
|
_functionsRegistry: {
|
|
113
215
|
[k: string]: MEventoFBinding;
|
|
114
216
|
};
|
|
115
217
|
constructor();
|
|
218
|
+
protected log(message: any): void;
|
|
116
219
|
protected visitRootAST(node: RootAST): any;
|
|
117
220
|
protected visitBlockStatementAST(node: BlockStatementAST): any;
|
|
118
221
|
protected visitIdentifierAST(node: IdentifierAST): any;
|
|
@@ -129,6 +232,11 @@ export declare class MEvento extends NodeVisitor {
|
|
|
129
232
|
protected visitObjectProperty(node: AST): any;
|
|
130
233
|
protected visitObjectExpression(ast: AST): any;
|
|
131
234
|
protected visitArrayExpression(ast: AST): any;
|
|
235
|
+
protected visitBreakAST(node: BreakAST): BreakBranch;
|
|
236
|
+
protected visitWhileLoopStatement(node: WhileLoopStatement): any;
|
|
237
|
+
protected visitForLoopStatement(node: ForLoopStatement): any;
|
|
238
|
+
protected visitForOfStatement(node: ForOfStatement): any;
|
|
239
|
+
protected _declareForIdentifier(node: AST, value: any): any;
|
|
132
240
|
resolveArguments(args: AST[]): any;
|
|
133
241
|
registerFunction(id: string, fn: MEventoFBinding): void;
|
|
134
242
|
unregisterFunction(id: string): void;
|
|
@@ -158,6 +266,9 @@ export declare class MEventoAsync extends MEvento {
|
|
|
158
266
|
protected visitObjectProperty(node: AST): Promise<void>;
|
|
159
267
|
protected visitObjectExpression(ast: AST): Promise<any>;
|
|
160
268
|
protected visitArrayExpression(ast: AST): Promise<any[]>;
|
|
269
|
+
protected visitWhileLoopStatement(node: WhileLoopStatement): Promise<any[] | undefined>;
|
|
270
|
+
protected visitForLoopStatement(node: ForLoopStatement): Promise<any[] | undefined>;
|
|
271
|
+
protected visitForOfStatement(node: ForOfStatement): Promise<any[] | undefined>;
|
|
161
272
|
resolveArgumentsAsync(args: AST[]): Promise<any[]>;
|
|
162
273
|
registerFunction(id: string, fn: MEventoFBinding): void;
|
|
163
274
|
unregisterFunction(id: string): void;
|