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.
Files changed (185) hide show
  1. package/README.md +255 -30
  2. package/dist/IfcExpression.d.ts +24 -26
  3. package/dist/IfcExpressionErrorListener.d.ts +3 -3
  4. package/dist/IfcExpressionOptions.d.ts +4 -0
  5. package/dist/autocomplete/CompletionItem.d.ts +24 -0
  6. package/dist/autocomplete/IfcExpressionAutocomplete.d.ts +11 -0
  7. package/dist/builtin/BuiltinRuntimeValueConverter.d.ts +7 -0
  8. package/dist/builtin/BuiltinVariableRegistry.d.ts +50 -0
  9. package/dist/cjs/IfcExpression.js +112 -37
  10. package/dist/cjs/IfcExpression.js.map +1 -1
  11. package/dist/cjs/IfcExpressionErrorListener.js +3 -8
  12. package/dist/cjs/IfcExpressionErrorListener.js.map +1 -1
  13. package/dist/cjs/IfcExpressionOptions.js +3 -0
  14. package/dist/cjs/IfcExpressionOptions.js.map +1 -0
  15. package/dist/cjs/autocomplete/CompletionItem.js +3 -0
  16. package/dist/cjs/autocomplete/CompletionItem.js.map +1 -0
  17. package/dist/cjs/autocomplete/IfcExpressionAutocomplete.js +654 -0
  18. package/dist/cjs/autocomplete/IfcExpressionAutocomplete.js.map +1 -0
  19. package/dist/cjs/builtin/BuiltinRuntimeValueConverter.js +124 -0
  20. package/dist/cjs/builtin/BuiltinRuntimeValueConverter.js.map +1 -0
  21. package/dist/cjs/builtin/BuiltinVariableRegistry.js +405 -0
  22. package/dist/cjs/builtin/BuiltinVariableRegistry.js.map +1 -0
  23. package/dist/cjs/compiler/ExprCompiler.js +44 -41
  24. package/dist/cjs/compiler/ExprCompiler.js.map +1 -1
  25. package/dist/cjs/compiler/ExprManager.js.map +1 -1
  26. package/dist/cjs/compiler/IfcExpressionValidationListener.js +85 -25
  27. package/dist/cjs/compiler/IfcExpressionValidationListener.js.map +1 -1
  28. package/dist/cjs/compiler/TypeManager.js.map +1 -1
  29. package/dist/cjs/context/IfcExpressionContext.js.map +1 -1
  30. package/dist/cjs/context/NopContext.js +3 -0
  31. package/dist/cjs/context/NopContext.js.map +1 -1
  32. package/dist/cjs/documentation/Documentation.js +11 -0
  33. package/dist/cjs/documentation/Documentation.js.map +1 -0
  34. package/dist/cjs/error/ExpressionTypeError.js.map +1 -1
  35. package/dist/cjs/error/IfcExpressionBuiltinConfigException.js +10 -0
  36. package/dist/cjs/error/IfcExpressionBuiltinConfigException.js.map +1 -0
  37. package/dist/cjs/error/InvalidSyntaxException.js.map +1 -1
  38. package/dist/cjs/error/NoSuchFunctionException.js.map +1 -1
  39. package/dist/cjs/error/NoSuchMemberException.js +13 -0
  40. package/dist/cjs/error/NoSuchMemberException.js.map +1 -0
  41. package/dist/cjs/error/ValidationException.js.map +1 -1
  42. package/dist/cjs/error/WrongFunctionArgumentTypeException.js.map +1 -1
  43. package/dist/cjs/expression/ExprKind.js +3 -0
  44. package/dist/cjs/expression/ExprKind.js.map +1 -1
  45. package/dist/cjs/expression/function/Func.js +18 -14
  46. package/dist/cjs/expression/function/Func.js.map +1 -1
  47. package/dist/cjs/expression/function/FuncArg.js +11 -5
  48. package/dist/cjs/expression/function/FuncArg.js.map +1 -1
  49. package/dist/cjs/expression/function/IfcExpressionFunctions.js +198 -42
  50. package/dist/cjs/expression/function/IfcExpressionFunctions.js.map +1 -1
  51. package/dist/cjs/expression/function/impl/CHOOSE.js.map +1 -1
  52. package/dist/cjs/expression/function/impl/IF.js.map +1 -1
  53. package/dist/cjs/expression/function/impl/MAP.js.map +1 -1
  54. package/dist/cjs/expression/function/impl/ReplacePattern.js +20 -2
  55. package/dist/cjs/expression/function/impl/ReplacePattern.js.map +1 -1
  56. package/dist/cjs/expression/reference/BuiltinFunctionCallExpr.js +59 -0
  57. package/dist/cjs/expression/reference/BuiltinFunctionCallExpr.js.map +1 -0
  58. package/dist/cjs/expression/reference/BuiltinPropertyAccessExpr.js +34 -0
  59. package/dist/cjs/expression/reference/BuiltinPropertyAccessExpr.js.map +1 -0
  60. package/dist/cjs/expression/reference/BuiltinRootReferenceExpr.js +29 -0
  61. package/dist/cjs/expression/reference/BuiltinRootReferenceExpr.js.map +1 -0
  62. package/dist/cjs/gen/parser/IfcExpressionLexer.js +126 -104
  63. package/dist/cjs/gen/parser/IfcExpressionLexer.js.map +1 -1
  64. package/dist/cjs/gen/parser/IfcExpressionListener.js +7 -4
  65. package/dist/cjs/gen/parser/IfcExpressionListener.js.map +1 -1
  66. package/dist/cjs/gen/parser/IfcExpressionParser.js +739 -682
  67. package/dist/cjs/gen/parser/IfcExpressionParser.js.map +1 -1
  68. package/dist/cjs/gen/parser/IfcExpressionVisitor.js +4 -4
  69. package/dist/cjs/gen/parser/IfcExpressionVisitor.js.map +1 -1
  70. package/dist/cjs/index.js +4 -1
  71. package/dist/cjs/index.js.map +1 -1
  72. package/dist/cjs/type/ContextObjectType.js +45 -0
  73. package/dist/cjs/type/ContextObjectType.js.map +1 -0
  74. package/dist/cjs/type/Types.js +4 -6
  75. package/dist/cjs/type/Types.js.map +1 -1
  76. package/dist/cjs/value/ContextObjectValue.js +23 -0
  77. package/dist/cjs/value/ContextObjectValue.js.map +1 -0
  78. package/dist/cjs/value/ExpressionValue.js.map +1 -1
  79. package/dist/cjs/value/Value.js.map +1 -1
  80. package/dist/compiler/ExprCompiler.d.ts +8 -3
  81. package/dist/compiler/ExprManager.d.ts +1 -1
  82. package/dist/compiler/IfcExpressionValidationListener.d.ts +9 -3
  83. package/dist/compiler/TypeManager.d.ts +1 -1
  84. package/dist/context/IfcExpressionContext.d.ts +3 -4
  85. package/dist/context/NopContext.d.ts +1 -0
  86. package/dist/documentation/Documentation.d.ts +12 -0
  87. package/dist/error/ExpressionTypeError.d.ts +1 -1
  88. package/dist/error/IfcExpressionBuiltinConfigException.d.ts +3 -0
  89. package/dist/error/InvalidSyntaxException.d.ts +1 -1
  90. package/dist/error/NoSuchFunctionException.d.ts +1 -1
  91. package/dist/error/NoSuchMemberException.d.ts +6 -0
  92. package/dist/error/ValidationException.d.ts +1 -1
  93. package/dist/error/WrongFunctionArgumentTypeException.d.ts +1 -1
  94. package/dist/expression/ExprKind.d.ts +3 -0
  95. package/dist/expression/function/Func.d.ts +7 -21
  96. package/dist/expression/function/FuncArg.d.ts +6 -5
  97. package/dist/expression/function/IfcExpressionFunctions.d.ts +1 -0
  98. package/dist/expression/function/impl/CHOOSE.d.ts +1 -1
  99. package/dist/expression/function/impl/IF.d.ts +1 -1
  100. package/dist/expression/function/impl/MAP.d.ts +1 -1
  101. package/dist/expression/reference/BuiltinFunctionCallExpr.d.ts +19 -0
  102. package/dist/expression/reference/BuiltinPropertyAccessExpr.d.ts +15 -0
  103. package/dist/expression/reference/BuiltinRootReferenceExpr.d.ts +14 -0
  104. package/dist/gen/parser/IfcExpressionLexer.d.ts +9 -8
  105. package/dist/gen/parser/IfcExpressionListener.d.ts +89 -59
  106. package/dist/gen/parser/IfcExpressionParser.d.ts +192 -169
  107. package/dist/gen/parser/IfcExpressionVisitor.d.ts +51 -35
  108. package/dist/index.d.ts +2 -2
  109. package/dist/mjs/IfcExpression.js +104 -32
  110. package/dist/mjs/IfcExpression.js.map +1 -1
  111. package/dist/mjs/IfcExpressionErrorListener.js +3 -8
  112. package/dist/mjs/IfcExpressionErrorListener.js.map +1 -1
  113. package/dist/mjs/IfcExpressionOptions.js +2 -0
  114. package/dist/mjs/IfcExpressionOptions.js.map +1 -0
  115. package/dist/mjs/autocomplete/CompletionItem.js +2 -0
  116. package/dist/mjs/autocomplete/CompletionItem.js.map +1 -0
  117. package/dist/mjs/autocomplete/IfcExpressionAutocomplete.js +650 -0
  118. package/dist/mjs/autocomplete/IfcExpressionAutocomplete.js.map +1 -0
  119. package/dist/mjs/builtin/BuiltinRuntimeValueConverter.js +117 -0
  120. package/dist/mjs/builtin/BuiltinRuntimeValueConverter.js.map +1 -0
  121. package/dist/mjs/builtin/BuiltinVariableRegistry.js +399 -0
  122. package/dist/mjs/builtin/BuiltinVariableRegistry.js.map +1 -0
  123. package/dist/mjs/compiler/ExprCompiler.js +43 -40
  124. package/dist/mjs/compiler/ExprCompiler.js.map +1 -1
  125. package/dist/mjs/compiler/ExprManager.js.map +1 -1
  126. package/dist/mjs/compiler/IfcExpressionValidationListener.js +85 -22
  127. package/dist/mjs/compiler/IfcExpressionValidationListener.js.map +1 -1
  128. package/dist/mjs/compiler/TypeManager.js.map +1 -1
  129. package/dist/mjs/context/IfcExpressionContext.js.map +1 -1
  130. package/dist/mjs/context/NopContext.js +3 -0
  131. package/dist/mjs/context/NopContext.js.map +1 -1
  132. package/dist/mjs/documentation/Documentation.js +7 -0
  133. package/dist/mjs/documentation/Documentation.js.map +1 -0
  134. package/dist/mjs/error/ExpressionTypeError.js.map +1 -1
  135. package/dist/mjs/error/IfcExpressionBuiltinConfigException.js +6 -0
  136. package/dist/mjs/error/IfcExpressionBuiltinConfigException.js.map +1 -0
  137. package/dist/mjs/error/InvalidSyntaxException.js.map +1 -1
  138. package/dist/mjs/error/NoSuchFunctionException.js.map +1 -1
  139. package/dist/mjs/error/NoSuchMemberException.js +9 -0
  140. package/dist/mjs/error/NoSuchMemberException.js.map +1 -0
  141. package/dist/mjs/error/ValidationException.js.map +1 -1
  142. package/dist/mjs/error/WrongFunctionArgumentTypeException.js.map +1 -1
  143. package/dist/mjs/expression/ExprKind.js +3 -0
  144. package/dist/mjs/expression/ExprKind.js.map +1 -1
  145. package/dist/mjs/expression/function/Func.js +18 -14
  146. package/dist/mjs/expression/function/Func.js.map +1 -1
  147. package/dist/mjs/expression/function/FuncArg.js +11 -5
  148. package/dist/mjs/expression/function/FuncArg.js.map +1 -1
  149. package/dist/mjs/expression/function/IfcExpressionFunctions.js +198 -42
  150. package/dist/mjs/expression/function/IfcExpressionFunctions.js.map +1 -1
  151. package/dist/mjs/expression/function/impl/CHOOSE.js.map +1 -1
  152. package/dist/mjs/expression/function/impl/IF.js.map +1 -1
  153. package/dist/mjs/expression/function/impl/MAP.js.map +1 -1
  154. package/dist/mjs/expression/function/impl/ReplacePattern.js +20 -2
  155. package/dist/mjs/expression/function/impl/ReplacePattern.js.map +1 -1
  156. package/dist/mjs/expression/reference/BuiltinFunctionCallExpr.js +55 -0
  157. package/dist/mjs/expression/reference/BuiltinFunctionCallExpr.js.map +1 -0
  158. package/dist/mjs/expression/reference/BuiltinPropertyAccessExpr.js +30 -0
  159. package/dist/mjs/expression/reference/BuiltinPropertyAccessExpr.js.map +1 -0
  160. package/dist/mjs/expression/reference/BuiltinRootReferenceExpr.js +25 -0
  161. package/dist/mjs/expression/reference/BuiltinRootReferenceExpr.js.map +1 -0
  162. package/dist/mjs/gen/parser/IfcExpressionLexer.js +101 -104
  163. package/dist/mjs/gen/parser/IfcExpressionLexer.js.map +1 -1
  164. package/dist/mjs/gen/parser/IfcExpressionListener.js +5 -3
  165. package/dist/mjs/gen/parser/IfcExpressionListener.js.map +1 -1
  166. package/dist/mjs/gen/parser/IfcExpressionParser.js +700 -670
  167. package/dist/mjs/gen/parser/IfcExpressionParser.js.map +1 -1
  168. package/dist/mjs/gen/parser/IfcExpressionVisitor.js +2 -3
  169. package/dist/mjs/gen/parser/IfcExpressionVisitor.js.map +1 -1
  170. package/dist/mjs/index.js +1 -1
  171. package/dist/mjs/index.js.map +1 -1
  172. package/dist/mjs/type/ContextObjectType.js +41 -0
  173. package/dist/mjs/type/ContextObjectType.js.map +1 -0
  174. package/dist/mjs/type/Types.js +4 -6
  175. package/dist/mjs/type/Types.js.map +1 -1
  176. package/dist/mjs/value/ContextObjectValue.js +19 -0
  177. package/dist/mjs/value/ContextObjectValue.js.map +1 -0
  178. package/dist/mjs/value/ExpressionValue.js.map +1 -1
  179. package/dist/mjs/value/Value.js.map +1 -1
  180. package/dist/type/ContextObjectType.d.ts +17 -0
  181. package/dist/type/Types.d.ts +2 -6
  182. package/dist/value/ContextObjectValue.d.ts +11 -0
  183. package/dist/value/ExpressionValue.d.ts +2 -1
  184. package/dist/value/Value.d.ts +1 -1
  185. package/package.json +5 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["gen/parser/IfcExpressionVisitor.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD,OAAO,EAAC,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAgCxC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,oBAA6B,SAAQ,gBAAwB;CAmLjF","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":["gen/parser/IfcExpressionVisitor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAkCpD;;;;;;GAMG;AACH,MAAM,OAAO,oBAA6B,SAAQ,wBAAgC;CAiMjF","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/mjs/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { IfcExpression, IfcExpressionParseResult, IfcElementAccessor, StringValue, BooleanValue, LogicalValue, NumericValue, ReferenceValue, IfcDateValue, IfcDateTimeValue, IfcTimeValue, IfcDurationValue, IfcTimeStampValue, IfcPropertySetAccessor, IfcPropertyAccessor, IfcRootObjectAccessor, IfcTypeObjectAccessor, NamedObjectAccessor, ExprCompiler, ExprKind, IfcExpressionEvaluationException, IfcExpressionErrorListener, IfcExpressionVisitor, isPresent, isNullish, isExprEvalError, isExprEvalSuccess, ExprToTextInputLinker, ExprFacade, ArrayType, SimpleType, TupleType, TypeDisjunction, Types, } from "./IfcExpression.js";
1
+ export { IfcExpression, IfcExpressionParseResult, IfcElementAccessor, StringValue, BooleanValue, LogicalValue, NumericValue, ReferenceValue, IfcDateValue, IfcDateTimeValue, IfcTimeValue, IfcDurationValue, IfcTimeStampValue, IfcPropertySetAccessor, IfcPropertyAccessor, IfcRootObjectAccessor, IfcTypeObjectAccessor, NamedObjectAccessor, ExprCompiler, ExprKind, IfcExpressionEvaluationException, IfcExpressionErrorListener, IfcExpressionVisitor, isPresent, isNullish, isExprEvalError, isExprEvalSuccess, ExprToTextInputLinker, ExprFacade, ArrayType, SimpleType, TupleType, TypeDisjunction, Types, ContextObjectType, BuiltinVariableRegistry, IfcExpressionAutocomplete, } from "./IfcExpression.js";
2
2
  export { E } from "./E.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,kBAAkB,EAGlB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EAEZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EAGnB,YAAY,EACZ,QAAQ,EACR,gCAAgC,EAChC,0BAA0B,EAC1B,oBAAoB,EACpB,SAAS,EACT,SAAS,EAGT,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EAEV,SAAS,EACT,UAAU,EACV,SAAS,EACT,eAAe,EACf,KAAK,GACN,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC","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} from \"./IfcExpression.js\";\n\nexport type { BoxedValueTypes } from \"./IfcExpression.js\";\n\nexport { E } from \"./E.js\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,kBAAkB,EAGlB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EAEZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EAGnB,YAAY,EACZ,QAAQ,EACR,gCAAgC,EAChC,0BAA0B,EAC1B,oBAAoB,EACpB,SAAS,EACT,SAAS,EAGT,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EAEV,SAAS,EACT,UAAU,EACV,SAAS,EACT,eAAe,EACf,KAAK,EACL,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC","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,41 @@
1
+ export class ContextObjectType {
2
+ constructor(name, baseType, members) {
3
+ this.name = name;
4
+ this.baseType = baseType;
5
+ this.members = members;
6
+ }
7
+ static fromBuiltinDefinition(definition) {
8
+ return new ContextObjectType(definition.name, definition.type, definition.members);
9
+ }
10
+ getMemberDefinition(name) {
11
+ return this.members.get(name?.replace(/^\$/, "").toUpperCase());
12
+ }
13
+ getMemberDefinitions() {
14
+ return [...this.members.values()];
15
+ }
16
+ getName() {
17
+ return this.name;
18
+ }
19
+ isSuperTypeOf(other) {
20
+ return other.isSubTypeOf(this);
21
+ }
22
+ isSameTypeAs(other) {
23
+ return this === other || other.getName() === this.getName();
24
+ }
25
+ isSubTypeOf(other) {
26
+ return (this.baseType.isSameTypeAs(other) || this.baseType.isSubTypeOf(other));
27
+ }
28
+ overlapsWith(other) {
29
+ if (this.isSameTypeAs(other)) {
30
+ return true;
31
+ }
32
+ if (other instanceof ContextObjectType) {
33
+ return this.baseType.overlapsWith(other.baseType);
34
+ }
35
+ return this.baseType.overlapsWith(other);
36
+ }
37
+ isAssignableFrom(other) {
38
+ return this.isSameTypeAs(other) || this.isSuperTypeOf(other);
39
+ }
40
+ }
41
+ //# sourceMappingURL=ContextObjectType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["type/ContextObjectType.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,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","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"]}
@@ -19,6 +19,7 @@ Type.IFC_ELEMENT_REF = new SimpleType("ifcElementRef", Type.IFC_OBJECT_REF);
19
19
  Type.IFC_PROPERTY_REF = new SimpleType("ifcPropertyRef", Type.IFC_OBJECT_REF);
20
20
  Type.IFC_PROPERTY_SET_REF = new SimpleType("ifcPropertySetRef", Type.IFC_OBJECT_REF);
21
21
  Type.IFC_TYPE_OBJECT_REF = new SimpleType("ifcTypeObjectRef", Type.IFC_OBJECT_REF);
22
+ Type.CONTEXT_OBJECT_REF = new SimpleType("contextObjectRef");
22
23
  Type.ARRAY = new SimpleType("array");
23
24
  export class Types {
24
25
  static or(...types) {
@@ -94,17 +95,14 @@ export class Types {
94
95
  static ifcObjectRef() {
95
96
  return Type.IFC_OBJECT_REF;
96
97
  }
98
+ static contextObjectRef() {
99
+ return Type.CONTEXT_OBJECT_REF;
100
+ }
97
101
  static requireIsAssignableFrom(expectedType, actualType, exceptionProducer) {
98
102
  if (!expectedType.isAssignableFrom(actualType)) {
99
103
  throw exceptionProducer();
100
104
  }
101
105
  }
102
- /**
103
- * Requires overlap if actual is a disjunction, assignable from if it is a type
104
- * @param expectedType
105
- * @param actualType
106
- * @param exceptionProducer
107
- */
108
106
  static requireWeakIsAssignableFrom(expectedType, actualType, exceptionProducer) {
109
107
  if (expectedType.isAssignableFrom(actualType)) {
110
108
  return;
@@ -1 +1 @@
1
- {"version":3,"sources":["type/Types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,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CAAC;IAEM,MAAM,CAAC,uBAAuB,CACnC,YAAsB,EACtB,UAAoB,EACpB,iBAA4C;QAE5C,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE;YAC9C,MAAM,iBAAiB,EAAE,CAAC;SAC3B;IACH,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,2BAA2B,CACvC,YAAsB,EACtB,UAAoB,EACpB,iBAA4C;QAE5C,IAAI,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE;YAC7C,OAAO;SACR;QACD,IAAI,UAAU,YAAY,eAAe,EAAE;YACzC,IAAI,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;gBACzC,OAAO;aACR;SACF;QACD,IAAI,UAAU,YAAY,SAAS,EAAE;YACnC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YACnE,IAAI,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE;gBAC7C,OAAO;aACR;SACF;QACD,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,mBAAmB,CACxB,UAAoB,EACpB,WAAqB,EACrB,iBAA4C;QAE5C,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YACzC,MAAM,iBAAiB,EAAE,CAAC;SAC3B;IACH,CAAC;CACF","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 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\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 /**\n * Requires overlap if actual is a disjunction, assignable from if it is a type\n * @param expectedType\n * @param actualType\n * @param exceptionProducer\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}\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":"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,19 @@
1
+ export class ContextObjectValue {
2
+ constructor(value, type) {
3
+ this.contextObjectValue = value;
4
+ this.type = type;
5
+ }
6
+ getValue() {
7
+ return this.contextObjectValue;
8
+ }
9
+ equals(other) {
10
+ return this.contextObjectValue === other?.getValue();
11
+ }
12
+ toString() {
13
+ return "[Context object]";
14
+ }
15
+ getType() {
16
+ return this.type;
17
+ }
18
+ }
19
+ //# sourceMappingURL=ContextObjectValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["value/ContextObjectValue.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,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","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":["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":["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":["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<Value<BoxedValueTypes | Array<Value<BoxedValueTypes>>>>\n> {\n getValue(): T;\n equals(other: Value<any>): boolean;\n toString();\n getType(): ExprType;\n}\n"]}
1
+ {"version":3,"sources":["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"]}
@@ -0,0 +1,17 @@
1
+ import { ExprType } from "./ExprType.js";
2
+ import { BuiltinMemberDefinition, RegisteredBuiltinVariableDefinition } from "../builtin/BuiltinVariableRegistry.js";
3
+ export declare class ContextObjectType implements ExprType {
4
+ private readonly name;
5
+ private readonly baseType;
6
+ private readonly members;
7
+ constructor(name: string, baseType: ExprType, members: Map<string, BuiltinMemberDefinition>);
8
+ static fromBuiltinDefinition(definition: RegisteredBuiltinVariableDefinition): ContextObjectType;
9
+ getMemberDefinition(name: string): BuiltinMemberDefinition | undefined;
10
+ getMemberDefinitions(): Array<BuiltinMemberDefinition>;
11
+ getName(): string;
12
+ isSuperTypeOf(other: ExprType): boolean;
13
+ isSameTypeAs(other: ExprType): boolean;
14
+ isSubTypeOf(other: ExprType): boolean;
15
+ overlapsWith(other: ExprType): boolean;
16
+ isAssignableFrom(other: ExprType): boolean;
17
+ }
@@ -19,6 +19,7 @@ export declare class Type {
19
19
  static readonly IFC_PROPERTY_REF: SimpleType;
20
20
  static readonly IFC_PROPERTY_SET_REF: SimpleType;
21
21
  static readonly IFC_TYPE_OBJECT_REF: SimpleType;
22
+ static readonly CONTEXT_OBJECT_REF: SimpleType;
22
23
  static readonly ARRAY: SimpleType;
23
24
  }
24
25
  export declare class Types {
@@ -45,13 +46,8 @@ export declare class Types {
45
46
  static ifcTimeStamp(): SimpleType;
46
47
  static numeric(): SimpleType;
47
48
  static ifcObjectRef(): SimpleType;
49
+ static contextObjectRef(): SimpleType;
48
50
  static requireIsAssignableFrom(expectedType: ExprType, actualType: ExprType, exceptionProducer: () => ExpressionTypeError): void;
49
- /**
50
- * Requires overlap if actual is a disjunction, assignable from if it is a type
51
- * @param expectedType
52
- * @param actualType
53
- * @param exceptionProducer
54
- */
55
51
  static requireWeakIsAssignableFrom(expectedType: ExprType, actualType: ExprType, exceptionProducer: () => ExpressionTypeError): void;
56
52
  static requireTypesOverlap(actualType: ExprType, actualType2: ExprType, exceptionProducer: () => ExpressionTypeError): void;
57
53
  }
@@ -0,0 +1,11 @@
1
+ import { ExprType } from "../type/ExprType.js";
2
+ import { Value } from "./Value.js";
3
+ export declare class ContextObjectValue implements Value<Record<string, unknown>> {
4
+ private readonly contextObjectValue;
5
+ private readonly type;
6
+ constructor(value: Record<string, unknown>, type: ExprType);
7
+ getValue(): Record<string, unknown>;
8
+ equals(other: Value<any>): boolean;
9
+ toString(): string;
10
+ getType(): ExprType;
11
+ }
@@ -10,4 +10,5 @@ import { IfcDateTimeValue } from "./IfcDateTimeValue.js";
10
10
  import { IfcTimeValue } from "./IfcTimeValue.js";
11
11
  import { IfcDurationValue } from "./IfcDurationValue.js";
12
12
  import { IfcTimeStampValue } from "./IfcTimeStampValue.js";
13
- export type ExpressionValue = NumericValue | StringValue | BooleanValue | LogicalValue | IfcDateValue | IfcDateTimeValue | IfcTimeValue | IfcDurationValue | IfcTimeStampValue | ReferenceValue | ObjectAccessorValue | ArrayValue;
13
+ import { ContextObjectValue } from "./ContextObjectValue.js";
14
+ export type ExpressionValue = NumericValue | StringValue | BooleanValue | LogicalValue | IfcDateValue | IfcDateTimeValue | IfcTimeValue | IfcDurationValue | IfcTimeStampValue | ReferenceValue | ObjectAccessorValue | ContextObjectValue | ArrayValue;
@@ -1,7 +1,7 @@
1
1
  import { BoxedValueTypes } from "./BoxedValueTypes.js";
2
2
  import { ExprType } from "../type/ExprType.js";
3
3
  import { ValueType } from "./ValueType.js";
4
- export interface Value<T extends ValueType | BoxedValueTypes | Array<Value<BoxedValueTypes | Array<Value<BoxedValueTypes>>>>> {
4
+ export interface Value<T extends ValueType | BoxedValueTypes | Record<string, unknown> | Array<Value<BoxedValueTypes | Record<string, unknown> | Array<Value<BoxedValueTypes | Record<string, unknown>>>>>> {
5
5
  getValue(): T;
6
6
  equals(other: Value<any>): boolean;
7
7
  toString(): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ifc-expressions",
3
- "version": "2.3.0",
3
+ "version": "3.0.0-beta.2",
4
4
  "description": "Parsing and evaluation of IFC expressions",
5
5
  "main": "dist/cjs/IfcExpression.js",
6
6
  "module": "dist/mjs/IfcExpression.js",
@@ -24,7 +24,7 @@
24
24
  "build-complete": "npm run format-apply && npm run build && npm run test",
25
25
  "build": "npm run clean && npm run make-parser && npm run transpile",
26
26
  "clean": "gulp clean",
27
- "make-parser": "cd src/grammar && java -jar ../../antlr4/antlr-4.13.0-complete.jar -Werror -Dlanguage=TypeScript -visitor IfcExpression.g4 -o ../gen/parser",
27
+ "make-parser": "antlr-ng --generate-visitor --warnings-are-errors -Dlanguage=TypeScript --exact-output-dir -o src/gen/parser src/grammar/IfcExpression.g4",
28
28
  "transpile": "gulp build",
29
29
  "test": "jest --coverage",
30
30
  "format-apply": "prettier --write .",
@@ -39,13 +39,15 @@
39
39
  "Formula"
40
40
  ],
41
41
  "dependencies": {
42
- "antlr4": "^4.13.0",
42
+ "antlr4-c3": "^3.4.4",
43
+ "antlr4ng": "^3.0.16",
43
44
  "decimal.js": "^10.4.3"
44
45
  },
45
46
  "devDependencies": {
46
47
  "@types/jest": "^29.5.2",
47
48
  "@typescript-eslint/eslint-plugin": "^5.60.0",
48
49
  "@typescript-eslint/parser": "^5.60.0",
50
+ "antlr-ng": "^1.0.10",
49
51
  "del": "^7.0.0",
50
52
  "eslint": "^8.43.0",
51
53
  "eslint-config-prettier": "^8.8.0",