UNPKG

mancha

Version:

Javscript HTML rendering engine

38 lines (37 loc) 2.18 kB
import type * as ast from "./ast.js"; export interface AstFactory<E extends ast.Expression> { empty(): E; literal(value: ast.LiteralValue): E; id(name: string): E; unary(operator: string, expression: E): E; binary(left: E, op: string, right: E | undefined): E; getter(receiver: E, name: string, optional?: boolean): E; invoke(receiver: E, method: string | undefined, args: Array<E | undefined> | undefined, optional?: boolean): E; paren(child: E | undefined): E; index(receiver: E, argument: E | undefined, optional?: boolean): E; ternary(condition: E, trueExpr: E | undefined, falseExpr: E | undefined): E; map(properties: Array<ast.Property | ast.SpreadProperty> | undefined): E; list(items: Array<E | undefined> | undefined): E; arrowFunction(params: Array<string>, body: E | undefined): E; spreadProperty(expression: E): E; spreadElement(expression: E): E; property(key: string, value: E): E; } export declare class DefaultAstFactory implements AstFactory<ast.Expression> { empty(): ast.Empty; literal(value: ast.LiteralValue): ast.Literal; id(value: string): ast.ID; unary(operator: string, child: ast.Expression): ast.Unary; binary(left: ast.Expression, operator: string, right: ast.Expression): ast.Binary; getter(receiver: ast.Expression, name: string, optional?: boolean): ast.Getter; invoke(receiver: ast.Expression, method: string | undefined, args: Array<ast.Expression> | undefined, optional?: boolean): ast.Invoke; paren(child: ast.Expression): ast.Paren; index(receiver: ast.Expression, argument: ast.Expression | undefined, optional?: boolean): ast.Index; ternary(condition: ast.Expression, trueExpr: ast.Expression, falseExpr: ast.Expression): ast.Ternary; map(properties: Array<ast.Property | ast.SpreadProperty>): ast.Map; list(items: Array<ast.Expression>): ast.List; property(key: string, value: ast.Expression): ast.Property; arrowFunction(params: Array<string>, body: ast.Expression): ast.ArrowFunction; spreadProperty(expression: ast.Expression): ast.SpreadProperty; spreadElement(expression: ast.Expression): ast.SpreadElement; }