greybel-interpreter 4.0.0 → 4.0.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/dist/bytecode-generator.d.ts +36 -36
- package/dist/interpreter.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ASTFeatureEnvarExpression, ASTFeatureImportExpression, ASTFeatureIncludeExpression } from 'greybel-core';
|
|
2
|
-
import { ASTBase, ASTCallExpression, ASTForGenericStatement, ASTIfStatement, ASTUnaryExpression, ASTWhileStatement } from 'miniscript-core';
|
|
3
|
-
import { Instruction } from './byte-compiler/instruction';
|
|
2
|
+
import { ASTAssignmentStatement, ASTBase, ASTCallExpression, ASTEvaluationExpression, ASTForGenericStatement, ASTFunctionStatement, ASTIdentifier, ASTIfStatement, ASTListConstructorExpression, ASTLiteral, ASTMapConstructorExpression, ASTReturnStatement, ASTUnaryExpression, ASTWhileStatement, ASTSliceExpression, ASTIndexExpression, ASTMemberExpression } from 'miniscript-core';
|
|
3
|
+
import { Instruction, SourceLocation } from './byte-compiler/instruction';
|
|
4
4
|
import { HandlerContainer } from './handler-container';
|
|
5
5
|
export interface BytecodeCompileResult {
|
|
6
6
|
code: Instruction[];
|
|
@@ -24,38 +24,38 @@ export declare class BytecodeGenerator {
|
|
|
24
24
|
constructor(options: BytecodeConverterOptions);
|
|
25
25
|
parse(code: string): ASTBase | import("greybel-core").ASTChunkAdvanced;
|
|
26
26
|
compile(code: string): Promise<BytecodeCompileResult>;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
processWhileStatement(node: ASTWhileStatement): Promise<void>;
|
|
52
|
-
processUnaryExpression(node: ASTUnaryExpression): Promise<void>;
|
|
53
|
-
processCallExpression(node: ASTCallExpression): Promise<void>;
|
|
54
|
-
processIfStatement(node: ASTIfStatement): Promise<void>;
|
|
55
|
-
processForGenericStatement(node: ASTForGenericStatement): Promise<void>;
|
|
56
|
-
processEnvarExpression(node: ASTFeatureEnvarExpression): Promise<void>;
|
|
57
|
-
createImport(node: ASTFeatureImportExpression, path: string, code: string): Promise<void>;
|
|
58
|
-
processImportExpression(node: ASTFeatureImportExpression): Promise<void>;
|
|
59
|
-
processIncludeExpression(node: ASTFeatureIncludeExpression): Promise<void>;
|
|
60
|
-
processDebuggerExpression(node: ASTBase): Promise<void>;
|
|
27
|
+
protected getCurrentPointer(): number;
|
|
28
|
+
protected getSourceLocation(node: ASTBase): SourceLocation;
|
|
29
|
+
protected getInternalLocation(): SourceLocation;
|
|
30
|
+
protected pushContext(): void;
|
|
31
|
+
protected popContext(): BytecodeGeneratorContext;
|
|
32
|
+
protected getLastJumpoint(): [Instruction, Instruction];
|
|
33
|
+
protected pushJumppoint(start: Instruction, end: Instruction): void;
|
|
34
|
+
protected popJumppoint(): [Instruction, Instruction];
|
|
35
|
+
protected push(item: Instruction): void;
|
|
36
|
+
protected processNode(node: ASTBase): Promise<void>;
|
|
37
|
+
protected processSubNode(node: ASTBase, ignoreOuter?: boolean): Promise<void>;
|
|
38
|
+
protected processMemberExpression(node: ASTMemberExpression, isInvoke?: boolean): Promise<void>;
|
|
39
|
+
protected processIndexExpression(node: ASTIndexExpression, isInvoke?: boolean): Promise<void>;
|
|
40
|
+
protected processSliceExpression(node: ASTSliceExpression): Promise<void>;
|
|
41
|
+
protected processIdentifier(node: ASTIdentifier, isFirst?: boolean, isInvoke?: boolean): Promise<void>;
|
|
42
|
+
protected processAssignmentStatement(node: ASTAssignmentStatement): Promise<void>;
|
|
43
|
+
protected processLiteral(node: ASTLiteral): Promise<void>;
|
|
44
|
+
protected processEvaluationExpression(node: ASTEvaluationExpression): Promise<void>;
|
|
45
|
+
protected processReturn(node: ASTReturnStatement): Promise<void>;
|
|
46
|
+
protected processBreak(node: ASTBase): Promise<void>;
|
|
47
|
+
protected processContinue(node: ASTBase): Promise<void>;
|
|
48
|
+
protected processMapConstructorExpression(node: ASTMapConstructorExpression): Promise<void>;
|
|
49
|
+
protected processListConstructorExpression(node: ASTListConstructorExpression): Promise<void>;
|
|
50
|
+
protected processFunctionDeclaration(node: ASTFunctionStatement, ignoreOuter?: boolean): Promise<void>;
|
|
51
|
+
protected processWhileStatement(node: ASTWhileStatement): Promise<void>;
|
|
52
|
+
protected processUnaryExpression(node: ASTUnaryExpression): Promise<void>;
|
|
53
|
+
protected processCallExpression(node: ASTCallExpression): Promise<void>;
|
|
54
|
+
protected processIfStatement(node: ASTIfStatement): Promise<void>;
|
|
55
|
+
protected processForGenericStatement(node: ASTForGenericStatement): Promise<void>;
|
|
56
|
+
protected processEnvarExpression(node: ASTFeatureEnvarExpression): Promise<void>;
|
|
57
|
+
protected createImport(node: ASTFeatureImportExpression, path: string, code: string): Promise<void>;
|
|
58
|
+
protected processImportExpression(node: ASTFeatureImportExpression): Promise<void>;
|
|
59
|
+
protected processIncludeExpression(node: ASTFeatureIncludeExpression): Promise<void>;
|
|
60
|
+
protected processDebuggerExpression(node: ASTBase): Promise<void>;
|
|
61
61
|
}
|
package/dist/interpreter.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { CustomValue } from './types/base';
|
|
|
6
6
|
import { CustomString } from './types/string';
|
|
7
7
|
import { ObjectValue } from './utils/object-value';
|
|
8
8
|
import { Debugger, VM } from './vm';
|
|
9
|
+
import { BytecodeCompileResult } from './bytecode-generator';
|
|
9
10
|
export declare const PARAMS_PROPERTY: CustomString;
|
|
10
11
|
export declare const IS_GREYBEL_PROPERTY: CustomString;
|
|
11
12
|
export interface InterpreterOptions {
|
|
@@ -39,8 +40,8 @@ export declare class Interpreter extends EventEmitter {
|
|
|
39
40
|
setHandler(handler: HandlerContainer): Interpreter;
|
|
40
41
|
inject(code: string, context?: OperationContext): Promise<Interpreter>;
|
|
41
42
|
injectInLastContext(code: string): Promise<Interpreter>;
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
protected initVM(result: BytecodeCompileResult): void;
|
|
44
|
+
protected start(): Promise<Interpreter>;
|
|
44
45
|
run({ customCode }?: InterpreterRunOptions): Promise<Interpreter>;
|
|
45
46
|
resume(): Interpreter;
|
|
46
47
|
pause(): Interpreter;
|