/*! * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Primitive } from "./types"; import { BinaryOperatorToken, ExpAlgebra, UnaryOperatorToken } from "./parser"; export declare enum NodeKind { Literal = 0, Ident = 1, Paren = 2, Fun = 3, App = 4, Conditional = 5, Dot = 6, BinaryOp = 7, UnaryOp = 8, Missing = 9, Sequence = 10 } interface LiteralNode { kind: NodeKind.Literal; value: Primitive; } interface IdentNode { kind: NodeKind.Ident; value: I; } interface ParenNode { kind: NodeKind.Paren; value: ExpressionNode; } interface FunNode { kind: NodeKind.Fun; children: ExpressionNode[]; } interface AppNode { kind: NodeKind.App; children: ExpressionNode[]; } interface ConditionalNode { kind: NodeKind.Conditional; children: ExpressionNode[]; } interface DotNode { kind: NodeKind.Dot; operand1: ExpressionNode; operand2: ExpressionNode; } interface BinaryOpNode { kind: NodeKind.BinaryOp; op: BinaryOperatorToken; operand1: ExpressionNode; operand2: ExpressionNode; } interface UnaryOpNode { kind: NodeKind.UnaryOp; op: UnaryOperatorToken; operand1: ExpressionNode; } interface MissingNode { kind: NodeKind.Missing; value: undefined; } interface SequenceNode { kind: NodeKind.Sequence; children: ExpressionNode[]; } export declare type ExpressionNode = LiteralNode | IdentNode | ParenNode | FunNode | AppNode | ConditionalNode | DotNode | BinaryOpNode | UnaryOpNode | MissingNode | SequenceNode; export declare function ident(id: I): IdentNode; export declare function createAlgebra(resolve: (id: string) => I): ExpAlgebra>; export declare const parseExpression: (input: string) => [boolean, ExpressionNode]; export {}; //# sourceMappingURL=ast.d.ts.map