ifc-expressions 2.3.0 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +255 -30
- package/dist/IfcExpression.d.ts +24 -26
- package/dist/IfcExpressionErrorListener.d.ts +3 -3
- package/dist/IfcExpressionOptions.d.ts +4 -0
- package/dist/autocomplete/CompletionItem.d.ts +24 -0
- package/dist/autocomplete/IfcExpressionAutocomplete.d.ts +11 -0
- package/dist/builtin/BuiltinRuntimeValueConverter.d.ts +7 -0
- package/dist/builtin/BuiltinVariableRegistry.d.ts +50 -0
- package/dist/cjs/IfcExpression.js +112 -37
- package/dist/cjs/IfcExpression.js.map +1 -1
- package/dist/cjs/IfcExpressionErrorListener.js +3 -8
- package/dist/cjs/IfcExpressionErrorListener.js.map +1 -1
- package/dist/cjs/IfcExpressionOptions.js +3 -0
- package/dist/cjs/IfcExpressionOptions.js.map +1 -0
- package/dist/cjs/autocomplete/CompletionItem.js +3 -0
- package/dist/cjs/autocomplete/CompletionItem.js.map +1 -0
- package/dist/cjs/autocomplete/IfcExpressionAutocomplete.js +654 -0
- package/dist/cjs/autocomplete/IfcExpressionAutocomplete.js.map +1 -0
- package/dist/cjs/builtin/BuiltinRuntimeValueConverter.js +124 -0
- package/dist/cjs/builtin/BuiltinRuntimeValueConverter.js.map +1 -0
- package/dist/cjs/builtin/BuiltinVariableRegistry.js +405 -0
- package/dist/cjs/builtin/BuiltinVariableRegistry.js.map +1 -0
- package/dist/cjs/compiler/ExprCompiler.js +44 -41
- package/dist/cjs/compiler/ExprCompiler.js.map +1 -1
- package/dist/cjs/compiler/ExprManager.js.map +1 -1
- package/dist/cjs/compiler/IfcExpressionValidationListener.js +85 -25
- package/dist/cjs/compiler/IfcExpressionValidationListener.js.map +1 -1
- package/dist/cjs/compiler/TypeManager.js.map +1 -1
- package/dist/cjs/context/IfcExpressionContext.js.map +1 -1
- package/dist/cjs/context/NopContext.js +3 -0
- package/dist/cjs/context/NopContext.js.map +1 -1
- package/dist/cjs/documentation/Documentation.js +11 -0
- package/dist/cjs/documentation/Documentation.js.map +1 -0
- package/dist/cjs/error/ExpressionTypeError.js.map +1 -1
- package/dist/cjs/error/IfcExpressionBuiltinConfigException.js +10 -0
- package/dist/cjs/error/IfcExpressionBuiltinConfigException.js.map +1 -0
- package/dist/cjs/error/InvalidSyntaxException.js.map +1 -1
- package/dist/cjs/error/NoSuchFunctionException.js.map +1 -1
- package/dist/cjs/error/NoSuchMemberException.js +13 -0
- package/dist/cjs/error/NoSuchMemberException.js.map +1 -0
- package/dist/cjs/error/ValidationException.js.map +1 -1
- package/dist/cjs/error/WrongFunctionArgumentTypeException.js.map +1 -1
- package/dist/cjs/expression/ExprKind.js +3 -0
- package/dist/cjs/expression/ExprKind.js.map +1 -1
- package/dist/cjs/expression/function/Func.js +18 -14
- package/dist/cjs/expression/function/Func.js.map +1 -1
- package/dist/cjs/expression/function/FuncArg.js +11 -5
- package/dist/cjs/expression/function/FuncArg.js.map +1 -1
- package/dist/cjs/expression/function/IfcExpressionFunctions.js +198 -42
- package/dist/cjs/expression/function/IfcExpressionFunctions.js.map +1 -1
- package/dist/cjs/expression/function/impl/CHOOSE.js.map +1 -1
- package/dist/cjs/expression/function/impl/IF.js.map +1 -1
- package/dist/cjs/expression/function/impl/MAP.js.map +1 -1
- package/dist/cjs/expression/function/impl/ReplacePattern.js +20 -2
- package/dist/cjs/expression/function/impl/ReplacePattern.js.map +1 -1
- package/dist/cjs/expression/reference/BuiltinFunctionCallExpr.js +59 -0
- package/dist/cjs/expression/reference/BuiltinFunctionCallExpr.js.map +1 -0
- package/dist/cjs/expression/reference/BuiltinPropertyAccessExpr.js +34 -0
- package/dist/cjs/expression/reference/BuiltinPropertyAccessExpr.js.map +1 -0
- package/dist/cjs/expression/reference/BuiltinRootReferenceExpr.js +29 -0
- package/dist/cjs/expression/reference/BuiltinRootReferenceExpr.js.map +1 -0
- package/dist/cjs/gen/parser/IfcExpressionLexer.js +126 -104
- package/dist/cjs/gen/parser/IfcExpressionLexer.js.map +1 -1
- package/dist/cjs/gen/parser/IfcExpressionListener.js +7 -4
- package/dist/cjs/gen/parser/IfcExpressionListener.js.map +1 -1
- package/dist/cjs/gen/parser/IfcExpressionParser.js +739 -682
- package/dist/cjs/gen/parser/IfcExpressionParser.js.map +1 -1
- package/dist/cjs/gen/parser/IfcExpressionVisitor.js +4 -4
- package/dist/cjs/gen/parser/IfcExpressionVisitor.js.map +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/type/ContextObjectType.js +45 -0
- package/dist/cjs/type/ContextObjectType.js.map +1 -0
- package/dist/cjs/type/Types.js +4 -6
- package/dist/cjs/type/Types.js.map +1 -1
- package/dist/cjs/value/ContextObjectValue.js +23 -0
- package/dist/cjs/value/ContextObjectValue.js.map +1 -0
- package/dist/cjs/value/ExpressionValue.js.map +1 -1
- package/dist/cjs/value/Value.js.map +1 -1
- package/dist/compiler/ExprCompiler.d.ts +8 -3
- package/dist/compiler/ExprManager.d.ts +1 -1
- package/dist/compiler/IfcExpressionValidationListener.d.ts +9 -3
- package/dist/compiler/TypeManager.d.ts +1 -1
- package/dist/context/IfcExpressionContext.d.ts +3 -4
- package/dist/context/NopContext.d.ts +1 -0
- package/dist/documentation/Documentation.d.ts +12 -0
- package/dist/error/ExpressionTypeError.d.ts +1 -1
- package/dist/error/IfcExpressionBuiltinConfigException.d.ts +3 -0
- package/dist/error/InvalidSyntaxException.d.ts +1 -1
- package/dist/error/NoSuchFunctionException.d.ts +1 -1
- package/dist/error/NoSuchMemberException.d.ts +6 -0
- package/dist/error/ValidationException.d.ts +1 -1
- package/dist/error/WrongFunctionArgumentTypeException.d.ts +1 -1
- package/dist/expression/ExprKind.d.ts +3 -0
- package/dist/expression/function/Func.d.ts +7 -21
- package/dist/expression/function/FuncArg.d.ts +6 -5
- package/dist/expression/function/IfcExpressionFunctions.d.ts +1 -0
- package/dist/expression/function/impl/CHOOSE.d.ts +1 -1
- package/dist/expression/function/impl/IF.d.ts +1 -1
- package/dist/expression/function/impl/MAP.d.ts +1 -1
- package/dist/expression/reference/BuiltinFunctionCallExpr.d.ts +19 -0
- package/dist/expression/reference/BuiltinPropertyAccessExpr.d.ts +15 -0
- package/dist/expression/reference/BuiltinRootReferenceExpr.d.ts +14 -0
- package/dist/gen/parser/IfcExpressionLexer.d.ts +9 -8
- package/dist/gen/parser/IfcExpressionListener.d.ts +89 -59
- package/dist/gen/parser/IfcExpressionParser.d.ts +192 -169
- package/dist/gen/parser/IfcExpressionVisitor.d.ts +51 -35
- package/dist/index.d.ts +2 -2
- package/dist/mjs/IfcExpression.js +104 -32
- package/dist/mjs/IfcExpression.js.map +1 -1
- package/dist/mjs/IfcExpressionErrorListener.js +3 -8
- package/dist/mjs/IfcExpressionErrorListener.js.map +1 -1
- package/dist/mjs/IfcExpressionOptions.js +2 -0
- package/dist/mjs/IfcExpressionOptions.js.map +1 -0
- package/dist/mjs/autocomplete/CompletionItem.js +2 -0
- package/dist/mjs/autocomplete/CompletionItem.js.map +1 -0
- package/dist/mjs/autocomplete/IfcExpressionAutocomplete.js +650 -0
- package/dist/mjs/autocomplete/IfcExpressionAutocomplete.js.map +1 -0
- package/dist/mjs/builtin/BuiltinRuntimeValueConverter.js +117 -0
- package/dist/mjs/builtin/BuiltinRuntimeValueConverter.js.map +1 -0
- package/dist/mjs/builtin/BuiltinVariableRegistry.js +399 -0
- package/dist/mjs/builtin/BuiltinVariableRegistry.js.map +1 -0
- package/dist/mjs/compiler/ExprCompiler.js +43 -40
- package/dist/mjs/compiler/ExprCompiler.js.map +1 -1
- package/dist/mjs/compiler/ExprManager.js.map +1 -1
- package/dist/mjs/compiler/IfcExpressionValidationListener.js +85 -22
- package/dist/mjs/compiler/IfcExpressionValidationListener.js.map +1 -1
- package/dist/mjs/compiler/TypeManager.js.map +1 -1
- package/dist/mjs/context/IfcExpressionContext.js.map +1 -1
- package/dist/mjs/context/NopContext.js +3 -0
- package/dist/mjs/context/NopContext.js.map +1 -1
- package/dist/mjs/documentation/Documentation.js +7 -0
- package/dist/mjs/documentation/Documentation.js.map +1 -0
- package/dist/mjs/error/ExpressionTypeError.js.map +1 -1
- package/dist/mjs/error/IfcExpressionBuiltinConfigException.js +6 -0
- package/dist/mjs/error/IfcExpressionBuiltinConfigException.js.map +1 -0
- package/dist/mjs/error/InvalidSyntaxException.js.map +1 -1
- package/dist/mjs/error/NoSuchFunctionException.js.map +1 -1
- package/dist/mjs/error/NoSuchMemberException.js +9 -0
- package/dist/mjs/error/NoSuchMemberException.js.map +1 -0
- package/dist/mjs/error/ValidationException.js.map +1 -1
- package/dist/mjs/error/WrongFunctionArgumentTypeException.js.map +1 -1
- package/dist/mjs/expression/ExprKind.js +3 -0
- package/dist/mjs/expression/ExprKind.js.map +1 -1
- package/dist/mjs/expression/function/Func.js +18 -14
- package/dist/mjs/expression/function/Func.js.map +1 -1
- package/dist/mjs/expression/function/FuncArg.js +11 -5
- package/dist/mjs/expression/function/FuncArg.js.map +1 -1
- package/dist/mjs/expression/function/IfcExpressionFunctions.js +198 -42
- package/dist/mjs/expression/function/IfcExpressionFunctions.js.map +1 -1
- package/dist/mjs/expression/function/impl/CHOOSE.js.map +1 -1
- package/dist/mjs/expression/function/impl/IF.js.map +1 -1
- package/dist/mjs/expression/function/impl/MAP.js.map +1 -1
- package/dist/mjs/expression/function/impl/ReplacePattern.js +20 -2
- package/dist/mjs/expression/function/impl/ReplacePattern.js.map +1 -1
- package/dist/mjs/expression/reference/BuiltinFunctionCallExpr.js +55 -0
- package/dist/mjs/expression/reference/BuiltinFunctionCallExpr.js.map +1 -0
- package/dist/mjs/expression/reference/BuiltinPropertyAccessExpr.js +30 -0
- package/dist/mjs/expression/reference/BuiltinPropertyAccessExpr.js.map +1 -0
- package/dist/mjs/expression/reference/BuiltinRootReferenceExpr.js +25 -0
- package/dist/mjs/expression/reference/BuiltinRootReferenceExpr.js.map +1 -0
- package/dist/mjs/gen/parser/IfcExpressionLexer.js +101 -104
- package/dist/mjs/gen/parser/IfcExpressionLexer.js.map +1 -1
- package/dist/mjs/gen/parser/IfcExpressionListener.js +5 -3
- package/dist/mjs/gen/parser/IfcExpressionListener.js.map +1 -1
- package/dist/mjs/gen/parser/IfcExpressionParser.js +700 -670
- package/dist/mjs/gen/parser/IfcExpressionParser.js.map +1 -1
- package/dist/mjs/gen/parser/IfcExpressionVisitor.js +2 -3
- package/dist/mjs/gen/parser/IfcExpressionVisitor.js.map +1 -1
- package/dist/mjs/index.js +1 -1
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/type/ContextObjectType.js +41 -0
- package/dist/mjs/type/ContextObjectType.js.map +1 -0
- package/dist/mjs/type/Types.js +4 -6
- package/dist/mjs/type/Types.js.map +1 -1
- package/dist/mjs/value/ContextObjectValue.js +19 -0
- package/dist/mjs/value/ContextObjectValue.js.map +1 -0
- package/dist/mjs/value/ExpressionValue.js.map +1 -1
- package/dist/mjs/value/Value.js.map +1 -1
- package/dist/type/ContextObjectType.d.ts +17 -0
- package/dist/type/Types.d.ts +2 -6
- package/dist/value/ContextObjectValue.d.ts +11 -0
- package/dist/value/ExpressionValue.d.ts +2 -1
- package/dist/value/Value.d.ts +1 -1
- package/package.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/gen/parser/IfcExpressionVisitor.ts"],"names":[],"mappings":";AAAA,kDAAkD;;AAElD,mCAAwC;AAgCxC;;;;;;GAMG;AACH,MAAqB,oBAA6B,SAAQ,yBAAwB;CAmLjF;AAnLD,uCAmLC","file":"gen/parser/IfcExpressionVisitor.js","sourcesContent":["// Generated from IfcExpression.g4 by ANTLR 4.13.0\n\nimport {ParseTreeVisitor} from 'antlr4';\n\n\nimport { ExprContext } from \"./IfcExpressionParser\";\nimport { SEComparisonContext } from \"./IfcExpressionParser\";\nimport { SELiteralContext } from \"./IfcExpressionParser\";\nimport { SEParenthesisContext } from \"./IfcExpressionParser\";\nimport { SEMulDivContext } from \"./IfcExpressionParser\";\nimport { SEPowerContext } from \"./IfcExpressionParser\";\nimport { SEBooleanBinaryOpContext } from \"./IfcExpressionParser\";\nimport { SEFunctionCallContext } from \"./IfcExpressionParser\";\nimport { SEArrayExprContext } from \"./IfcExpressionParser\";\nimport { SENotContext } from \"./IfcExpressionParser\";\nimport { SEVariableRefContext } from \"./IfcExpressionParser\";\nimport { SEUnaryMultipleMinusContext } from \"./IfcExpressionParser\";\nimport { SEUnaryMinusContext } from \"./IfcExpressionParser\";\nimport { SEAddSubContext } from \"./IfcExpressionParser\";\nimport { SEMethodCallContext } from \"./IfcExpressionParser\";\nimport { MethodCallChainInnerContext } from \"./IfcExpressionParser\";\nimport { MethodCallChainEndContext } from \"./IfcExpressionParser\";\nimport { FunctionCallContext } from \"./IfcExpressionParser\";\nimport { ExprListContext } from \"./IfcExpressionParser\";\nimport { ArrayExprContext } from \"./IfcExpressionParser\";\nimport { ArrayElementListContext } from \"./IfcExpressionParser\";\nimport { LiteralContext } from \"./IfcExpressionParser\";\nimport { NumLiteralContext } from \"./IfcExpressionParser\";\nimport { StringLiteralContext } from \"./IfcExpressionParser\";\nimport { BooleanLiteralContext } from \"./IfcExpressionParser\";\nimport { LogicalLiteralContext } from \"./IfcExpressionParser\";\nimport { VariableRefContext } from \"./IfcExpressionParser\";\n\n\n/**\n * This interface defines a complete generic visitor for a parse tree produced\n * by `IfcExpressionParser`.\n *\n * @param <Result> The return type of the visit operation. Use `void` for\n * operations with no return type.\n */\nexport default class IfcExpressionVisitor<Result> extends ParseTreeVisitor<Result> {\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.expr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitExpr?: (ctx: ExprContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEComparison`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEComparison?: (ctx: SEComparisonContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SELiteral`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSELiteral?: (ctx: SELiteralContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEParenthesis`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEParenthesis?: (ctx: SEParenthesisContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEMulDiv`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEMulDiv?: (ctx: SEMulDivContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEPower`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEPower?: (ctx: SEPowerContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEBooleanBinaryOp`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEBooleanBinaryOp?: (ctx: SEBooleanBinaryOpContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEFunctionCall`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEFunctionCall?: (ctx: SEFunctionCallContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEArrayExpr`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEArrayExpr?: (ctx: SEArrayExprContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SENot`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSENot?: (ctx: SENotContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEVariableRef`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEVariableRef?: (ctx: SEVariableRefContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEUnaryMultipleMinus`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEUnaryMultipleMinus?: (ctx: SEUnaryMultipleMinusContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEUnaryMinus`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEUnaryMinus?: (ctx: SEUnaryMinusContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEAddSub`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEAddSub?: (ctx: SEAddSubContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `SEMethodCall`\n\t * labeled alternative in `IfcExpressionParser.singleExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitSEMethodCall?: (ctx: SEMethodCallContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `methodCallChainInner`\n\t * labeled alternative in `IfcExpressionParser.methodCallChain`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitMethodCallChainInner?: (ctx: MethodCallChainInnerContext) => Result;\n\t/**\n\t * Visit a parse tree produced by the `methodCallChainEnd`\n\t * labeled alternative in `IfcExpressionParser.methodCallChain`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitMethodCallChainEnd?: (ctx: MethodCallChainEndContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.functionCall`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitFunctionCall?: (ctx: FunctionCallContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.exprList`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitExprList?: (ctx: ExprListContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.arrayExpr`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitArrayExpr?: (ctx: ArrayExprContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.arrayElementList`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitArrayElementList?: (ctx: ArrayElementListContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.literal`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitLiteral?: (ctx: LiteralContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.numLiteral`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitNumLiteral?: (ctx: NumLiteralContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.stringLiteral`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitStringLiteral?: (ctx: StringLiteralContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.booleanLiteral`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitBooleanLiteral?: (ctx: BooleanLiteralContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.logicalLiteral`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitLogicalLiteral?: (ctx: LogicalLiteralContext) => Result;\n\t/**\n\t * Visit a parse tree produced by `IfcExpressionParser.variableRef`.\n\t * @param ctx the parse tree\n\t * @return the visitor result\n\t */\n\tvisitVariableRef?: (ctx: VariableRefContext) => Result;\n}\n\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/gen/parser/IfcExpressionVisitor.ts"],"names":[],"mappings":";;;AACA,uCAAoD;AAkCpD;;;;;;GAMG;AACH,MAAa,oBAA6B,SAAQ,mCAAgC;CAiMjF;AAjMD,oDAiMC","file":"gen/parser/IfcExpressionVisitor.js","sourcesContent":["\nimport { AbstractParseTreeVisitor } from \"antlr4ng\";\n\n\nimport { ExprContext } from \"./IfcExpressionParser.js\";\nimport { SEUnaryMultipleMinusContext } from \"./IfcExpressionParser.js\";\nimport { SEParenthesisContext } from \"./IfcExpressionParser.js\";\nimport { SEUnaryMinusContext } from \"./IfcExpressionParser.js\";\nimport { SENotContext } from \"./IfcExpressionParser.js\";\nimport { SEVariableRefContext } from \"./IfcExpressionParser.js\";\nimport { SEFunctionCallContext } from \"./IfcExpressionParser.js\";\nimport { SELiteralContext } from \"./IfcExpressionParser.js\";\nimport { SEArrayExprContext } from \"./IfcExpressionParser.js\";\nimport { SEPowerContext } from \"./IfcExpressionParser.js\";\nimport { SEMulDivContext } from \"./IfcExpressionParser.js\";\nimport { SEAddSubContext } from \"./IfcExpressionParser.js\";\nimport { SEComparisonContext } from \"./IfcExpressionParser.js\";\nimport { SEBooleanBinaryOpContext } from \"./IfcExpressionParser.js\";\nimport { SEMethodCallContext } from \"./IfcExpressionParser.js\";\nimport { MethodCallChainInnerContext } from \"./IfcExpressionParser.js\";\nimport { MethodCallChainEndContext } from \"./IfcExpressionParser.js\";\nimport { MethodFunctionCallContext } from \"./IfcExpressionParser.js\";\nimport { MethodPropertyAccessContext } from \"./IfcExpressionParser.js\";\nimport { FunctionCallContext } from \"./IfcExpressionParser.js\";\nimport { ExprListContext } from \"./IfcExpressionParser.js\";\nimport { ArrayExprContext } from \"./IfcExpressionParser.js\";\nimport { ArrayElementListContext } from \"./IfcExpressionParser.js\";\nimport { LiteralContext } from \"./IfcExpressionParser.js\";\nimport { NumLiteralContext } from \"./IfcExpressionParser.js\";\nimport { StringLiteralContext } from \"./IfcExpressionParser.js\";\nimport { BooleanLiteralContext } from \"./IfcExpressionParser.js\";\nimport { LogicalLiteralContext } from \"./IfcExpressionParser.js\";\nimport { VariableRefContext } from \"./IfcExpressionParser.js\";\n\n\n/**\n * This interface defines a complete generic visitor for a parse tree produced\n * by `IfcExpressionParser`.\n *\n * @param <Result> The return type of the visit operation. Use `void` for\n * operations with no return type.\n */\nexport class IfcExpressionVisitor<Result> extends AbstractParseTreeVisitor<Result> {\n /**\n * Visit a parse tree produced by `IfcExpressionParser.expr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitExpr?: (ctx: ExprContext) => Result;\n /**\n * Visit a parse tree produced by the `SEUnaryMultipleMinus`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEUnaryMultipleMinus?: (ctx: SEUnaryMultipleMinusContext) => Result;\n /**\n * Visit a parse tree produced by the `SEParenthesis`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEParenthesis?: (ctx: SEParenthesisContext) => Result;\n /**\n * Visit a parse tree produced by the `SEUnaryMinus`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEUnaryMinus?: (ctx: SEUnaryMinusContext) => Result;\n /**\n * Visit a parse tree produced by the `SENot`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSENot?: (ctx: SENotContext) => Result;\n /**\n * Visit a parse tree produced by the `SEVariableRef`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEVariableRef?: (ctx: SEVariableRefContext) => Result;\n /**\n * Visit a parse tree produced by the `SEFunctionCall`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEFunctionCall?: (ctx: SEFunctionCallContext) => Result;\n /**\n * Visit a parse tree produced by the `SELiteral`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSELiteral?: (ctx: SELiteralContext) => Result;\n /**\n * Visit a parse tree produced by the `SEArrayExpr`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEArrayExpr?: (ctx: SEArrayExprContext) => Result;\n /**\n * Visit a parse tree produced by the `SEPower`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEPower?: (ctx: SEPowerContext) => Result;\n /**\n * Visit a parse tree produced by the `SEMulDiv`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEMulDiv?: (ctx: SEMulDivContext) => Result;\n /**\n * Visit a parse tree produced by the `SEAddSub`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEAddSub?: (ctx: SEAddSubContext) => Result;\n /**\n * Visit a parse tree produced by the `SEComparison`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEComparison?: (ctx: SEComparisonContext) => Result;\n /**\n * Visit a parse tree produced by the `SEBooleanBinaryOp`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEBooleanBinaryOp?: (ctx: SEBooleanBinaryOpContext) => Result;\n /**\n * Visit a parse tree produced by the `SEMethodCall`\n * labeled alternative in `IfcExpressionParser.singleExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitSEMethodCall?: (ctx: SEMethodCallContext) => Result;\n /**\n * Visit a parse tree produced by the `methodCallChainInner`\n * labeled alternative in `IfcExpressionParser.methodCallChain`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitMethodCallChainInner?: (ctx: MethodCallChainInnerContext) => Result;\n /**\n * Visit a parse tree produced by the `methodCallChainEnd`\n * labeled alternative in `IfcExpressionParser.methodCallChain`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitMethodCallChainEnd?: (ctx: MethodCallChainEndContext) => Result;\n /**\n * Visit a parse tree produced by the `MethodFunctionCall`\n * labeled alternative in `IfcExpressionParser.methodAccessor`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitMethodFunctionCall?: (ctx: MethodFunctionCallContext) => Result;\n /**\n * Visit a parse tree produced by the `MethodPropertyAccess`\n * labeled alternative in `IfcExpressionParser.methodAccessor`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitMethodPropertyAccess?: (ctx: MethodPropertyAccessContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.functionCall`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitFunctionCall?: (ctx: FunctionCallContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.exprList`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitExprList?: (ctx: ExprListContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.arrayExpr`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitArrayExpr?: (ctx: ArrayExprContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.arrayElementList`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitArrayElementList?: (ctx: ArrayElementListContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.literal`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitLiteral?: (ctx: LiteralContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.numLiteral`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitNumLiteral?: (ctx: NumLiteralContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.stringLiteral`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitStringLiteral?: (ctx: StringLiteralContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.booleanLiteral`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitBooleanLiteral?: (ctx: BooleanLiteralContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.logicalLiteral`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitLogicalLiteral?: (ctx: LogicalLiteralContext) => Result;\n /**\n * Visit a parse tree produced by `IfcExpressionParser.variableRef`.\n * @param ctx the parse tree\n * @return the visitor result\n */\n visitVariableRef?: (ctx: VariableRefContext) => Result;\n}\n\n"]}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.E = exports.Types = exports.TypeDisjunction = exports.TupleType = exports.SimpleType = exports.ArrayType = exports.ExprFacade = exports.ExprToTextInputLinker = exports.isExprEvalSuccess = exports.isExprEvalError = exports.isNullish = exports.isPresent = exports.IfcExpressionVisitor = exports.IfcExpressionErrorListener = exports.IfcExpressionEvaluationException = exports.ExprKind = exports.ExprCompiler = exports.NamedObjectAccessor = exports.IfcTypeObjectAccessor = exports.IfcRootObjectAccessor = exports.IfcPropertyAccessor = exports.IfcPropertySetAccessor = exports.IfcTimeStampValue = exports.IfcDurationValue = exports.IfcTimeValue = exports.IfcDateTimeValue = exports.IfcDateValue = exports.ReferenceValue = exports.NumericValue = exports.LogicalValue = exports.BooleanValue = exports.StringValue = exports.IfcElementAccessor = exports.IfcExpressionParseResult = exports.IfcExpression = void 0;
|
|
3
|
+
exports.E = exports.IfcExpressionAutocomplete = exports.BuiltinVariableRegistry = exports.ContextObjectType = exports.Types = exports.TypeDisjunction = exports.TupleType = exports.SimpleType = exports.ArrayType = exports.ExprFacade = exports.ExprToTextInputLinker = exports.isExprEvalSuccess = exports.isExprEvalError = exports.isNullish = exports.isPresent = exports.IfcExpressionVisitor = exports.IfcExpressionErrorListener = exports.IfcExpressionEvaluationException = exports.ExprKind = exports.ExprCompiler = exports.NamedObjectAccessor = exports.IfcTypeObjectAccessor = exports.IfcRootObjectAccessor = exports.IfcPropertyAccessor = exports.IfcPropertySetAccessor = exports.IfcTimeStampValue = exports.IfcDurationValue = exports.IfcTimeValue = exports.IfcDateTimeValue = exports.IfcDateValue = exports.ReferenceValue = exports.NumericValue = exports.LogicalValue = exports.BooleanValue = exports.StringValue = exports.IfcElementAccessor = exports.IfcExpressionParseResult = exports.IfcExpression = void 0;
|
|
4
4
|
var IfcExpression_js_1 = require("./IfcExpression.js");
|
|
5
5
|
Object.defineProperty(exports, "IfcExpression", { enumerable: true, get: function () { return IfcExpression_js_1.IfcExpression; } });
|
|
6
6
|
Object.defineProperty(exports, "IfcExpressionParseResult", { enumerable: true, get: function () { return IfcExpression_js_1.IfcExpressionParseResult; } });
|
|
@@ -36,6 +36,9 @@ Object.defineProperty(exports, "SimpleType", { enumerable: true, get: function (
|
|
|
36
36
|
Object.defineProperty(exports, "TupleType", { enumerable: true, get: function () { return IfcExpression_js_1.TupleType; } });
|
|
37
37
|
Object.defineProperty(exports, "TypeDisjunction", { enumerable: true, get: function () { return IfcExpression_js_1.TypeDisjunction; } });
|
|
38
38
|
Object.defineProperty(exports, "Types", { enumerable: true, get: function () { return IfcExpression_js_1.Types; } });
|
|
39
|
+
Object.defineProperty(exports, "ContextObjectType", { enumerable: true, get: function () { return IfcExpression_js_1.ContextObjectType; } });
|
|
40
|
+
Object.defineProperty(exports, "BuiltinVariableRegistry", { enumerable: true, get: function () { return IfcExpression_js_1.BuiltinVariableRegistry; } });
|
|
41
|
+
Object.defineProperty(exports, "IfcExpressionAutocomplete", { enumerable: true, get: function () { return IfcExpression_js_1.IfcExpressionAutocomplete; } });
|
|
39
42
|
var E_js_1 = require("./E.js");
|
|
40
43
|
Object.defineProperty(exports, "E", { enumerable: true, get: function () { return E_js_1.E; } });
|
|
41
44
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,uDA8C4B;AA7C1B,iHAAA,aAAa,OAAA;AACb,4HAAA,wBAAwB,OAAA;AACxB,sHAAA,kBAAkB,OAAA;AAGlB,+GAAA,WAAW,OAAA;AACX,gHAAA,YAAY,OAAA;AACZ,gHAAA,YAAY,OAAA;AACZ,gHAAA,YAAY,OAAA;AAEZ,kHAAA,cAAc,OAAA;AACd,gHAAA,YAAY,OAAA;AACZ,oHAAA,gBAAgB,OAAA;AAChB,gHAAA,YAAY,OAAA;AACZ,oHAAA,gBAAgB,OAAA;AAChB,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,yHAAA,qBAAqB,OAAA;AACrB,yHAAA,qBAAqB,OAAA;AACrB,uHAAA,mBAAmB,OAAA;AAGnB,gHAAA,YAAY,OAAA;AACZ,4GAAA,QAAQ,OAAA;AACR,oIAAA,gCAAgC,OAAA;AAChC,8HAAA,0BAA0B,OAAA;AAC1B,wHAAA,oBAAoB,OAAA;AACpB,6GAAA,SAAS,OAAA;AACT,6GAAA,SAAS,OAAA;AAGT,mHAAA,eAAe,OAAA;AACf,qHAAA,iBAAiB,OAAA;AACjB,yHAAA,qBAAqB,OAAA;AACrB,8GAAA,UAAU,OAAA;AAEV,6GAAA,SAAS,OAAA;AACT,8GAAA,UAAU,OAAA;AACV,6GAAA,SAAS,OAAA;AACT,mHAAA,eAAe,OAAA;AACf,yGAAA,KAAK,OAAA;AACL,qHAAA,iBAAiB,OAAA;AACjB,2HAAA,uBAAuB,OAAA;AACvB,6HAAA,yBAAyB,OAAA;AAU3B,+BAA2B;AAAlB,yFAAA,CAAC,OAAA","file":"index.js","sourcesContent":["export {\n IfcExpression,\n IfcExpressionParseResult,\n IfcElementAccessor,\n IfcExpressionContext,\n Value,\n StringValue,\n BooleanValue,\n LogicalValue,\n NumericValue,\n ExpressionValue,\n ReferenceValue,\n IfcDateValue,\n IfcDateTimeValue,\n IfcTimeValue,\n IfcDurationValue,\n IfcTimeStampValue,\n IfcPropertySetAccessor,\n IfcPropertyAccessor,\n IfcRootObjectAccessor,\n IfcTypeObjectAccessor,\n NamedObjectAccessor,\n ObjectAccessor,\n Expr,\n ExprCompiler,\n ExprKind,\n IfcExpressionEvaluationException,\n IfcExpressionErrorListener,\n IfcExpressionVisitor,\n isPresent,\n isNullish,\n ExprEvalResult,\n ExprEvalError,\n isExprEvalError,\n isExprEvalSuccess,\n ExprToTextInputLinker,\n ExprFacade,\n ExprType,\n ArrayType,\n SimpleType,\n TupleType,\n TypeDisjunction,\n Types,\n ContextObjectType,\n BuiltinVariableRegistry,\n IfcExpressionAutocomplete,\n} from \"./IfcExpression.js\";\n\nexport type {\n BoxedValueTypes,\n CompletionItem,\n CompletionResult,\n IfcExpressionOptions,\n} from \"./IfcExpression.js\";\n\nexport { E } from \"./E.js\";\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextObjectType = void 0;
|
|
4
|
+
class ContextObjectType {
|
|
5
|
+
constructor(name, baseType, members) {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.baseType = baseType;
|
|
8
|
+
this.members = members;
|
|
9
|
+
}
|
|
10
|
+
static fromBuiltinDefinition(definition) {
|
|
11
|
+
return new ContextObjectType(definition.name, definition.type, definition.members);
|
|
12
|
+
}
|
|
13
|
+
getMemberDefinition(name) {
|
|
14
|
+
return this.members.get(name?.replace(/^\$/, "").toUpperCase());
|
|
15
|
+
}
|
|
16
|
+
getMemberDefinitions() {
|
|
17
|
+
return [...this.members.values()];
|
|
18
|
+
}
|
|
19
|
+
getName() {
|
|
20
|
+
return this.name;
|
|
21
|
+
}
|
|
22
|
+
isSuperTypeOf(other) {
|
|
23
|
+
return other.isSubTypeOf(this);
|
|
24
|
+
}
|
|
25
|
+
isSameTypeAs(other) {
|
|
26
|
+
return this === other || other.getName() === this.getName();
|
|
27
|
+
}
|
|
28
|
+
isSubTypeOf(other) {
|
|
29
|
+
return (this.baseType.isSameTypeAs(other) || this.baseType.isSubTypeOf(other));
|
|
30
|
+
}
|
|
31
|
+
overlapsWith(other) {
|
|
32
|
+
if (this.isSameTypeAs(other)) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if (other instanceof ContextObjectType) {
|
|
36
|
+
return this.baseType.overlapsWith(other.baseType);
|
|
37
|
+
}
|
|
38
|
+
return this.baseType.overlapsWith(other);
|
|
39
|
+
}
|
|
40
|
+
isAssignableFrom(other) {
|
|
41
|
+
return this.isSameTypeAs(other) || this.isSuperTypeOf(other);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ContextObjectType = ContextObjectType;
|
|
45
|
+
//# sourceMappingURL=ContextObjectType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/type/ContextObjectType.ts"],"names":[],"mappings":";;;AAMA,MAAa,iBAAiB;IAK5B,YACE,IAAY,EACZ,QAAkB,EAClB,OAA6C;QAE7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,qBAAqB,CACjC,UAA+C;QAE/C,OAAO,IAAI,iBAAiB,CAC1B,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,OAAO,CACnB,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,oBAAoB;QAClB,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,aAAa,CAAC,KAAe;QAC3B,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,YAAY,CAAC,KAAe;QAC1B,OAAO,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;IAC9D,CAAC;IAED,WAAW,CAAC,KAAe;QACzB,OAAO,CACL,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CACtE,CAAC;IACJ,CAAC;IAED,YAAY,CAAC,KAAe;QAC1B,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC;SACb;QACD,IAAI,KAAK,YAAY,iBAAiB,EAAE;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACnD;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,gBAAgB,CAAC,KAAe;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;CACF;AAhED,8CAgEC","file":"type/ContextObjectType.js","sourcesContent":["import { ExprType } from \"./ExprType.js\";\nimport {\n BuiltinMemberDefinition,\n RegisteredBuiltinVariableDefinition,\n} from \"../builtin/BuiltinVariableRegistry.js\";\n\nexport class ContextObjectType implements ExprType {\n private readonly name: string;\n private readonly baseType: ExprType;\n private readonly members: Map<string, BuiltinMemberDefinition>;\n\n constructor(\n name: string,\n baseType: ExprType,\n members: Map<string, BuiltinMemberDefinition>\n ) {\n this.name = name;\n this.baseType = baseType;\n this.members = members;\n }\n\n public static fromBuiltinDefinition(\n definition: RegisteredBuiltinVariableDefinition\n ) {\n return new ContextObjectType(\n definition.name,\n definition.type,\n definition.members\n );\n }\n\n getMemberDefinition(name: string): BuiltinMemberDefinition | undefined {\n return this.members.get(name?.replace(/^\\$/, \"\").toUpperCase());\n }\n\n getMemberDefinitions(): Array<BuiltinMemberDefinition> {\n return [...this.members.values()];\n }\n\n getName(): string {\n return this.name;\n }\n\n isSuperTypeOf(other: ExprType): boolean {\n return other.isSubTypeOf(this);\n }\n\n isSameTypeAs(other: ExprType): boolean {\n return this === other || other.getName() === this.getName();\n }\n\n isSubTypeOf(other: ExprType): boolean {\n return (\n this.baseType.isSameTypeAs(other) || this.baseType.isSubTypeOf(other)\n );\n }\n\n overlapsWith(other: ExprType): boolean {\n if (this.isSameTypeAs(other)) {\n return true;\n }\n if (other instanceof ContextObjectType) {\n return this.baseType.overlapsWith(other.baseType);\n }\n return this.baseType.overlapsWith(other);\n }\n\n isAssignableFrom(other: ExprType) {\n return this.isSameTypeAs(other) || this.isSuperTypeOf(other);\n }\n}\n"]}
|
package/dist/cjs/type/Types.js
CHANGED
|
@@ -23,6 +23,7 @@ Type.IFC_ELEMENT_REF = new SimpleType_js_1.SimpleType("ifcElementRef", Type.IFC_
|
|
|
23
23
|
Type.IFC_PROPERTY_REF = new SimpleType_js_1.SimpleType("ifcPropertyRef", Type.IFC_OBJECT_REF);
|
|
24
24
|
Type.IFC_PROPERTY_SET_REF = new SimpleType_js_1.SimpleType("ifcPropertySetRef", Type.IFC_OBJECT_REF);
|
|
25
25
|
Type.IFC_TYPE_OBJECT_REF = new SimpleType_js_1.SimpleType("ifcTypeObjectRef", Type.IFC_OBJECT_REF);
|
|
26
|
+
Type.CONTEXT_OBJECT_REF = new SimpleType_js_1.SimpleType("contextObjectRef");
|
|
26
27
|
Type.ARRAY = new SimpleType_js_1.SimpleType("array");
|
|
27
28
|
class Types {
|
|
28
29
|
static or(...types) {
|
|
@@ -98,17 +99,14 @@ class Types {
|
|
|
98
99
|
static ifcObjectRef() {
|
|
99
100
|
return Type.IFC_OBJECT_REF;
|
|
100
101
|
}
|
|
102
|
+
static contextObjectRef() {
|
|
103
|
+
return Type.CONTEXT_OBJECT_REF;
|
|
104
|
+
}
|
|
101
105
|
static requireIsAssignableFrom(expectedType, actualType, exceptionProducer) {
|
|
102
106
|
if (!expectedType.isAssignableFrom(actualType)) {
|
|
103
107
|
throw exceptionProducer();
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Requires overlap if actual is a disjunction, assignable from if it is a type
|
|
108
|
-
* @param expectedType
|
|
109
|
-
* @param actualType
|
|
110
|
-
* @param exceptionProducer
|
|
111
|
-
*/
|
|
112
110
|
static requireWeakIsAssignableFrom(expectedType, actualType, exceptionProducer) {
|
|
113
111
|
if (expectedType.isAssignableFrom(actualType)) {
|
|
114
112
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/type/Types.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAC7C,6DAAuD;AAEvD,iDAA2C;AAC3C,iDAA2C;AAE3C,MAAa,IAAI;;AAAjB,
|
|
1
|
+
{"version":3,"sources":["../../src/type/Types.ts"],"names":[],"mappings":"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","file":"type/Types.js","sourcesContent":["import { ExpressionTypeError } from \"../error/ExpressionTypeError.js\";\nimport { SimpleType } from \"./SimpleType.js\";\nimport { TypeDisjunction } from \"./TypeDisjunction.js\";\nimport { ExprType } from \"./ExprType.js\";\nimport { ArrayType } from \"./ArrayType.js\";\nimport { TupleType } from \"./TupleType.js\";\n\nexport class Type {\n static readonly ANY = new SimpleType(\"any\");\n static readonly NUMERIC = new SimpleType(\"numeric\");\n static readonly STRING = new SimpleType(\"string\");\n static readonly LOGICAL = new SimpleType(\"logical\");\n static readonly BOOLEAN = new SimpleType(\"boolean\", Type.LOGICAL);\n static readonly IFC_DATE = new SimpleType(\"ifcDate\", Type.STRING);\n static readonly IFC_DATE_TIME = new SimpleType(\"ifcDateTime\", Type.STRING);\n static readonly IFC_TIME = new SimpleType(\"ifcTime\", Type.STRING);\n static readonly IFC_DURATION = new SimpleType(\"ifcDuration\", Type.STRING);\n static readonly IFC_TIME_STAMP = new SimpleType(\"ifcTimeStamp\", Type.NUMERIC);\n\n static readonly IFC_OBJECT_REF = new SimpleType(\"ifcObjectRef\");\n static readonly IFC_ELEMENT_REF = new SimpleType(\n \"ifcElementRef\",\n Type.IFC_OBJECT_REF\n );\n static readonly IFC_PROPERTY_REF = new SimpleType(\n \"ifcPropertyRef\",\n Type.IFC_OBJECT_REF\n );\n static readonly IFC_PROPERTY_SET_REF = new SimpleType(\n \"ifcPropertySetRef\",\n Type.IFC_OBJECT_REF\n );\n static readonly IFC_TYPE_OBJECT_REF = new SimpleType(\n \"ifcTypeObjectRef\",\n Type.IFC_OBJECT_REF\n );\n static readonly CONTEXT_OBJECT_REF = new SimpleType(\"contextObjectRef\");\n static readonly ARRAY = new SimpleType(\"array\");\n}\n\nexport class Types {\n public static or(...types: Array<ExprType>) {\n const disjunction = new TypeDisjunction(...types);\n if (disjunction.getTypes().length == 1) {\n return disjunction.getTypes()[0];\n }\n return disjunction;\n }\n public static array(elementType: ExprType): ArrayType {\n return new ArrayType(elementType);\n }\n public static tuple(...types: Array<ExprType>): TupleType {\n return new TupleType(...types);\n }\n public static isNumeric(actualType: ExprType) {\n return this.isType(actualType, Type.NUMERIC);\n }\n public static isBoolean(actualType: ExprType) {\n return this.isType(actualType, Type.BOOLEAN);\n }\n public static isLogical(actualType: ExprType) {\n return this.isType(actualType, Type.LOGICAL);\n }\n public static isString(actualType: ExprType) {\n return this.isType(actualType, Type.STRING);\n }\n public static isIfcDate(actualType: ExprType) {\n return this.isType(actualType, Type.IFC_DATE);\n }\n public static isIfcDateTime(actualType: ExprType) {\n return this.isType(actualType, Type.IFC_DATE_TIME);\n }\n public static isIfcTime(actualType: ExprType) {\n return this.isType(actualType, Type.IFC_TIME);\n }\n public static isIfcDuration(actualType: ExprType) {\n return this.isType(actualType, Type.IFC_DURATION);\n }\n public static isIfcTimeStamp(actualType: ExprType) {\n return this.isType(actualType, Type.IFC_TIME_STAMP);\n }\n public static isType(actualType: ExprType, type: ExprType) {\n return actualType === type;\n }\n public static boolean() {\n return Type.BOOLEAN;\n }\n public static logical() {\n return Type.LOGICAL;\n }\n public static string() {\n return Type.STRING;\n }\n public static ifcDate() {\n return Type.IFC_DATE;\n }\n public static ifcDateTime() {\n return Type.IFC_DATE_TIME;\n }\n public static ifcTime() {\n return Type.IFC_TIME;\n }\n public static ifcDuration() {\n return Type.IFC_DURATION;\n }\n public static ifcTimeStamp() {\n return Type.IFC_TIME_STAMP;\n }\n public static numeric() {\n return Type.NUMERIC;\n }\n public static ifcObjectRef() {\n return Type.IFC_OBJECT_REF;\n }\n public static contextObjectRef() {\n return Type.CONTEXT_OBJECT_REF;\n }\n\n public static requireIsAssignableFrom(\n expectedType: ExprType,\n actualType: ExprType,\n exceptionProducer: () => ExpressionTypeError\n ) {\n if (!expectedType.isAssignableFrom(actualType)) {\n throw exceptionProducer();\n }\n }\n\n public static requireWeakIsAssignableFrom(\n expectedType: ExprType,\n actualType: ExprType,\n exceptionProducer: () => ExpressionTypeError\n ) {\n if (expectedType.isAssignableFrom(actualType)) {\n return;\n }\n if (actualType instanceof TypeDisjunction) {\n if (expectedType.overlapsWith(actualType)) {\n return;\n }\n }\n if (actualType instanceof TupleType) {\n const weakerType = Types.array(Types.or(...actualType.getTypes()));\n if (expectedType.isAssignableFrom(weakerType)) {\n return;\n }\n }\n throw exceptionProducer();\n }\n\n static requireTypesOverlap(\n actualType: ExprType,\n actualType2: ExprType,\n exceptionProducer: () => ExpressionTypeError\n ) {\n if (!actualType.overlapsWith(actualType2)) {\n throw exceptionProducer();\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextObjectValue = void 0;
|
|
4
|
+
class ContextObjectValue {
|
|
5
|
+
constructor(value, type) {
|
|
6
|
+
this.contextObjectValue = value;
|
|
7
|
+
this.type = type;
|
|
8
|
+
}
|
|
9
|
+
getValue() {
|
|
10
|
+
return this.contextObjectValue;
|
|
11
|
+
}
|
|
12
|
+
equals(other) {
|
|
13
|
+
return this.contextObjectValue === other?.getValue();
|
|
14
|
+
}
|
|
15
|
+
toString() {
|
|
16
|
+
return "[Context object]";
|
|
17
|
+
}
|
|
18
|
+
getType() {
|
|
19
|
+
return this.type;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ContextObjectValue = ContextObjectValue;
|
|
23
|
+
//# sourceMappingURL=ContextObjectValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/value/ContextObjectValue.ts"],"names":[],"mappings":";;;AAGA,MAAa,kBAAkB;IAI7B,YAAY,KAA8B,EAAE,IAAc;QACxD,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,KAAiB;QACtB,OAAO,IAAI,CAAC,kBAAkB,KAAK,KAAK,EAAE,QAAQ,EAAE,CAAC;IACvD,CAAC;IAED,QAAQ;QACN,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAxBD,gDAwBC","file":"value/ContextObjectValue.js","sourcesContent":["import { ExprType } from \"../type/ExprType.js\";\nimport { Value } from \"./Value.js\";\n\nexport class ContextObjectValue implements Value<Record<string, unknown>> {\n private readonly contextObjectValue: Record<string, unknown>;\n private readonly type: ExprType;\n\n constructor(value: Record<string, unknown>, type: ExprType) {\n this.contextObjectValue = value;\n this.type = type;\n }\n\n getValue(): Record<string, unknown> {\n return this.contextObjectValue;\n }\n\n equals(other: Value<any>): boolean {\n return this.contextObjectValue === other?.getValue();\n }\n\n toString(): string {\n return \"[Context object]\";\n }\n\n getType(): ExprType {\n return this.type;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/value/ExpressionValue.ts"],"names":[],"mappings":"","file":"value/ExpressionValue.js","sourcesContent":["import { NumericValue } from \"./NumericValue.js\";\nimport { StringValue } from \"./StringValue.js\";\nimport { BooleanValue } from \"./BooleanValue.js\";\nimport { LogicalValue } from \"./LogicalValue.js\";\nimport { ReferenceValue } from \"./ReferenceValue.js\";\nimport { ArrayValue } from \"./ArrayValue.js\";\nimport { ObjectAccessorValue } from \"./ObjectAccessorValue.js\";\nimport { IfcDateValue } from \"./IfcDateValue.js\";\nimport { IfcDateTimeValue } from \"./IfcDateTimeValue.js\";\nimport { IfcTimeValue } from \"./IfcTimeValue.js\";\nimport { IfcDurationValue } from \"./IfcDurationValue.js\";\nimport { IfcTimeStampValue } from \"./IfcTimeStampValue.js\";\n\nexport type ExpressionValue =\n | NumericValue\n | StringValue\n | BooleanValue\n | LogicalValue\n | IfcDateValue\n | IfcDateTimeValue\n | IfcTimeValue\n | IfcDurationValue\n | IfcTimeStampValue\n | ReferenceValue\n | ObjectAccessorValue\n | ArrayValue;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/value/ExpressionValue.ts"],"names":[],"mappings":"","file":"value/ExpressionValue.js","sourcesContent":["import { NumericValue } from \"./NumericValue.js\";\nimport { StringValue } from \"./StringValue.js\";\nimport { BooleanValue } from \"./BooleanValue.js\";\nimport { LogicalValue } from \"./LogicalValue.js\";\nimport { ReferenceValue } from \"./ReferenceValue.js\";\nimport { ArrayValue } from \"./ArrayValue.js\";\nimport { ObjectAccessorValue } from \"./ObjectAccessorValue.js\";\nimport { IfcDateValue } from \"./IfcDateValue.js\";\nimport { IfcDateTimeValue } from \"./IfcDateTimeValue.js\";\nimport { IfcTimeValue } from \"./IfcTimeValue.js\";\nimport { IfcDurationValue } from \"./IfcDurationValue.js\";\nimport { IfcTimeStampValue } from \"./IfcTimeStampValue.js\";\nimport { ContextObjectValue } from \"./ContextObjectValue.js\";\n\nexport type ExpressionValue =\n | NumericValue\n | StringValue\n | BooleanValue\n | LogicalValue\n | IfcDateValue\n | IfcDateTimeValue\n | IfcTimeValue\n | IfcDurationValue\n | IfcTimeStampValue\n | ReferenceValue\n | ObjectAccessorValue\n | ContextObjectValue\n | ArrayValue;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/value/Value.ts"],"names":[],"mappings":"","file":"value/Value.js","sourcesContent":["import { BoxedValueTypes } from \"./BoxedValueTypes.js\";\nimport { ExprType } from \"../type/ExprType.js\";\nimport { ValueType } from \"./ValueType\";\n\nexport interface Value<\n T extends\n | ValueType\n | BoxedValueTypes\n | Array
|
|
1
|
+
{"version":3,"sources":["../../src/value/Value.ts"],"names":[],"mappings":"","file":"value/Value.js","sourcesContent":["import { BoxedValueTypes } from \"./BoxedValueTypes.js\";\nimport { ExprType } from \"../type/ExprType.js\";\nimport { ValueType } from \"./ValueType\";\n\nexport interface Value<\n T extends\n | ValueType\n | BoxedValueTypes\n | Record<string, unknown>\n | Array<\n Value<\n | BoxedValueTypes\n | Record<string, unknown>\n | Array<Value<BoxedValueTypes | Record<string, unknown>>>\n >\n >\n> {\n getValue(): T;\n equals(other: Value<any>): boolean;\n toString();\n getType(): ExprType;\n}\n"]}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import IfcExpressionVisitor from "../gen/parser/IfcExpressionVisitor.js";
|
|
2
|
-
import { ArrayElementListContext, ArrayExprContext, BooleanLiteralContext, ExprContext, ExprListContext, FunctionCallContext, LiteralContext, LogicalLiteralContext, MethodCallChainEndContext, MethodCallChainInnerContext, NumLiteralContext, SEAddSubContext, SEArrayExprContext, SEBooleanBinaryOpContext, SEComparisonContext, SEFunctionCallContext, SELiteralContext, SEMethodCallContext, SEMulDivContext, SENotContext, SEParenthesisContext, SEPowerContext, SEUnaryMinusContext, SEUnaryMultipleMinusContext, SEVariableRefContext, StringLiteralContext, VariableRefContext } from "../gen/parser/IfcExpressionParser.js";
|
|
1
|
+
import { IfcExpressionVisitor } from "../gen/parser/IfcExpressionVisitor.js";
|
|
2
|
+
import { ArrayElementListContext, ArrayExprContext, BooleanLiteralContext, ExprContext, ExprListContext, FunctionCallContext, LiteralContext, LogicalLiteralContext, MethodCallChainEndContext, MethodCallChainInnerContext, MethodFunctionCallContext, MethodPropertyAccessContext, NumLiteralContext, SEAddSubContext, SEArrayExprContext, SEBooleanBinaryOpContext, SEComparisonContext, SEFunctionCallContext, SELiteralContext, SEMethodCallContext, SEMulDivContext, SENotContext, SEParenthesisContext, SEPowerContext, SEUnaryMinusContext, SEUnaryMultipleMinusContext, SEVariableRefContext, StringLiteralContext, VariableRefContext } from "../gen/parser/IfcExpressionParser.js";
|
|
3
3
|
import { Expr } from "../expression/Expr.js";
|
|
4
4
|
import { TypeManager } from "./TypeManager.js";
|
|
5
5
|
import { ExprManager } from "./ExprManager.js";
|
|
6
|
+
import { BuiltinVariableRegistry } from "../builtin/BuiltinVariableRegistry.js";
|
|
6
7
|
export declare class ExprCompiler extends IfcExpressionVisitor<Expr<any>> {
|
|
8
|
+
protected defaultResult(): Expr<any> | null;
|
|
7
9
|
private readonly methodCallTargetStack;
|
|
8
10
|
private readonly typeManager;
|
|
9
11
|
private readonly exprManager;
|
|
10
|
-
|
|
12
|
+
private readonly builtinVariableRegistry;
|
|
13
|
+
constructor(typeManager: TypeManager, builtinVariableRegistry?: BuiltinVariableRegistry);
|
|
11
14
|
getExprManager(): ExprManager;
|
|
12
15
|
visitExpr: (ctx: ExprContext) => Expr<any>;
|
|
13
16
|
private associateContextAndReturn;
|
|
@@ -21,6 +24,8 @@ export declare class ExprCompiler extends IfcExpressionVisitor<Expr<any>> {
|
|
|
21
24
|
visitSEParenthesis: (ctx: SEParenthesisContext) => Expr<any>;
|
|
22
25
|
visitMethodCallChainInner: (ctx: MethodCallChainInnerContext) => Expr<any>;
|
|
23
26
|
visitMethodCallChainEnd: (ctx: MethodCallChainEndContext) => Expr<any>;
|
|
27
|
+
visitMethodFunctionCall: (ctx: MethodFunctionCallContext) => Expr<any>;
|
|
28
|
+
visitMethodPropertyAccess: (ctx: MethodPropertyAccessContext) => Expr<any>;
|
|
24
29
|
visitSEAddSub: (ctx: SEAddSubContext) => Expr<any>;
|
|
25
30
|
private makePlusExpr;
|
|
26
31
|
visitSEMulDiv: (ctx: SEMulDivContext) => Expr<any>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import IfcExpressionListener from "../gen/parser/IfcExpressionListener.js";
|
|
2
|
-
import { ArrayElementListContext, ArrayExprContext, BooleanLiteralContext, ExprContext, ExprListContext, FunctionCallContext, LiteralContext, LogicalLiteralContext, MethodCallChainEndContext, MethodCallChainInnerContext, NumLiteralContext, SEAddSubContext, SEArrayExprContext, SEBooleanBinaryOpContext, SEComparisonContext, SEFunctionCallContext, SELiteralContext, SEMethodCallContext, SEMulDivContext, SENotContext, SEParenthesisContext, SEPowerContext, SEUnaryMinusContext, SEUnaryMultipleMinusContext, SEVariableRefContext, StringLiteralContext, VariableRefContext } from "../gen/parser/IfcExpressionParser.js";
|
|
1
|
+
import { IfcExpressionListener } from "../gen/parser/IfcExpressionListener.js";
|
|
2
|
+
import { ArrayElementListContext, ArrayExprContext, BooleanLiteralContext, ExprContext, ExprListContext, FunctionCallContext, LiteralContext, LogicalLiteralContext, MethodCallChainEndContext, MethodCallChainInnerContext, MethodFunctionCallContext, MethodPropertyAccessContext, NumLiteralContext, SEAddSubContext, SEArrayExprContext, SEBooleanBinaryOpContext, SEComparisonContext, SEFunctionCallContext, SELiteralContext, SEMethodCallContext, SEMulDivContext, SENotContext, SEParenthesisContext, SEPowerContext, SEUnaryMinusContext, SEUnaryMultipleMinusContext, SEVariableRefContext, StringLiteralContext, VariableRefContext } from "../gen/parser/IfcExpressionParser.js";
|
|
3
3
|
import { TypeManager } from "./TypeManager.js";
|
|
4
|
+
import { BuiltinVariableRegistry } from "../builtin/BuiltinVariableRegistry.js";
|
|
4
5
|
export declare class IfcExpressionValidationListener extends IfcExpressionListener {
|
|
5
6
|
private readonly typeManager;
|
|
6
7
|
private methodCallTargetStack;
|
|
7
|
-
|
|
8
|
+
private readonly builtinVariableRegistry;
|
|
9
|
+
constructor(builtinVariableRegistry?: BuiltinVariableRegistry);
|
|
8
10
|
getTypeManager(): TypeManager;
|
|
9
11
|
enterFunctionCall: (ctx: FunctionCallContext) => void;
|
|
10
12
|
enterSEUnaryMultipleMinus: (ctx: SEUnaryMultipleMinusContext) => void;
|
|
@@ -32,7 +34,11 @@ export declare class IfcExpressionValidationListener extends IfcExpressionListen
|
|
|
32
34
|
enterMethodCallChainEnd: (ctx: MethodCallChainEndContext) => void;
|
|
33
35
|
private pushMethodCallTarget;
|
|
34
36
|
exitMethodCallChainEnd: (ctx: MethodCallChainEndContext) => void;
|
|
37
|
+
exitMethodFunctionCall: (ctx: MethodFunctionCallContext) => void;
|
|
38
|
+
exitMethodPropertyAccess: (ctx: MethodPropertyAccessContext) => void;
|
|
35
39
|
exitFunctionCall: (ctx: FunctionCallContext) => void;
|
|
40
|
+
private checkBuiltinFunctionArguments;
|
|
41
|
+
private popMethodCallTarget;
|
|
36
42
|
private collectArgumentTypes;
|
|
37
43
|
exitExprList: (ctx: ExprListContext) => void;
|
|
38
44
|
exitArrayExpr: (ctx: ArrayExprContext) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IfcPropertyAccessor } from "./IfcPropertyAccessor.js";
|
|
2
|
-
import { IfcElementAccessor } from "./IfcElementAccessor.js";
|
|
3
1
|
export interface IfcExpressionContext {
|
|
4
|
-
resolvePropRef():
|
|
5
|
-
resolveElemRef():
|
|
2
|
+
resolvePropRef(): any;
|
|
3
|
+
resolveElemRef(): any;
|
|
4
|
+
resolveBuiltinVariable(name: string): unknown;
|
|
6
5
|
}
|
|
@@ -2,4 +2,5 @@ import { IfcElementAccessor, IfcExpressionContext, IfcPropertyAccessor } from ".
|
|
|
2
2
|
export declare class NopContext implements IfcExpressionContext {
|
|
3
3
|
resolveElemRef(): IfcElementAccessor;
|
|
4
4
|
resolvePropRef(): IfcPropertyAccessor;
|
|
5
|
+
resolveBuiltinVariable(name: string): unknown;
|
|
5
6
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type LocalizedText = {
|
|
2
|
+
key: string;
|
|
3
|
+
fallback: string;
|
|
4
|
+
};
|
|
5
|
+
export type DocumentationLocalizer = {
|
|
6
|
+
t(key: string, fallback: string): string;
|
|
7
|
+
};
|
|
8
|
+
export type ArgumentDocumentation = {
|
|
9
|
+
label: LocalizedText;
|
|
10
|
+
documentation: LocalizedText;
|
|
11
|
+
};
|
|
12
|
+
export declare function resolveLocalizedText(text: LocalizedText | undefined, localizer?: DocumentationLocalizer): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParserRuleContext } from "
|
|
1
|
+
import { ParserRuleContext } from "antlr4ng";
|
|
2
2
|
import { ValidationException } from "./ValidationException.js";
|
|
3
3
|
export declare class ExpressionTypeError extends ValidationException {
|
|
4
4
|
constructor(message: string, ctx: ParserRuleContext);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExpressionTypeError } from "./ExpressionTypeError.js";
|
|
2
|
-
import { ParserRuleContext } from "
|
|
2
|
+
import { ParserRuleContext } from "antlr4ng";
|
|
3
3
|
import { ExprType } from "../type/ExprType.js";
|
|
4
4
|
export declare class WrongFunctionArgumentTypeException extends ExpressionTypeError {
|
|
5
5
|
readonly functionName: string;
|
|
@@ -13,6 +13,9 @@ export declare enum ExprKind {
|
|
|
13
13
|
NUM_LITERAL = "NUM_LITERAL",
|
|
14
14
|
REF_ELEMENT = "REF_ELEMENT",
|
|
15
15
|
REF_PROPERTY = "REF_PROPERTY",
|
|
16
|
+
REF_BUILTIN_ROOT = "REF_BUILTIN_ROOT",
|
|
17
|
+
REF_BUILTIN_MEMBER = "REF_BUILTIN_MEMBER",
|
|
18
|
+
REF_BUILTIN_FUNCTION = "REF_BUILTIN_FUNCTION",
|
|
16
19
|
STR_CONCAT = "STR_CONCAT",
|
|
17
20
|
STR_LITERAL = "STR_LITERAL",
|
|
18
21
|
AND = "AND",
|
|
@@ -2,40 +2,26 @@ import { ExpressionValue } from "../../value/ExpressionValue.js";
|
|
|
2
2
|
import { FuncArg } from "./FuncArg.js";
|
|
3
3
|
import { ExprEvalError, ExprEvalResult } from "../ExprEvalResult.js";
|
|
4
4
|
import { ExprType } from "../../type/ExprType.js";
|
|
5
|
-
import { ParserRuleContext } from "
|
|
5
|
+
import { ParserRuleContext } from "antlr4ng";
|
|
6
6
|
import { FunctionExpr } from "./FunctionExpr.js";
|
|
7
7
|
import { Expr } from "../Expr.js";
|
|
8
|
+
import { LocalizedText } from "../../documentation/Documentation.js";
|
|
8
9
|
export declare abstract class Func {
|
|
9
10
|
protected name: string;
|
|
10
11
|
protected formalArguments: Array<FuncArg<unknown>>;
|
|
12
|
+
protected documentationRef?: LocalizedText;
|
|
11
13
|
protected constructor(name: string, args: Array<FuncArg<unknown>>);
|
|
12
14
|
abstract getReturnType(argumentTypes: Array<ExprType>): ExprType;
|
|
15
|
+
withDocumentation(documentation: LocalizedText): this;
|
|
16
|
+
getDocumentation(): LocalizedText | undefined;
|
|
17
|
+
getFormalArguments(): ReadonlyArray<FuncArg<unknown>>;
|
|
18
|
+
getSignatureLabel(displayName?: string): string;
|
|
13
19
|
checkArgumentsAndGetReturnType(argumentTypes: Array<[ParserRuleContext, ExprType]>, ctx: any): ExprType;
|
|
14
20
|
protected checkArgumentTypes(providedArgumentTypes: Array<[ParserRuleContext, ExprType]>, ctx: any): void;
|
|
15
21
|
getName(): string;
|
|
16
22
|
evaluate(callingExpr: FunctionExpr, funcArgs: Array<ExprEvalResult<ExpressionValue>>): ExprEvalResult<ExpressionValue>;
|
|
17
|
-
/**
|
|
18
|
-
* Subclasses must provide the funcation evaluation code here.
|
|
19
|
-
* @param callingExpr
|
|
20
|
-
* @param evaluatedArguments
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
23
|
protected abstract calculateResult(callingExpr: FunctionExpr, evaluatedArguments: Map<string, ExpressionValue>): ExprEvalResult<ExpressionValue>;
|
|
24
|
-
/**
|
|
25
|
-
* Override to transform individual arguments if needed. After this step, if any of the ExprEvalResult objects in the
|
|
26
|
-
* returned array is an ExprEvalError, the function evaluation fails.
|
|
27
|
-
* @param callingExpr
|
|
28
|
-
* @param evaluatedArguments
|
|
29
|
-
* @protected
|
|
30
|
-
*/
|
|
31
24
|
protected transformArguments(callingExpr: Expr<any>, evaluatedArguments: Map<string, ExprEvalResult<ExpressionValue>>): void;
|
|
32
|
-
/**
|
|
33
|
-
* Gets the argument values from the list of provided arguments in the form of 'name' -> ExprEvalResult (which may contain errors).
|
|
34
|
-
* Generates an error if a required value is missing.
|
|
35
|
-
* @param callingExpr
|
|
36
|
-
* @param provided
|
|
37
|
-
* @protected
|
|
38
|
-
*/
|
|
39
25
|
protected getArgumentValues(callingExpr: FunctionExpr, provided: Array<ExprEvalResult<ExpressionValue>>): Map<string, ExprEvalResult<ExpressionValue>> | ExprEvalError;
|
|
40
26
|
private checkArgs;
|
|
41
27
|
}
|
|
@@ -2,20 +2,21 @@ import { ExpressionValue } from "../../value/ExpressionValue.js";
|
|
|
2
2
|
import { ExprEvalResult } from "../ExprEvalResult.js";
|
|
3
3
|
import { ExprType } from "../../type/ExprType.js";
|
|
4
4
|
import { FunctionExpr } from "./FunctionExpr.js";
|
|
5
|
+
import { LocalizedText } from "../../documentation/Documentation.js";
|
|
5
6
|
export declare class FuncArg<T> {
|
|
6
7
|
protected _required: boolean;
|
|
7
8
|
protected _name: string;
|
|
8
9
|
protected _defaultValue?: T;
|
|
10
|
+
protected _displayLabel?: LocalizedText;
|
|
11
|
+
protected _documentation?: LocalizedText;
|
|
9
12
|
constructor(required: boolean, name: string, defaultValue?: T);
|
|
10
13
|
getType(): ExprType;
|
|
11
|
-
|
|
12
|
-
* For the value provided for a specific invocation of the function, return an appropriate result (maybe some kind of type conversion or type check might happen here)
|
|
13
|
-
*
|
|
14
|
-
* @param invocationValue
|
|
15
|
-
*/
|
|
14
|
+
withDocumentation(displayLabel: LocalizedText, documentation: LocalizedText): this;
|
|
16
15
|
transformValue(callingExpr: FunctionExpr, invocationValue: ExprEvalResult<ExpressionValue>): ExprEvalResult<ExpressionValue>;
|
|
17
16
|
get required(): boolean;
|
|
18
17
|
get name(): string;
|
|
19
18
|
get defaultValue(): T | undefined;
|
|
19
|
+
get displayLabel(): LocalizedText | undefined;
|
|
20
|
+
get documentation(): LocalizedText | undefined;
|
|
20
21
|
hasDefaultValue(): boolean;
|
|
21
22
|
}
|
|
@@ -3,7 +3,7 @@ import { ExpressionValue } from "../../../value/ExpressionValue.js";
|
|
|
3
3
|
import { ExprEvalResult } from "../../ExprEvalResult.js";
|
|
4
4
|
import { ExprType } from "../../../type/ExprType.js";
|
|
5
5
|
import { FunctionExpr } from "../FunctionExpr.js";
|
|
6
|
-
import { ParserRuleContext } from "
|
|
6
|
+
import { ParserRuleContext } from "antlr4ng";
|
|
7
7
|
export declare class CHOOSE extends Func {
|
|
8
8
|
private static readonly ARG_NAME_CASES;
|
|
9
9
|
private static readonly ARG_NAME_DEFAULT_VALUE;
|
|
@@ -3,7 +3,7 @@ import { ExpressionValue } from "../../../value/ExpressionValue.js";
|
|
|
3
3
|
import { ExprEvalResult } from "../../ExprEvalResult.js";
|
|
4
4
|
import { ExprType } from "../../../type/ExprType.js";
|
|
5
5
|
import { FunctionExpr } from "../FunctionExpr.js";
|
|
6
|
-
import { ParserRuleContext } from "
|
|
6
|
+
import { ParserRuleContext } from "antlr4ng";
|
|
7
7
|
import { Expr } from "../../Expr.js";
|
|
8
8
|
export declare class IF extends Func {
|
|
9
9
|
private static readonly ARG_NAME_CONDITION;
|
|
@@ -3,7 +3,7 @@ import { ExpressionValue } from "../../../value/ExpressionValue.js";
|
|
|
3
3
|
import { ExprEvalResult } from "../../ExprEvalResult.js";
|
|
4
4
|
import { ExprType } from "../../../type/ExprType.js";
|
|
5
5
|
import { FunctionExpr } from "../FunctionExpr.js";
|
|
6
|
-
import { ParserRuleContext } from "
|
|
6
|
+
import { ParserRuleContext } from "antlr4ng";
|
|
7
7
|
export declare class MAP extends Func {
|
|
8
8
|
private static readonly ARG_NAME_MAPPINGS;
|
|
9
9
|
private static readonly ARG_NAME_MAPPING_INPUT;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IfcExpressionContext } from "../../context/IfcExpressionContext.js";
|
|
2
|
+
import { ExprBase } from "../ExprBase.js";
|
|
3
|
+
import { Expr } from "../Expr.js";
|
|
4
|
+
import { ExpressionValue } from "../../value/ExpressionValue.js";
|
|
5
|
+
import { ExprEvalResult } from "../ExprEvalResult.js";
|
|
6
|
+
import { ExprType } from "../../type/ExprType.js";
|
|
7
|
+
import { ExprStringBuilder } from "../ExprStringBuilder.js";
|
|
8
|
+
export declare class BuiltinFunctionCallExpr extends ExprBase<ExpressionValue> {
|
|
9
|
+
private readonly target;
|
|
10
|
+
private readonly name;
|
|
11
|
+
private readonly args;
|
|
12
|
+
private readonly targetName;
|
|
13
|
+
private readonly type;
|
|
14
|
+
constructor(target: Expr<ExpressionValue>, name: string, args: Array<Expr<ExpressionValue>>, type: ExprType, targetName: string);
|
|
15
|
+
getChildren(): Array<Expr<any>>;
|
|
16
|
+
evaluate(ctx: IfcExpressionContext, localCtx: Map<string, any>): ExprEvalResult<ExpressionValue>;
|
|
17
|
+
protected buildExprString(builder: ExprStringBuilder): void;
|
|
18
|
+
getType(): ExprType;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IfcExpressionContext } from "../../context/IfcExpressionContext.js";
|
|
2
|
+
import { Expr1 } from "../Expr1.js";
|
|
3
|
+
import { ExpressionValue } from "../../value/ExpressionValue.js";
|
|
4
|
+
import { ExprType } from "../../type/ExprType.js";
|
|
5
|
+
import { ExprStringBuilder } from "../ExprStringBuilder.js";
|
|
6
|
+
import { ExprEvalErrorObj } from "../ExprEvalResult.js";
|
|
7
|
+
export declare class BuiltinPropertyAccessExpr extends Expr1<ExpressionValue, ExpressionValue> {
|
|
8
|
+
private readonly memberName;
|
|
9
|
+
private readonly targetName;
|
|
10
|
+
private readonly type;
|
|
11
|
+
constructor(target: any, memberName: string, type: ExprType, targetName: string);
|
|
12
|
+
protected calculateResult(_ctx: IfcExpressionContext, _localCtx: Map<string, any>, subExpressionResult: ExpressionValue): ExpressionValue | ExprEvalErrorObj;
|
|
13
|
+
protected buildExprString(builder: ExprStringBuilder): void;
|
|
14
|
+
getType(): ExprType;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IfcExpressionContext } from "../../context/IfcExpressionContext.js";
|
|
2
|
+
import { Expr0 } from "../Expr0.js";
|
|
3
|
+
import { ExpressionValue } from "../../value/ExpressionValue.js";
|
|
4
|
+
import { ExprType } from "../../type/ExprType.js";
|
|
5
|
+
import { ExprStringBuilder } from "../ExprStringBuilder.js";
|
|
6
|
+
import { ExprEvalErrorObj } from "../ExprEvalResult.js";
|
|
7
|
+
export declare class BuiltinRootReferenceExpr extends Expr0<ExpressionValue> {
|
|
8
|
+
private readonly name;
|
|
9
|
+
private readonly type;
|
|
10
|
+
constructor(name: string, type: ExprType);
|
|
11
|
+
doEvaluate(ctx: IfcExpressionContext): ExpressionValue | ExprEvalErrorObj;
|
|
12
|
+
protected buildExprString(builder: ExprStringBuilder): void;
|
|
13
|
+
getType(): ExprType;
|
|
14
|
+
}
|