UNPKG

@akala/core

Version:
39 lines (38 loc) 1.61 kB
import { BinaryOperator } from './binary-operator.js'; import { Expression, type Expressions, type StrictExpressions } from './expression.js'; import { ExpressionType } from './expression-type.js'; import type { ExpressionVisitor } from './visitors/expression-visitor.js'; /** * Represents a binary expression. * @template T - The type of the expressions. */ export declare class BinaryExpression<T extends Expressions = StrictExpressions> extends Expression { readonly left: T; readonly operator: BinaryOperator; readonly right: T; /** * Gets the type of the expression. * @returns {ExpressionType.BinaryExpression} The type of the expression. */ get type(): ExpressionType.BinaryExpression; /** * Initializes a new instance of the BinaryExpression class. * @param {T} left - The left expression. * @param {BinaryOperator} operator - The binary operator. * @param {T} right - The right expression. */ constructor(left: T, operator: BinaryOperator, right: T); /** * Accepts a visitor. * @param {ExpressionVisitor} visitor - The visitor. * @returns {any} The result of the visit. */ accept(visitor: ExpressionVisitor): BinaryExpression<Expressions>; /** * Applies precedence to a parsed binary expression. * @param {ParsedBinary} operation - The parsed binary expression. * @returns {ParsedBinary} The parsed binary expression with applied precedence. */ static applyPrecedence<T extends Expressions = StrictExpressions>(operation: BinaryExpression<T>): any; toString(): string; }