Typescript all the parser things
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import NodeFactory from '/imports/parser/parseTree/NodeFactory';
|
||||
import ParseNode from '/imports/parser/parseTree/ParseNode';
|
||||
import { Context, ResolvedResult } from '/imports/parser/resolve';
|
||||
import ResolveLevelFunction from '/imports/parser/types/ResolveLevelFunction';
|
||||
import ToStringFunction from '/imports/parser/types/ToStringFunction';
|
||||
|
||||
export type ErrorNode = {
|
||||
parseType: 'error';
|
||||
@@ -8,17 +8,10 @@ export type ErrorNode = {
|
||||
error: string;
|
||||
}
|
||||
|
||||
interface ErrorFactory extends NodeFactory {
|
||||
interface ErrorFactory {
|
||||
create(node: Partial<ErrorNode>): ErrorNode;
|
||||
compile(
|
||||
node: ErrorNode, scope: Record<string, any>, context: Context
|
||||
): ResolvedResult;
|
||||
roll?: undefined;
|
||||
reduce?: undefined;
|
||||
resolve?: undefined;
|
||||
toString(node: ErrorNode): string;
|
||||
traverse?: undefined;
|
||||
map?: undefined;
|
||||
compile: ResolveLevelFunction<ErrorNode>;
|
||||
toString: ToStringFunction<ErrorNode>;
|
||||
}
|
||||
|
||||
const error: ErrorFactory = {
|
||||
@@ -29,7 +22,7 @@ const error: ErrorFactory = {
|
||||
error,
|
||||
}
|
||||
},
|
||||
compile(node, scope, context) {
|
||||
async compile(node, scope, context) {
|
||||
return { result: node, context };
|
||||
},
|
||||
toString(node) {
|
||||
|
||||
Reference in New Issue
Block a user