UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

76 lines (75 loc) 5.37 kB
import { ANTLRErrorListener, ParserRuleContext } from "antlr4ng"; import Decimal from "decimal.js"; 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"; import { ContextObjectType } from "./type/ContextObjectType.js"; import { BuiltinVariableRegistry } from "./builtin/BuiltinVariableRegistry.js"; import { IfcExpressionOptions } from "./IfcExpressionOptions.js"; import { IfcExpressionAutocomplete } from "./autocomplete/IfcExpressionAutocomplete.js"; import type { CompletionItem, CompletionResult } from "./autocomplete/CompletionItem.js"; import type { IfcExpressionAutocompleteOptions } from "./autocomplete/IfcExpressionAutocomplete.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, ContextObjectType, BuiltinVariableRegistry, IfcExpressionAutocomplete, }; export type { BoxedValueTypes, IfcExpressionOptions, CompletionItem, CompletionResult, IfcExpressionAutocompleteOptions, }; export type UnwrappedExpressionValue = string | boolean | Decimal | undefined | UnwrappedExpressionValue[] | { [key: string]: UnwrappedExpressionValue; }; export declare class IfcExpressionParseResult { private readonly _input; private readonly _typeManager; private readonly _parseTree; private readonly _builtinVariableRegistry; constructor(input: string, typeManager: TypeManager, exprContext: any, builtinVariableRegistry: BuiltinVariableRegistry); get typeManager(): TypeManager; get parseTree(): ParserRuleContext; get input(): string; get builtinVariableRegistry(): BuiltinVariableRegistry; } export declare class IfcExpression { static parse(input: string, errorListener?: ANTLRErrorListener, options?: IfcExpressionOptions): IfcExpressionParseResult; static compile(parseResult: IfcExpressionParseResult): ExprFacade<ExpressionValue>; static evaluate(expression: string, context?: IfcExpressionContext, options?: IfcExpressionOptions): ExprEvalResult<ExpressionValue>; static formatError(input: string, error: ExprEvalError): string; private static indent; static evaluateExpression(expr: ExprFacade<ExpressionValue>, context?: IfcExpressionContext): ExprEvalResult<ExpressionValue>; static unwrapValue(value: ExpressionValue): UnwrappedExpressionValue; private static unwrapUnknownValue; private static unwrapObjectAccessor; private static unwrapPlainObject; private static isPlainObject; }