ifc-expressions
Version:
Parsing and evaluation of IFC expressions
78 lines (77 loc) • 4.89 kB
TypeScript
import { ErrorListener, ParserRuleContext, Token } from "antlr4";
import { ExprCompiler } from "./compiler/ExprCompiler.js";
import { IfcExpressionErrorListener } from "./IfcExpressionErrorListener.js";
import { isNullish, isPresent } from "./util/IfcExpressionUtils.js";
import { IfcExpressionContext } from "./context/IfcExpressionContext.js";
import { Expr } from "./expression/Expr.js";
import { IfcElementAccessor } from "./context/IfcElementAccessor.js";
import { Value } from "./value/Value.js";
import { StringValue } from "./value/StringValue.js";
import { NumericValue } from "./value/NumericValue.js";
import { BooleanValue } from "./value/BooleanValue.js";
import { LogicalValue } from "./value/LogicalValue.js";
import { ReferenceValue } from "./value/ReferenceValue.js";
import { IfcPropertySetAccessor } from "./context/IfcPropertySetAccessor.js";
import { IfcPropertyAccessor } from "./context/IfcPropertyAccessor.js";
import { IfcRootObjectAccessor } from "./context/IfcRootObjectAccessor.js";
import { IfcTypeObjectAccessor } from "./context/IfcTypeObjectAccessor.js";
import { NamedObjectAccessor } from "./context/NamedObjectAccessor.js";
import IfcExpressionVisitor from "./gen/parser/IfcExpressionVisitor.js";
import { ObjectAccessor } from "./context/ObjectAccessor.js";
import { IfcExpressionEvaluationException } from "./expression/IfcExpressionEvaluationException.js";
import type { ExpressionValue } from "./value/ExpressionValue.js";
import type { BoxedValueTypes } from "./value/BoxedValueTypes.js";
import { ExprEvalError, ExprEvalResult, isExprEvalError, isExprEvalSuccess } from "./expression/ExprEvalResult.js";
import { ExprKind } from "./expression/ExprKind.js";
import { TypeManager } from "./compiler/TypeManager.js";
import { ExprToTextInputLinker } from "./compiler/ExprToTextInputLinker.js";
import { ExprFacade } from "./expression/ExprFacade.js";
import { IfcDurationValue } from "./value/IfcDurationValue.js";
import { IfcDateValue } from "./value/IfcDateValue.js";
import { IfcDateTimeValue } from "./value/IfcDateTimeValue.js";
import { IfcTimeValue } from "./value/IfcTimeValue.js";
import { IfcTimeStampValue } from "./value/IfcTimeStampValue.js";
import { ArrayType } from "./type/ArrayType.js";
import { ExprType } from "./type/ExprType.js";
import { SimpleType } from "./type/SimpleType.js";
import { TupleType } from "./type/TupleType.js";
import { TypeDisjunction } from "./type/TypeDisjunction.js";
import { Types } from "./type/Types.js";
export { IfcElementAccessor, IfcExpressionContext, Value, StringValue, BooleanValue, LogicalValue, NumericValue, ExpressionValue, ReferenceValue, IfcDateValue, IfcDateTimeValue, IfcTimeValue, IfcDurationValue, IfcTimeStampValue, IfcPropertySetAccessor, IfcPropertyAccessor, IfcRootObjectAccessor, IfcTypeObjectAccessor, NamedObjectAccessor, ObjectAccessor, Expr, ExprCompiler, ExprKind, IfcExpressionEvaluationException, IfcExpressionErrorListener, IfcExpressionVisitor, isPresent, isNullish, ExprEvalResult, ExprEvalError, isExprEvalError, isExprEvalSuccess, ExprToTextInputLinker, ExprFacade, ArrayType, ExprType, SimpleType, TupleType, TypeDisjunction, Types, };
export type { BoxedValueTypes };
export declare class IfcExpressionParseResult {
private readonly _input;
private readonly _typeManager;
private readonly _parseTree;
constructor(input: string, typeManager: TypeManager, exprContext: any);
get typeManager(): TypeManager;
get parseTree(): ParserRuleContext;
get input(): string;
}
export declare class IfcExpression {
/**
* Parses the input and returns a parse result, which contains the parse tree, the type information per parse tree node, and the input.
* @param input
* @param errorListener
* @return the parse result, which can subequently be compiled into an Expr using compile().
*/
static parse(input: string, errorListener?: ErrorListener<Token | number>): IfcExpressionParseResult;
/**
* Compiles the specified parseResult into an Expr.
* @param parseResult
* @return the Expression (Expr), which can be evaluated to obtain its result.
*/
static compile(parseResult: IfcExpressionParseResult): ExprFacade<ExpressionValue>;
/**
* Evaluates the specified input expression and returns the evaluation result. The parse
* and compile steps are done internally.
*
* @param expression: the input expression
* @param context: the context required for accessing the IFC model
* @return the result (or an error object).
*/
static evaluate(expression: string, context?: IfcExpressionContext): ExprEvalResult<ExpressionValue>;
static formatError(input: string, error: ExprEvalError): string;
private static indent;
static evaluateExpression(expr: ExprFacade<ExpressionValue>, context?: IfcExpressionContext): ExprEvalResult<ExpressionValue>;
}