greybel-interpreter 2.8.0 → 2.8.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/dist/context.d.ts +1 -2
- package/dist/interpreter.d.ts +1 -1
- package/dist/interpreter.js +11 -15
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { HandlerContainer } from './handler-container';
|
|
|
6
6
|
import { Operation } from './operations/operation';
|
|
7
7
|
import { CustomValue } from './types/base';
|
|
8
8
|
import { CustomMap } from './types/map';
|
|
9
|
-
import { CustomNil } from './types/nil';
|
|
10
9
|
import { ObjectValue } from './utils/object-value';
|
|
11
10
|
import { Path } from './utils/path';
|
|
12
11
|
import { ContextTypeIntrinsics } from './context/types';
|
|
@@ -33,7 +32,7 @@ export declare class Debugger {
|
|
|
33
32
|
private nextStep;
|
|
34
33
|
private lastContext;
|
|
35
34
|
getLastContext(): OperationContext;
|
|
36
|
-
debug(...segments: any[]):
|
|
35
|
+
debug(...segments: any[]): CustomValue;
|
|
37
36
|
setBreakpoint(breakpoint: boolean): Debugger;
|
|
38
37
|
getBreakpoint(_ctx: OperationContext): boolean;
|
|
39
38
|
next(): Debugger;
|
package/dist/interpreter.d.ts
CHANGED
|
@@ -36,8 +36,8 @@ export declare class Interpreter extends EventEmitter {
|
|
|
36
36
|
inject(code: string, context?: OperationContext): Promise<Interpreter>;
|
|
37
37
|
injectInLastContext(code: string): Promise<Interpreter>;
|
|
38
38
|
private initScopes;
|
|
39
|
+
private start;
|
|
39
40
|
run(customCode?: string): Promise<Interpreter>;
|
|
40
|
-
start(top: Operation): Promise<Interpreter>;
|
|
41
41
|
resume(): Interpreter;
|
|
42
42
|
pause(): Interpreter;
|
|
43
43
|
exit(): Promise<OperationContext>;
|
package/dist/interpreter.js
CHANGED
|
@@ -52,8 +52,6 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
52
52
|
throw new Error('You cannot set a debugger while a process is running.');
|
|
53
53
|
}
|
|
54
54
|
this.debugger = dbgr;
|
|
55
|
-
this.apiContext.debugger = dbgr;
|
|
56
|
-
this.globalContext.debugger = dbgr;
|
|
57
55
|
return this;
|
|
58
56
|
}
|
|
59
57
|
setApi(newApi) {
|
|
@@ -68,8 +66,6 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
68
66
|
throw new Error('You cannot set a handler while a process is running.');
|
|
69
67
|
}
|
|
70
68
|
this.handler = handler;
|
|
71
|
-
this.apiContext.handler = handler;
|
|
72
|
-
this.globalContext.handler = handler;
|
|
73
69
|
return this;
|
|
74
70
|
}
|
|
75
71
|
prepare(code) {
|
|
@@ -159,19 +155,8 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
159
155
|
this.apiContext = apiContext;
|
|
160
156
|
this.globalContext = globalContext;
|
|
161
157
|
}
|
|
162
|
-
run(customCode) {
|
|
163
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
this.initScopes();
|
|
165
|
-
const code = customCode !== null && customCode !== void 0 ? customCode : (yield this.handler.resourceHandler.get(this.target));
|
|
166
|
-
const top = yield this.prepare(code);
|
|
167
|
-
return this.start(top);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
158
|
start(top) {
|
|
171
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
if (this.apiContext !== null && this.apiContext.isPending()) {
|
|
173
|
-
throw new Error('Process already running.');
|
|
174
|
-
}
|
|
175
160
|
try {
|
|
176
161
|
this.apiContext.setPending(true);
|
|
177
162
|
const process = top.handle(this.globalContext);
|
|
@@ -193,6 +178,17 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
193
178
|
return this;
|
|
194
179
|
});
|
|
195
180
|
}
|
|
181
|
+
run(customCode) {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
if (this.apiContext !== null && this.apiContext.isPending()) {
|
|
184
|
+
throw new Error('Process already running.');
|
|
185
|
+
}
|
|
186
|
+
this.initScopes();
|
|
187
|
+
const code = customCode !== null && customCode !== void 0 ? customCode : (yield this.handler.resourceHandler.get(this.target));
|
|
188
|
+
const top = yield this.prepare(code);
|
|
189
|
+
return this.start(top);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
196
192
|
resume() {
|
|
197
193
|
if (this.apiContext !== null && this.apiContext.isPending()) {
|
|
198
194
|
this.debugger.setBreakpoint(false);
|