ifc-expressions 2.0.1-beta.6 → 2.0.1-beta.8
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/dist/E.d.ts +3 -0
- package/dist/cjs/E.js +4 -0
- package/dist/cjs/E.js.map +1 -1
- package/dist/cjs/compiler/ExprCompiler.js +6 -0
- package/dist/cjs/compiler/ExprCompiler.js.map +1 -1
- package/dist/cjs/compiler/IfcExpressionValidationListener.js +6 -3
- package/dist/cjs/compiler/IfcExpressionValidationListener.js.map +1 -1
- package/dist/cjs/compiler/TypeManager.js +14 -0
- package/dist/cjs/compiler/TypeManager.js.map +1 -1
- package/dist/cjs/error/ExceptionToExprEvalErrorMapper.js +3 -0
- package/dist/cjs/error/ExceptionToExprEvalErrorMapper.js.map +1 -1
- package/dist/cjs/error/FunctionArgumentException.js +14 -0
- package/dist/cjs/error/FunctionArgumentException.js.map +1 -0
- package/dist/cjs/error/MissingFunctionArgumentException.js +5 -7
- package/dist/cjs/error/MissingFunctionArgumentException.js.map +1 -1
- package/dist/cjs/error/SpuriousFunctionArgumentException.js +12 -0
- package/dist/cjs/error/SpuriousFunctionArgumentException.js.map +1 -0
- package/dist/cjs/error/mapper/MissingFunctionArgumentExceptionMapper.js.map +1 -1
- package/dist/cjs/error/mapper/SpuriousFunctionArgumentExceptionMapper.js +12 -0
- package/dist/cjs/error/mapper/SpuriousFunctionArgumentExceptionMapper.js.map +1 -0
- package/dist/cjs/expression/ExprEvalResult.js +14 -4
- package/dist/cjs/expression/ExprEvalResult.js.map +1 -1
- package/dist/cjs/expression/ExprKind.js +5 -4
- package/dist/cjs/expression/ExprKind.js.map +1 -1
- package/dist/cjs/expression/boolean/AndExpr.js +3 -11
- package/dist/cjs/expression/boolean/AndExpr.js.map +1 -1
- package/dist/cjs/expression/boolean/BinaryBooleanOpExpr.js +23 -0
- package/dist/cjs/expression/boolean/BinaryBooleanOpExpr.js.map +1 -0
- package/dist/cjs/expression/boolean/LogicalLiteralExpr.js +35 -0
- package/dist/cjs/expression/boolean/LogicalLiteralExpr.js.map +1 -0
- package/dist/cjs/expression/boolean/NotExpr.js +3 -5
- package/dist/cjs/expression/boolean/NotExpr.js.map +1 -1
- package/dist/cjs/expression/boolean/OrExpr.js +3 -11
- package/dist/cjs/expression/boolean/OrExpr.js.map +1 -1
- package/dist/cjs/expression/boolean/XorExpr.js +4 -14
- package/dist/cjs/expression/boolean/XorExpr.js.map +1 -1
- package/dist/cjs/expression/comparison/EqualsExpr.js +1 -1
- package/dist/cjs/expression/comparison/EqualsExpr.js.map +1 -1
- package/dist/cjs/expression/comparison/NotEqualsExpr.js +1 -1
- package/dist/cjs/expression/comparison/NotEqualsExpr.js.map +1 -1
- package/dist/cjs/expression/function/Func.js +3 -5
- package/dist/cjs/expression/function/Func.js.map +1 -1
- package/dist/cjs/expression/function/IfcExpressionFunctions.js +22 -6
- package/dist/cjs/expression/function/IfcExpressionFunctions.js.map +1 -1
- package/dist/cjs/expression/function/arg/FuncArgLogicalOrBoolean.js +26 -0
- package/dist/cjs/expression/function/arg/FuncArgLogicalOrBoolean.js.map +1 -0
- package/dist/cjs/expression/function/arg/FuncArgRegexFlag.js +29 -0
- package/dist/cjs/expression/function/arg/FuncArgRegexFlag.js.map +1 -0
- package/dist/cjs/expression/function/impl/ApplyRegex.js +7 -1
- package/dist/cjs/expression/function/impl/ApplyRegex.js.map +1 -1
- package/dist/cjs/expression/function/impl/FuncBooleanBinary.js +7 -8
- package/dist/cjs/expression/function/impl/FuncBooleanBinary.js.map +1 -1
- package/dist/cjs/expression/function/impl/IF.js +54 -6
- package/dist/cjs/expression/function/impl/IF.js.map +1 -1
- package/dist/cjs/expression/function/impl/MatchesPattern.js +10 -2
- package/dist/cjs/expression/function/impl/MatchesPattern.js.map +1 -1
- package/dist/cjs/expression/function/impl/NOT.js +4 -6
- package/dist/cjs/expression/function/impl/NOT.js.map +1 -1
- package/dist/cjs/expression/function/impl/ReplacePattern.js +10 -2
- package/dist/cjs/expression/function/impl/ReplacePattern.js.map +1 -1
- package/dist/cjs/expression/function/impl/TOBOOLEAN.js +72 -0
- package/dist/cjs/expression/function/impl/TOBOOLEAN.js.map +1 -0
- package/dist/cjs/expression/function/impl/TOLOGICAL.js +39 -0
- package/dist/cjs/expression/function/impl/TOLOGICAL.js.map +1 -0
- package/dist/cjs/expression/function/impl/TONUMERIC.js +52 -0
- package/dist/cjs/expression/function/impl/TONUMERIC.js.map +1 -0
- package/dist/cjs/gen/parser/IfcExpressionLexer.js +75 -65
- package/dist/cjs/gen/parser/IfcExpressionLexer.js.map +1 -1
- package/dist/cjs/gen/parser/IfcExpressionListener.js.map +1 -1
- package/dist/cjs/gen/parser/IfcExpressionParser.js +195 -121
- package/dist/cjs/gen/parser/IfcExpressionParser.js.map +1 -1
- package/dist/cjs/gen/parser/IfcExpressionVisitor.js.map +1 -1
- package/dist/cjs/type/Types.js +6 -0
- package/dist/cjs/type/Types.js.map +1 -1
- package/dist/cjs/value/BooleanValue.js +65 -4
- package/dist/cjs/value/BooleanValue.js.map +1 -1
- package/dist/cjs/value/Logical.js +2 -0
- package/dist/cjs/value/Logical.js.map +1 -0
- package/dist/cjs/value/LogicalValue.js +110 -6
- package/dist/cjs/value/LogicalValue.js.map +1 -1
- package/dist/compiler/ExprCompiler.d.ts +2 -1
- package/dist/compiler/IfcExpressionValidationListener.d.ts +2 -1
- package/dist/compiler/TypeManager.d.ts +4 -0
- package/dist/error/FunctionArgumentException.d.ts +7 -0
- package/dist/error/MissingFunctionArgumentException.d.ts +3 -6
- package/dist/error/SpuriousFunctionArgumentException.d.ts +4 -0
- package/dist/error/mapper/MissingFunctionArgumentExceptionMapper.d.ts +2 -2
- package/dist/error/mapper/SpuriousFunctionArgumentExceptionMapper.d.ts +6 -0
- package/dist/expression/ExprEvalResult.d.ts +9 -2
- package/dist/expression/ExprKind.d.ts +5 -4
- package/dist/expression/boolean/AndExpr.d.ts +4 -8
- package/dist/expression/boolean/BinaryBooleanOpExpr.d.ts +14 -0
- package/dist/expression/boolean/LogicalLiteralExpr.d.ts +12 -0
- package/dist/expression/boolean/NotExpr.d.ts +4 -3
- package/dist/expression/boolean/OrExpr.d.ts +4 -8
- package/dist/expression/boolean/XorExpr.d.ts +4 -8
- package/dist/expression/function/Func.d.ts +2 -1
- package/dist/expression/function/arg/FuncArgLogicalOrBoolean.d.ts +12 -0
- package/dist/expression/function/arg/FuncArgRegexFlag.d.ts +9 -0
- package/dist/expression/function/impl/ApplyRegex.d.ts +2 -0
- package/dist/expression/function/impl/FuncBooleanBinary.d.ts +2 -2
- package/dist/expression/function/impl/IF.d.ts +5 -0
- package/dist/expression/function/impl/TOBOOLEAN.d.ts +12 -0
- package/dist/expression/function/impl/TOLOGICAL.d.ts +13 -0
- package/dist/expression/function/impl/TONUMERIC.d.ts +12 -0
- package/dist/gen/parser/IfcExpressionLexer.d.ts +8 -7
- package/dist/gen/parser/IfcExpressionListener.d.ts +11 -0
- package/dist/gen/parser/IfcExpressionParser.d.ts +20 -8
- package/dist/gen/parser/IfcExpressionVisitor.d.ts +7 -0
- package/dist/mjs/E.js +4 -0
- package/dist/mjs/E.js.map +1 -1
- package/dist/mjs/compiler/ExprCompiler.js +6 -0
- package/dist/mjs/compiler/ExprCompiler.js.map +1 -1
- package/dist/mjs/compiler/IfcExpressionValidationListener.js +6 -3
- package/dist/mjs/compiler/IfcExpressionValidationListener.js.map +1 -1
- package/dist/mjs/compiler/TypeManager.js +14 -0
- package/dist/mjs/compiler/TypeManager.js.map +1 -1
- package/dist/mjs/error/ExceptionToExprEvalErrorMapper.js +3 -0
- package/dist/mjs/error/ExceptionToExprEvalErrorMapper.js.map +1 -1
- package/dist/mjs/error/FunctionArgumentException.js +10 -0
- package/dist/mjs/error/FunctionArgumentException.js.map +1 -0
- package/dist/mjs/error/MissingFunctionArgumentException.js +5 -7
- package/dist/mjs/error/MissingFunctionArgumentException.js.map +1 -1
- package/dist/mjs/error/SpuriousFunctionArgumentException.js +8 -0
- package/dist/mjs/error/SpuriousFunctionArgumentException.js.map +1 -0
- package/dist/mjs/error/mapper/MissingFunctionArgumentExceptionMapper.js.map +1 -1
- package/dist/mjs/error/mapper/SpuriousFunctionArgumentExceptionMapper.js +8 -0
- package/dist/mjs/error/mapper/SpuriousFunctionArgumentExceptionMapper.js.map +1 -0
- package/dist/mjs/expression/ExprEvalResult.js +12 -3
- package/dist/mjs/expression/ExprEvalResult.js.map +1 -1
- package/dist/mjs/expression/ExprKind.js +5 -4
- package/dist/mjs/expression/ExprKind.js.map +1 -1
- package/dist/mjs/expression/boolean/AndExpr.js +3 -11
- package/dist/mjs/expression/boolean/AndExpr.js.map +1 -1
- package/dist/mjs/expression/boolean/BinaryBooleanOpExpr.js +19 -0
- package/dist/mjs/expression/boolean/BinaryBooleanOpExpr.js.map +1 -0
- package/dist/mjs/expression/boolean/LogicalLiteralExpr.js +31 -0
- package/dist/mjs/expression/boolean/LogicalLiteralExpr.js.map +1 -0
- package/dist/mjs/expression/boolean/NotExpr.js +3 -5
- package/dist/mjs/expression/boolean/NotExpr.js.map +1 -1
- package/dist/mjs/expression/boolean/OrExpr.js +3 -11
- package/dist/mjs/expression/boolean/OrExpr.js.map +1 -1
- package/dist/mjs/expression/boolean/XorExpr.js +4 -14
- package/dist/mjs/expression/boolean/XorExpr.js.map +1 -1
- package/dist/mjs/expression/comparison/EqualsExpr.js +1 -1
- package/dist/mjs/expression/comparison/EqualsExpr.js.map +1 -1
- package/dist/mjs/expression/comparison/NotEqualsExpr.js +1 -1
- package/dist/mjs/expression/comparison/NotEqualsExpr.js.map +1 -1
- package/dist/mjs/expression/function/Func.js +3 -5
- package/dist/mjs/expression/function/Func.js.map +1 -1
- package/dist/mjs/expression/function/IfcExpressionFunctions.js +22 -6
- package/dist/mjs/expression/function/IfcExpressionFunctions.js.map +1 -1
- package/dist/mjs/expression/function/arg/FuncArgLogicalOrBoolean.js +22 -0
- package/dist/mjs/expression/function/arg/FuncArgLogicalOrBoolean.js.map +1 -0
- package/dist/mjs/expression/function/arg/FuncArgRegexFlag.js +25 -0
- package/dist/mjs/expression/function/arg/FuncArgRegexFlag.js.map +1 -0
- package/dist/mjs/expression/function/impl/ApplyRegex.js +7 -1
- package/dist/mjs/expression/function/impl/ApplyRegex.js.map +1 -1
- package/dist/mjs/expression/function/impl/FuncBooleanBinary.js +8 -9
- package/dist/mjs/expression/function/impl/FuncBooleanBinary.js.map +1 -1
- package/dist/mjs/expression/function/impl/IF.js +56 -8
- package/dist/mjs/expression/function/impl/IF.js.map +1 -1
- package/dist/mjs/expression/function/impl/MatchesPattern.js +10 -2
- package/dist/mjs/expression/function/impl/MatchesPattern.js.map +1 -1
- package/dist/mjs/expression/function/impl/NOT.js +4 -6
- package/dist/mjs/expression/function/impl/NOT.js.map +1 -1
- package/dist/mjs/expression/function/impl/ReplacePattern.js +10 -2
- package/dist/mjs/expression/function/impl/ReplacePattern.js.map +1 -1
- package/dist/mjs/expression/function/impl/TOBOOLEAN.js +68 -0
- package/dist/mjs/expression/function/impl/TOBOOLEAN.js.map +1 -0
- package/dist/mjs/expression/function/impl/TOLOGICAL.js +35 -0
- package/dist/mjs/expression/function/impl/TOLOGICAL.js.map +1 -0
- package/dist/mjs/expression/function/impl/TONUMERIC.js +48 -0
- package/dist/mjs/expression/function/impl/TONUMERIC.js.map +1 -0
- package/dist/mjs/gen/parser/IfcExpressionLexer.js +75 -65
- package/dist/mjs/gen/parser/IfcExpressionLexer.js.map +1 -1
- package/dist/mjs/gen/parser/IfcExpressionListener.js.map +1 -1
- package/dist/mjs/gen/parser/IfcExpressionParser.js +193 -120
- package/dist/mjs/gen/parser/IfcExpressionParser.js.map +1 -1
- package/dist/mjs/gen/parser/IfcExpressionVisitor.js.map +1 -1
- package/dist/mjs/type/Types.js +6 -0
- package/dist/mjs/type/Types.js.map +1 -1
- package/dist/mjs/value/BooleanValue.js +65 -4
- package/dist/mjs/value/BooleanValue.js.map +1 -1
- package/dist/mjs/value/Logical.js +2 -0
- package/dist/mjs/value/Logical.js.map +1 -0
- package/dist/mjs/value/LogicalValue.js +110 -6
- package/dist/mjs/value/LogicalValue.js.map +1 -1
- package/dist/type/Types.d.ts +2 -0
- package/dist/value/BooleanValue.d.ts +15 -2
- package/dist/value/Logical.d.ts +0 -0
- package/dist/value/LogicalValue.d.ts +26 -8
- package/package.json +1 -1
package/dist/E.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ import { OrExpr } from "./expression/boolean/OrExpr.js";
|
|
|
22
22
|
import { XorExpr } from "./expression/boolean/XorExpr.js";
|
|
23
23
|
import { BooleanLiteralExpr } from "./expression/boolean/BooleanLiteralExpr.js";
|
|
24
24
|
import { NotExpr } from "./expression/boolean/NotExpr.js";
|
|
25
|
+
import { Logical } from "./value/LogicalValue.js";
|
|
26
|
+
import { LogicalLiteralExpr } from "./expression/boolean/LogicalLiteralExpr.js";
|
|
25
27
|
export declare class E {
|
|
26
28
|
static array(...elements: Array<Expr<any>>): ArrayExpr;
|
|
27
29
|
static concat(left: Expr<StringValue>, right: Expr<StringValue>): StringConcatExpr;
|
|
@@ -41,5 +43,6 @@ export declare class E {
|
|
|
41
43
|
static or(left: Expr<BooleanValue>, right: Expr<BooleanValue>): OrExpr;
|
|
42
44
|
static xor(left: Expr<BooleanValue>, right: Expr<BooleanValue>): XorExpr;
|
|
43
45
|
static boolean(literal: boolean): BooleanLiteralExpr;
|
|
46
|
+
static logical(literal: Logical): LogicalLiteralExpr;
|
|
44
47
|
static not(booleanExpr: Expr<BooleanValue>): NotExpr;
|
|
45
48
|
}
|
package/dist/cjs/E.js
CHANGED
|
@@ -20,6 +20,7 @@ const OrExpr_js_1 = require("./expression/boolean/OrExpr.js");
|
|
|
20
20
|
const XorExpr_js_1 = require("./expression/boolean/XorExpr.js");
|
|
21
21
|
const BooleanLiteralExpr_js_1 = require("./expression/boolean/BooleanLiteralExpr.js");
|
|
22
22
|
const NotExpr_js_1 = require("./expression/boolean/NotExpr.js");
|
|
23
|
+
const LogicalLiteralExpr_js_1 = require("./expression/boolean/LogicalLiteralExpr.js");
|
|
23
24
|
class E {
|
|
24
25
|
static array(...elements) {
|
|
25
26
|
return new ArrayExpr_js_1.ArrayExpr(elements);
|
|
@@ -75,6 +76,9 @@ class E {
|
|
|
75
76
|
static boolean(literal) {
|
|
76
77
|
return new BooleanLiteralExpr_js_1.BooleanLiteralExpr(literal);
|
|
77
78
|
}
|
|
79
|
+
static logical(literal) {
|
|
80
|
+
return new LogicalLiteralExpr_js_1.LogicalLiteralExpr(literal);
|
|
81
|
+
}
|
|
78
82
|
static not(booleanExpr) {
|
|
79
83
|
return new NotExpr_js_1.NotExpr(booleanExpr);
|
|
80
84
|
}
|
package/dist/cjs/E.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/E.ts"],"names":[],"mappings":";;;AAAA,sEAAgE;AAEhE,iFAA2E;AAC3E,mFAA6E;AAC7E,kGAA4F;AAC5F,kGAA4F;AAE5F,sEAAgE;AAEhE,oEAA8D;AAC9D,0EAAoE;AACpE,kEAA4D;AAC5D,sFAAgF;AAEhF,kFAA4E;AAC5E,oEAA8D;AAC9D,8EAAwE;AACxE,2EAAqE;AAErE,gEAA0D;AAC1D,8DAAwD;AACxD,gEAA0D;AAC1D,sFAAgF;AAChF,gEAA0D;AAE1D,MAAa,CAAC;IACL,MAAM,CAAC,KAAK,CAAC,GAAG,QAA0B;QAC/C,OAAO,IAAI,wBAAS,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACM,MAAM,CAAC,MAAM,CAClB,IAAuB,EACvB,KAAwB;QAExB,OAAO,IAAI,sCAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,OAAe;QAClC,OAAO,IAAI,wCAAiB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IACM,MAAM,CAAC,OAAO;QACnB,OAAO,IAAI,oDAAuB,EAAE,CAAC;IACvC,CAAC;IACM,MAAM,C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AClC,CAAC;IACM,MAAM,CAAC,EAAE,CACd,IAAwB,EACxB,KAAyB;QAEzB,OAAO,IAAI,kBAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;IACM,MAAM,CAAC,GAAG,CACf,IAAwB,EACxB,KAAyB;QAEzB,OAAO,IAAI,oBAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IACM,MAAM,CAAC,OAAO,CAAC,OAAgB;QACpC,OAAO,IAAI,0CAAkB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IACM,MAAM,CAAC,OAAO,CAAC,OAAgB;QACpC,OAAO,IAAI,0CAAkB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IACM,MAAM,CAAC,GAAG,CAAC,WAA+B;QAC/C,OAAO,IAAI,oBAAO,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;CACF;AA7FD,cA6FC","file":"E.js","sourcesContent":["import { ArrayExpr } from \"./expression/structure/ArrayExpr.js\";\nimport { Expr } from \"./expression/Expr.js\";\nimport { StringConcatExpr } from \"./expression/string/StringConcatExpr.js\";\nimport { StringLiteralExpr } from \"./expression/string/StringLiteralExpr.js\";\nimport { ElemObjectReferenceExpr } from \"./expression/reference/ElemObjectReferenceExpr.js\";\nimport { PropObjectReferenceExpr } from \"./expression/reference/PropObjectReferenceExpr.js\";\nimport { NumericValue } from \"./value/NumericValue.js\";\nimport { DivideExpr } from \"./expression/numeric/DivideExpr.js\";\nimport { StringValue } from \"./value/StringValue.js\";\nimport { MinusExpr } from \"./expression/numeric/MinusExpr.js\";\nimport { MultiplyExpr } from \"./expression/numeric/MultiplyExpr.js\";\nimport { PlusExpr } from \"./expression/numeric/PlusExpr.js\";\nimport { NumericLiteralExpr } from \"./expression/numeric/NumericLiteralExpr.js\";\nimport { Decimal } from \"decimal.js\";\nimport { ParenthesisExpr } from \"./expression/structure/ParenthesisExpr.js\";\nimport { PowerExpr } from \"./expression/numeric/PowerExpr.js\";\nimport { UnaryMinusExpr } from \"./expression/numeric/UnaryMinusExpr.js\";\nimport { FunctionExpr } from \"./expression/function/FunctionExpr.js\";\nimport { BooleanValue } from \"./value/BooleanValue.js\";\nimport { AndExpr } from \"./expression/boolean/AndExpr.js\";\nimport { OrExpr } from \"./expression/boolean/OrExpr.js\";\nimport { XorExpr } from \"./expression/boolean/XorExpr.js\";\nimport { BooleanLiteralExpr } from \"./expression/boolean/BooleanLiteralExpr.js\";\nimport { NotExpr } from \"./expression/boolean/NotExpr.js\";\nimport { Logical } from \"./value/LogicalValue\";\nimport { LogicalLiteralExpr } from \"./expression/boolean/LogicalLiteralExpr\";\n\nexport class E {\n public static array(...elements: Array<Expr<any>>): ArrayExpr {\n return new ArrayExpr(elements);\n }\n public static concat(\n left: Expr<StringValue>,\n right: Expr<StringValue>\n ): StringConcatExpr {\n return new StringConcatExpr(left, right);\n }\n public static string(literal: string): StringLiteralExpr {\n return new StringLiteralExpr(literal);\n }\n public static element() {\n return new ElemObjectReferenceExpr();\n }\n public static property() {\n return new PropObjectReferenceExpr();\n }\n public static div(\n left: Expr<NumericValue>,\n right: Expr<NumericValue>\n ): DivideExpr {\n return new DivideExpr(left, right);\n }\n public static minus(\n left: Expr<NumericValue>,\n right: Expr<NumericValue>\n ): MinusExpr {\n return new MinusExpr(left, right);\n }\n public static multiply(\n left: Expr<NumericValue>,\n right: Expr<NumericValue>\n ): MultiplyExpr {\n return new MultiplyExpr(left, right);\n }\n public static plus(\n left: Expr<NumericValue>,\n right: Expr<NumericValue>\n ): PlusExpr {\n return new PlusExpr(left, right);\n }\n public static number(literal: number | string | Decimal): NumericLiteralExpr {\n return new NumericLiteralExpr(literal);\n }\n public static parenthesis(\n numericExpression: Expr<NumericValue>\n ): ParenthesisExpr {\n return new ParenthesisExpr(numericExpression);\n }\n public static power(\n base: Expr<NumericValue>,\n power: Expr<NumericValue>\n ): PowerExpr {\n return new PowerExpr(base, power);\n }\n public static unaryMinus(numExpr: Expr<NumericValue>): UnaryMinusExpr {\n return new UnaryMinusExpr(numExpr);\n }\n public static fun(\n functionName: string,\n ...funcArgs: Array<Expr<any>>\n ): FunctionExpr {\n return new FunctionExpr(functionName, funcArgs);\n }\n public static and(\n left: Expr<BooleanValue>,\n right: Expr<BooleanValue>\n ): AndExpr {\n return new AndExpr(left, right);\n }\n public static or(\n left: Expr<BooleanValue>,\n right: Expr<BooleanValue>\n ): OrExpr {\n return new OrExpr(left, right);\n }\n public static xor(\n left: Expr<BooleanValue>,\n right: Expr<BooleanValue>\n ): XorExpr {\n return new XorExpr(left, right);\n }\n public static boolean(literal: boolean) {\n return new BooleanLiteralExpr(literal);\n }\n public static logical(literal: Logical) {\n return new LogicalLiteralExpr(literal);\n }\n public static not(booleanExpr: Expr<BooleanValue>): NotExpr {\n return new NotExpr(booleanExpr);\n }\n}\n"]}
|
|
@@ -36,6 +36,8 @@ const GreaterThanOrEqual_js_1 = require("../expression/comparison/GreaterThanOrE
|
|
|
36
36
|
const LessThan_js_1 = require("../expression/comparison/LessThan.js");
|
|
37
37
|
const LessThanOrEqual_js_1 = require("../expression/comparison/LessThanOrEqual.js");
|
|
38
38
|
const ExprManager_js_1 = require("./ExprManager.js");
|
|
39
|
+
const LogicalValue_js_1 = require("../value/LogicalValue.js");
|
|
40
|
+
const LogicalLiteralExpr_js_1 = require("../expression/boolean/LogicalLiteralExpr.js");
|
|
39
41
|
class ExprCompiler extends IfcExpressionVisitor_js_1.default {
|
|
40
42
|
constructor(typeManager) {
|
|
41
43
|
super();
|
|
@@ -177,6 +179,10 @@ class ExprCompiler extends IfcExpressionVisitor_js_1.default {
|
|
|
177
179
|
this.visitBooleanLiteral = (ctx) => {
|
|
178
180
|
return this.associateContextAndReturn(new BooleanLiteralExpr_js_1.BooleanLiteralExpr(ctx.BOOLEAN().getText().toUpperCase() === "TRUE"), ctx);
|
|
179
181
|
};
|
|
182
|
+
this.visitLogicalLiteral = (ctx) => {
|
|
183
|
+
// the only literal we recognize is 'UNKNOWN' (true and false are boolean literals)
|
|
184
|
+
return this.associateContextAndReturn(new LogicalLiteralExpr_js_1.LogicalLiteralExpr(LogicalValue_js_1.LogicalValue.UNKNOWN_VALUE), ctx);
|
|
185
|
+
};
|
|
180
186
|
this.visitSENot = (ctx) => {
|
|
181
187
|
return this.associateContextAndReturn(new NotExpr_js_1.NotExpr(this.visit(ctx.singleExpr())), ctx);
|
|
182
188
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/compiler/ExprCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,oGAAyE;AACzE,uFAAiF;AA8BjF,yEAAqE;AACrE,4DAAiC;AACjC,mEAA6D;AAC7D,qEAA+D;AAE/D,2EAAqE;AACrE,uEAAiE;AACjE,mGAA6F;AAC7F,mGAA6F;AAC7F,oFAA8E;AAC9E,uEAAiE;AACjE,4EAAsE;AACtE,qEAA+D;AAC/D,+EAAyE;AACzE,iEAA2D;AAC3D,uFAAiF;AACjF,+DAAyD;AACzD,iEAA2D;AAC3D,8EAAwE;AACxE,iEAA2D;AAC3D,mFAA6E;AAC7E,0EAAoE;AACpE,gFAA0E;AAE1E,kFAA4E;AAC5E,gFAA0E;AAC1E,4EAAsE;AACtE,4EAAsE;AACtE,0FAAoF;AACpF,sEAAgE;AAChE,oFAA8E;AAC9E,qDAA+C;AAE/C,MAAa,YAAa,SAAQ,iCAA+B;IAK/D,YAAY,WAAwB;QAClC,KAAK,EAAE,CAAC;QALO,0BAAqB,GAAG,EAAE,CAAC;QAc5C,cAAS,GAAoC,CAAC,GAAG,EAAE,EAAE;YACnD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC;QAWF,qBAAgB,GAA2C,CAAC,GAAG,EAAE,EAAE;YACjE,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE;gBAC3D,OAAO,IAAI,CAAC,yBA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AG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;CAKF;AA9WD,oCA8WC","file":"compiler/ExprCompiler.js","sourcesContent":["import IfcExpressionVisitor from \"../gen/parser/IfcExpressionVisitor.js\";\nimport { NumericLiteralExpr } from \"../expression/numeric/NumericLiteralExpr.js\";\nimport {\n ArrayElementListContext,\n ArrayExprContext,\n BooleanLiteralContext,\n ExprContext,\n ExprListContext,\n FunctionCallContext,\n LiteralContext,\n MethodCallChainEndContext,\n MethodCallChainInnerContext,\n NumLiteralContext,\n SEAddSubContext,\n SEArrayExprContext,\n SEBooleanBinaryOpContext,\n SEComparisonContext,\n SEFunctionCallContext,\n SELiteralContext,\n SEMethodCallContext,\n SEMulDivContext,\n SENotContext,\n SEParenthesisContext,\n SEPowerContext,\n SEUnaryMinusContext,\n SEUnaryMultipleMinusContext,\n SEVariableRefContext,\n StringLiteralContext,\n VariableRefContext,\n} from \"../gen/parser/IfcExpressionParser.js\";\nimport { Expr } from \"../expression/Expr.js\";\nimport { isNullish, isPresent } from \"../util/IfcExpressionUtils.js\";\nimport Decimal from \"decimal.js\";\nimport { PlusExpr } from \"../expression/numeric/PlusExpr.js\";\nimport { MinusExpr } from \"../expression/numeric/MinusExpr.js\";\nimport { ParserRuleContext } from \"antlr4\";\nimport { MultiplyExpr } from \"../expression/numeric/MultiplyExpr.js\";\nimport { DivideExpr } from \"../expression/numeric/DivideExpr.js\";\nimport { PropObjectReferenceExpr } from \"../expression/reference/PropObjectReferenceExpr.js\";\nimport { ElemObjectReferenceExpr } from \"../expression/reference/ElemObjectReferenceExpr.js\";\nimport { StringLiteralExpr } from \"../expression/string/StringLiteralExpr.js\";\nimport { ArrayExpr } from \"../expression/structure/ArrayExpr.js\";\nimport { FunctionExpr } from \"../expression/function/FunctionExpr.js\";\nimport { PowerExpr } from \"../expression/numeric/PowerExpr.js\";\nimport { UnaryMinusExpr } from \"../expression/numeric/UnaryMinusExpr.js\";\nimport { AndExpr } from \"../expression/boolean/AndExpr.js\";\nimport { BooleanLiteralExpr } from \"../expression/boolean/BooleanLiteralExpr.js\";\nimport { OrExpr } from \"../expression/boolean/OrExpr.js\";\nimport { XorExpr } from \"../expression/boolean/XorExpr.js\";\nimport { SyntaxErrorException } from \"../error/SyntaxErrorException.js\";\nimport { NotExpr } from \"../expression/boolean/NotExpr.js\";\nimport { ParenthesisExpr } from \"../expression/structure/ParenthesisExpr.js\";\nimport { EqualsExpr } from \"../expression/comparison/EqualsExpr.js\";\nimport { NotEqualsExpr } from \"../expression/comparison/NotEqualsExpr.js\";\nimport { TypeManager } from \"./TypeManager.js\";\nimport { StringConcatExpr } from \"../expression/string/StringConcatExpr.js\";\nimport { PlusOrConcatExpr } from \"../expression/poly/PlusOrConcatExpr.js\";\nimport { ExpressionTypeError } from \"../error/ExpressionTypeError.js\";\nimport { GreaterThan } from \"../expression/comparison/GreaterThan.js\";\nimport { GreaterThanOrEqual } from \"../expression/comparison/GreaterThanOrEqual.js\";\nimport { LessThan } from \"../expression/comparison/LessThan.js\";\nimport { LessThanOrEqual } from \"../expression/comparison/LessThanOrEqual.js\";\nimport { ExprManager } from \"./ExprManager.js\";\n\nexport class ExprCompiler extends IfcExpressionVisitor<Expr<any>> {\n private readonly methodCallTargetStack = [];\n private readonly typeManager: TypeManager;\n private readonly exprManager: ExprManager;\n\n constructor(typeManager: TypeManager) {\n super();\n this.typeManager = typeManager;\n this.exprManager = new ExprManager();\n }\n\n public getExprManager(): ExprManager {\n return this.exprManager;\n }\n\n visitExpr: (ctx: ExprContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.singleExpr());\n };\n\n /*================================================\n * VariableRef\n *==============================================*/\n\n private associateContextAndReturn(expr: Expr<any>, ctx: ParserRuleContext) {\n this.exprManager.registerExprWithContext(expr, ctx);\n return expr;\n }\n\n visitVariableRef: (ctx: VariableRefContext) => Expr<any> = (ctx) => {\n if (ctx.IDENTIFIER().getText().toUpperCase() === \"PROPERTY\") {\n return this.associateContextAndReturn(new PropObjectReferenceExpr(), ctx);\n } else if (ctx.IDENTIFIER().getText().toUpperCase() === \"ELEMENT\") {\n return this.associateContextAndReturn(new ElemObjectReferenceExpr(), ctx);\n }\n throw new Error(`Parsing error: No variable '${ctx.getText()}' found `);\n };\n\n visitSEComparison: (ctx: SEComparisonContext) => Expr<any> = (ctx) => {\n const left = this.visit(ctx.singleExpr(0));\n const right = this.visit(ctx.singleExpr(1));\n switch (ctx.CMP_OP().getText()) {\n case \"==\":\n return this.associateContextAndReturn(new EqualsExpr(left, right), ctx);\n case \"!=\":\n return this.associateContextAndReturn(\n new NotEqualsExpr(left, right),\n ctx\n );\n case \">\":\n return this.associateContextAndReturn(\n new GreaterThan(left, right),\n ctx\n );\n case \">=\":\n return this.associateContextAndReturn(\n new GreaterThanOrEqual(left, right),\n ctx\n );\n case \"<\":\n return this.associateContextAndReturn(new LessThan(left, right), ctx);\n case \"<=\":\n return this.associateContextAndReturn(\n new LessThanOrEqual(left, right),\n ctx\n );\n }\n throw new Error(\n `Parsing error: comparison operator '${ctx\n .CMP_OP()\n .getText()}' not supported`\n );\n };\n\n visitSEMethodCall: (ctx: SEMethodCallContext) => Expr<any> = (ctx) => {\n this.methodCallTargetStack.push(this.visit(ctx.singleExpr()));\n return this.visit(ctx.methodCallChain());\n };\n\n visitSELiteral: (ctx: SELiteralContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.literal());\n };\n\n visitSEVariableRef: (ctx: SEVariableRefContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.variableRef());\n };\n visitSEArrayExpr: (ctx: SEArrayExprContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.arrayExpr());\n };\n visitSEFunctionCall: (ctx: SEFunctionCallContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.functionCall());\n };\n visitSEParenthesis: (ctx: SEParenthesisContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new ParenthesisExpr(this.visit(ctx._sub)),\n ctx\n );\n };\n\n /*================================================\n * MethodCallChain\n *==============================================*/\n\n visitMethodCallChainInner: (ctx: MethodCallChainInnerContext) => Expr<any> = (\n ctx\n ) => {\n const functionExpr = new FunctionExpr(\n ctx.functionCall().IDENTIFIER().getText(),\n this.collectFunctionArguments(ctx.functionCall().exprList(), [\n this.methodCallTargetStack.pop(),\n ])\n );\n this.associateContextAndReturn(functionExpr, ctx.functionCall());\n this.methodCallTargetStack.push(functionExpr);\n return this.visit(ctx.methodCallChain());\n };\n\n visitMethodCallChainEnd: (ctx: MethodCallChainEndContext) => Expr<any> = (\n ctx\n ) => {\n return this.associateContextAndReturn(\n new FunctionExpr(\n ctx.functionCall().IDENTIFIER().getText(),\n this.collectFunctionArguments(ctx.functionCall().exprList(), [\n this.methodCallTargetStack.pop(),\n ])\n ),\n ctx.functionCall()\n );\n };\n\n visitSEAddSub: (ctx: SEAddSubContext) => Expr<any> = (ctx) => {\n this.typeManager.requireTypesOverlap(ctx._left, ctx._right);\n switch (ctx._op.text) {\n case \"+\":\n return this.makePlusExpr(ctx);\n case \"-\":\n return this.associateContextAndReturn(\n new MinusExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n default:\n ExprCompiler.failNode(ctx);\n }\n };\n\n private makePlusExpr(ctx: SEAddSubContext) {\n if (this.typeManager.isNumeric(ctx._left, ctx._right)) {\n return this.associateContextAndReturn(\n new PlusExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n }\n if (this.typeManager.isString(ctx._left, ctx._right)) {\n return this.associateContextAndReturn(\n new StringConcatExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n }\n if (\n this.typeManager.overlapsWithString(ctx._left, ctx._right) ||\n this.typeManager.overlapsWithNumeric(ctx._left, ctx._right)\n ) {\n return this.associateContextAndReturn(\n new PlusOrConcatExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n }\n throw new ExpressionTypeError(\n \"Operator '+' requires the operands to be either both of type numeric or both of type string, but they are not.\",\n ctx\n );\n }\n\n visitSEMulDiv: (ctx: SEMulDivContext) => Expr<any> = (ctx) => {\n switch (ctx._op.text) {\n case \"*\":\n return this.associateContextAndReturn(\n new MultiplyExpr(\n this.visit(ctx.getChild(0)),\n this.visit(ctx.getChild(2))\n ),\n ctx\n );\n case \"/\":\n return this.associateContextAndReturn(\n new DivideExpr(\n this.visit(ctx.getChild(0)),\n this.visit(ctx.getChild(2))\n ),\n ctx\n );\n default:\n ExprCompiler.failNode(ctx);\n }\n };\n\n /*================================================\n * StringExpr\n *===============================================*/\n\n visitStringLiteral: (ctx: StringLiteralContext) => Expr<any> = (ctx) => {\n const quotedString = ctx.QUOTED_STRING().getText();\n const text = quotedString.substring(1, quotedString.length - 1);\n return this.associateContextAndReturn(new StringLiteralExpr(text), ctx);\n };\n\n /*================================================\n * NumExpr\n *===============================================*/\n\n visitNumLiteral: (ctx: NumLiteralContext) => Expr<any> = (ctx) => {\n let val = ctx.INT();\n if (isPresent(val)) {\n return this.associateContextAndReturn(\n new NumericLiteralExpr(new Decimal(ctx.getText())),\n ctx\n );\n }\n val = ctx.FLOAT();\n if (isPresent(val)) {\n return this.associateContextAndReturn(\n new NumericLiteralExpr(new Decimal(ctx.getText())),\n ctx\n );\n }\n ExprCompiler.failNode(ctx);\n };\n\n visitSEUnaryMultipleMinus: (ctx: SEUnaryMultipleMinusContext) => Expr<any> = (\n ctx\n ) => {\n return this.visit(ctx.singleExpr());\n };\n visitSEPower: (ctx: SEPowerContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new PowerExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n };\n visitSEUnaryMinus: (ctx: SEUnaryMinusContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new UnaryMinusExpr(this.visit(ctx.singleExpr())),\n ctx\n );\n };\n\n /*================================================\n * BooleanExpr\n *===============================================*/\n\n visitSEBooleanBinaryOp: (ctx: SEBooleanBinaryOpContext) => Expr<any> = (\n ctx\n ) => {\n switch (ctx._op.text) {\n case \"&&\":\n return this.associateContextAndReturn(\n new AndExpr(\n this.visit(ctx.singleExpr(0)),\n this.visit(ctx.singleExpr(1))\n ),\n ctx\n );\n case \"||\":\n return this.associateContextAndReturn(\n new OrExpr(\n this.visit(ctx.singleExpr(0)),\n this.visit(ctx.singleExpr(1))\n ),\n ctx\n );\n case \"><\":\n return this.associateContextAndReturn(\n new XorExpr(\n this.visit(ctx.singleExpr(0)),\n this.visit(ctx.singleExpr(1))\n ),\n ctx\n );\n }\n throw new SyntaxErrorException(\n ctx._op.text,\n ctx._op.line,\n ctx._op.column,\n `Unknown boolean operator ${ctx._op.text}`\n );\n };\n\n visitBooleanLiteral: (ctx: BooleanLiteralContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new BooleanLiteralExpr(ctx.BOOLEAN().getText().toUpperCase() === \"TRUE\"),\n ctx\n );\n };\n\n visitSENot: (ctx: SENotContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new NotExpr(this.visit(ctx.singleExpr())),\n ctx\n );\n };\n\n /*================================================\n * ArrayExpr\n *===============================================*/\n\n visitArrayExpr: (ctx: ArrayExprContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new ArrayExpr(this.collectArrayElements(ctx.arrayElementList())),\n ctx\n );\n };\n\n collectArrayElements: (ctx: ArrayElementListContext) => Array<Expr<any>> = (\n ctx\n ) => {\n if (!isNullish(ctx)) {\n const first = this.visit(ctx.singleExpr());\n const rest = ctx.arrayElementList();\n if (!isNullish(rest)) {\n const arr = this.collectArrayElements(rest);\n arr.unshift(first);\n return arr;\n }\n return [first];\n }\n return [];\n };\n\n /*================================================\n * FuncExpr\n *===============================================*/\n\n visitFunctionCall: (ctx: FunctionCallContext) => Expr<any> = (ctx) => {\n const args = isNullish(ctx.exprList())\n ? []\n : this.collectFunctionArguments(ctx.exprList());\n return this.associateContextAndReturn(\n new FunctionExpr(ctx.IDENTIFIER().getText(), args),\n ctx\n );\n };\n\n collectFunctionArguments: (\n ctx: ExprListContext,\n resultSoFar?: Array<Expr<any>>\n ) => Array<Expr<any>> = (ctx, resultSoFar?: Array<Expr<any>>) => {\n if (isNullish(resultSoFar)) {\n resultSoFar = [];\n }\n if (!isNullish(ctx)) {\n resultSoFar.push(this.visit(ctx.singleExpr()));\n const rest = ctx.exprList();\n if (!isNullish(rest)) {\n return this.collectFunctionArguments(rest, resultSoFar);\n }\n }\n return resultSoFar;\n };\n\n private static failNode(ctx: ParserRuleContext) {\n throw new Error(`Cannot parse (sub)expression ${ctx.getText()}`);\n }\n\n visitLiteral: (ctx: LiteralContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.getChild(0));\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/compiler/ExprCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,oGAAyE;AACzE,uFAAiF;AA+BjF,yEAAqE;AACrE,4DAAiC;AACjC,mEAA6D;AAC7D,qEAA+D;AAE/D,2EAAqE;AACrE,uEAAiE;AACjE,mGAA6F;AAC7F,mGAA6F;AAC7F,oFAA8E;AAC9E,uEAAiE;AACjE,4EAAsE;AACtE,qEAA+D;AAC/D,+EAAyE;AACzE,iEAA2D;AAC3D,uFAAiF;AACjF,+DAAyD;AACzD,iEAA2D;AAC3D,8EAAwE;AACxE,iEAA2D;AAC3D,mFAA6E;AAC7E,0EAAoE;AACpE,gFAA0E;AAE1E,kFAA4E;AAC5E,gFAA0E;AAC1E,4EAAsE;AACtE,4EAAsE;AACtE,0FAAoF;AACpF,sEAAgE;AAChE,oFAA8E;AAC9E,qDAA+C;AAC/C,8DAAwD;AACxD,uFAAiF;AAEjF,MAAa,YAAa,SAAQ,iCAA+B;IAK/D,YAAY,WAAwB;QAClC,KAAK,EAAE,CAAC;QALO,0BAAqB,GAAG,EAAE,CAAC;QAc5C,cAAS,GAAoC,CAAC,GAAG,EAAE,EAAE;YACnD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACt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CAAC,EAC3D;YACA,OAAO,IAAI,CAAC,yBAAyB,CACnC,IAAI,sCAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EACnE,GAAG,CACJ,CAAC;SACH;QACD,MAAM,IAAI,4CAAmB,CAC3B,gHAAgH,EAChH,GAAG,CACJ,CAAC;IACJ,CAAC;IAoMO,MAAM,CAAC,QAAQ,CAAC,GAAsB;QAC5C,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;CAKF;AAtXD,oCAsXC","file":"compiler/ExprCompiler.js","sourcesContent":["import IfcExpressionVisitor from \"../gen/parser/IfcExpressionVisitor.js\";\nimport { NumericLiteralExpr } from \"../expression/numeric/NumericLiteralExpr.js\";\nimport {\n ArrayElementListContext,\n ArrayExprContext,\n BooleanLiteralContext,\n ExprContext,\n ExprListContext,\n FunctionCallContext,\n LiteralContext,\n LogicalLiteralContext,\n MethodCallChainEndContext,\n MethodCallChainInnerContext,\n NumLiteralContext,\n SEAddSubContext,\n SEArrayExprContext,\n SEBooleanBinaryOpContext,\n SEComparisonContext,\n SEFunctionCallContext,\n SELiteralContext,\n SEMethodCallContext,\n SEMulDivContext,\n SENotContext,\n SEParenthesisContext,\n SEPowerContext,\n SEUnaryMinusContext,\n SEUnaryMultipleMinusContext,\n SEVariableRefContext,\n StringLiteralContext,\n VariableRefContext,\n} from \"../gen/parser/IfcExpressionParser.js\";\nimport { Expr } from \"../expression/Expr.js\";\nimport { isNullish, isPresent } from \"../util/IfcExpressionUtils.js\";\nimport Decimal from \"decimal.js\";\nimport { PlusExpr } from \"../expression/numeric/PlusExpr.js\";\nimport { MinusExpr } from \"../expression/numeric/MinusExpr.js\";\nimport { ParserRuleContext } from \"antlr4\";\nimport { MultiplyExpr } from \"../expression/numeric/MultiplyExpr.js\";\nimport { DivideExpr } from \"../expression/numeric/DivideExpr.js\";\nimport { PropObjectReferenceExpr } from \"../expression/reference/PropObjectReferenceExpr.js\";\nimport { ElemObjectReferenceExpr } from \"../expression/reference/ElemObjectReferenceExpr.js\";\nimport { StringLiteralExpr } from \"../expression/string/StringLiteralExpr.js\";\nimport { ArrayExpr } from \"../expression/structure/ArrayExpr.js\";\nimport { FunctionExpr } from \"../expression/function/FunctionExpr.js\";\nimport { PowerExpr } from \"../expression/numeric/PowerExpr.js\";\nimport { UnaryMinusExpr } from \"../expression/numeric/UnaryMinusExpr.js\";\nimport { AndExpr } from \"../expression/boolean/AndExpr.js\";\nimport { BooleanLiteralExpr } from \"../expression/boolean/BooleanLiteralExpr.js\";\nimport { OrExpr } from \"../expression/boolean/OrExpr.js\";\nimport { XorExpr } from \"../expression/boolean/XorExpr.js\";\nimport { SyntaxErrorException } from \"../error/SyntaxErrorException.js\";\nimport { NotExpr } from \"../expression/boolean/NotExpr.js\";\nimport { ParenthesisExpr } from \"../expression/structure/ParenthesisExpr.js\";\nimport { EqualsExpr } from \"../expression/comparison/EqualsExpr.js\";\nimport { NotEqualsExpr } from \"../expression/comparison/NotEqualsExpr.js\";\nimport { TypeManager } from \"./TypeManager.js\";\nimport { StringConcatExpr } from \"../expression/string/StringConcatExpr.js\";\nimport { PlusOrConcatExpr } from \"../expression/poly/PlusOrConcatExpr.js\";\nimport { ExpressionTypeError } from \"../error/ExpressionTypeError.js\";\nimport { GreaterThan } from \"../expression/comparison/GreaterThan.js\";\nimport { GreaterThanOrEqual } from \"../expression/comparison/GreaterThanOrEqual.js\";\nimport { LessThan } from \"../expression/comparison/LessThan.js\";\nimport { LessThanOrEqual } from \"../expression/comparison/LessThanOrEqual.js\";\nimport { ExprManager } from \"./ExprManager.js\";\nimport { LogicalValue } from \"../value/LogicalValue\";\nimport { LogicalLiteralExpr } from \"../expression/boolean/LogicalLiteralExpr\";\n\nexport class ExprCompiler extends IfcExpressionVisitor<Expr<any>> {\n private readonly methodCallTargetStack = [];\n private readonly typeManager: TypeManager;\n private readonly exprManager: ExprManager;\n\n constructor(typeManager: TypeManager) {\n super();\n this.typeManager = typeManager;\n this.exprManager = new ExprManager();\n }\n\n public getExprManager(): ExprManager {\n return this.exprManager;\n }\n\n visitExpr: (ctx: ExprContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.singleExpr());\n };\n\n /*================================================\n * VariableRef\n *==============================================*/\n\n private associateContextAndReturn(expr: Expr<any>, ctx: ParserRuleContext) {\n this.exprManager.registerExprWithContext(expr, ctx);\n return expr;\n }\n\n visitVariableRef: (ctx: VariableRefContext) => Expr<any> = (ctx) => {\n if (ctx.IDENTIFIER().getText().toUpperCase() === \"PROPERTY\") {\n return this.associateContextAndReturn(new PropObjectReferenceExpr(), ctx);\n } else if (ctx.IDENTIFIER().getText().toUpperCase() === \"ELEMENT\") {\n return this.associateContextAndReturn(new ElemObjectReferenceExpr(), ctx);\n }\n throw new Error(`Parsing error: No variable '${ctx.getText()}' found `);\n };\n\n visitSEComparison: (ctx: SEComparisonContext) => Expr<any> = (ctx) => {\n const left = this.visit(ctx.singleExpr(0));\n const right = this.visit(ctx.singleExpr(1));\n switch (ctx.CMP_OP().getText()) {\n case \"==\":\n return this.associateContextAndReturn(new EqualsExpr(left, right), ctx);\n case \"!=\":\n return this.associateContextAndReturn(\n new NotEqualsExpr(left, right),\n ctx\n );\n case \">\":\n return this.associateContextAndReturn(\n new GreaterThan(left, right),\n ctx\n );\n case \">=\":\n return this.associateContextAndReturn(\n new GreaterThanOrEqual(left, right),\n ctx\n );\n case \"<\":\n return this.associateContextAndReturn(new LessThan(left, right), ctx);\n case \"<=\":\n return this.associateContextAndReturn(\n new LessThanOrEqual(left, right),\n ctx\n );\n }\n throw new Error(\n `Parsing error: comparison operator '${ctx\n .CMP_OP()\n .getText()}' not supported`\n );\n };\n\n visitSEMethodCall: (ctx: SEMethodCallContext) => Expr<any> = (ctx) => {\n this.methodCallTargetStack.push(this.visit(ctx.singleExpr()));\n return this.visit(ctx.methodCallChain());\n };\n\n visitSELiteral: (ctx: SELiteralContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.literal());\n };\n\n visitSEVariableRef: (ctx: SEVariableRefContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.variableRef());\n };\n visitSEArrayExpr: (ctx: SEArrayExprContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.arrayExpr());\n };\n visitSEFunctionCall: (ctx: SEFunctionCallContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.functionCall());\n };\n visitSEParenthesis: (ctx: SEParenthesisContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new ParenthesisExpr(this.visit(ctx._sub)),\n ctx\n );\n };\n\n /*================================================\n * MethodCallChain\n *==============================================*/\n\n visitMethodCallChainInner: (ctx: MethodCallChainInnerContext) => Expr<any> = (\n ctx\n ) => {\n const functionExpr = new FunctionExpr(\n ctx.functionCall().IDENTIFIER().getText(),\n this.collectFunctionArguments(ctx.functionCall().exprList(), [\n this.methodCallTargetStack.pop(),\n ])\n );\n this.associateContextAndReturn(functionExpr, ctx.functionCall());\n this.methodCallTargetStack.push(functionExpr);\n return this.visit(ctx.methodCallChain());\n };\n\n visitMethodCallChainEnd: (ctx: MethodCallChainEndContext) => Expr<any> = (\n ctx\n ) => {\n return this.associateContextAndReturn(\n new FunctionExpr(\n ctx.functionCall().IDENTIFIER().getText(),\n this.collectFunctionArguments(ctx.functionCall().exprList(), [\n this.methodCallTargetStack.pop(),\n ])\n ),\n ctx.functionCall()\n );\n };\n\n visitSEAddSub: (ctx: SEAddSubContext) => Expr<any> = (ctx) => {\n this.typeManager.requireTypesOverlap(ctx._left, ctx._right);\n switch (ctx._op.text) {\n case \"+\":\n return this.makePlusExpr(ctx);\n case \"-\":\n return this.associateContextAndReturn(\n new MinusExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n default:\n ExprCompiler.failNode(ctx);\n }\n };\n\n private makePlusExpr(ctx: SEAddSubContext) {\n if (this.typeManager.isNumeric(ctx._left, ctx._right)) {\n return this.associateContextAndReturn(\n new PlusExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n }\n if (this.typeManager.isString(ctx._left, ctx._right)) {\n return this.associateContextAndReturn(\n new StringConcatExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n }\n if (\n this.typeManager.overlapsWithString(ctx._left, ctx._right) ||\n this.typeManager.overlapsWithNumeric(ctx._left, ctx._right)\n ) {\n return this.associateContextAndReturn(\n new PlusOrConcatExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n }\n throw new ExpressionTypeError(\n \"Operator '+' requires the operands to be either both of type numeric or both of type string, but they are not.\",\n ctx\n );\n }\n\n visitSEMulDiv: (ctx: SEMulDivContext) => Expr<any> = (ctx) => {\n switch (ctx._op.text) {\n case \"*\":\n return this.associateContextAndReturn(\n new MultiplyExpr(\n this.visit(ctx.getChild(0)),\n this.visit(ctx.getChild(2))\n ),\n ctx\n );\n case \"/\":\n return this.associateContextAndReturn(\n new DivideExpr(\n this.visit(ctx.getChild(0)),\n this.visit(ctx.getChild(2))\n ),\n ctx\n );\n default:\n ExprCompiler.failNode(ctx);\n }\n };\n\n /*================================================\n * StringExpr\n *===============================================*/\n\n visitStringLiteral: (ctx: StringLiteralContext) => Expr<any> = (ctx) => {\n const quotedString = ctx.QUOTED_STRING().getText();\n const text = quotedString.substring(1, quotedString.length - 1);\n return this.associateContextAndReturn(new StringLiteralExpr(text), ctx);\n };\n\n /*================================================\n * NumExpr\n *===============================================*/\n\n visitNumLiteral: (ctx: NumLiteralContext) => Expr<any> = (ctx) => {\n let val = ctx.INT();\n if (isPresent(val)) {\n return this.associateContextAndReturn(\n new NumericLiteralExpr(new Decimal(ctx.getText())),\n ctx\n );\n }\n val = ctx.FLOAT();\n if (isPresent(val)) {\n return this.associateContextAndReturn(\n new NumericLiteralExpr(new Decimal(ctx.getText())),\n ctx\n );\n }\n ExprCompiler.failNode(ctx);\n };\n\n visitSEUnaryMultipleMinus: (ctx: SEUnaryMultipleMinusContext) => Expr<any> = (\n ctx\n ) => {\n return this.visit(ctx.singleExpr());\n };\n visitSEPower: (ctx: SEPowerContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new PowerExpr(this.visit(ctx._left), this.visit(ctx._right)),\n ctx\n );\n };\n visitSEUnaryMinus: (ctx: SEUnaryMinusContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new UnaryMinusExpr(this.visit(ctx.singleExpr())),\n ctx\n );\n };\n\n /*================================================\n * BooleanExpr\n *===============================================*/\n\n visitSEBooleanBinaryOp: (ctx: SEBooleanBinaryOpContext) => Expr<any> = (\n ctx\n ) => {\n switch (ctx._op.text) {\n case \"&&\":\n return this.associateContextAndReturn(\n new AndExpr(\n this.visit(ctx.singleExpr(0)),\n this.visit(ctx.singleExpr(1))\n ),\n ctx\n );\n case \"||\":\n return this.associateContextAndReturn(\n new OrExpr(\n this.visit(ctx.singleExpr(0)),\n this.visit(ctx.singleExpr(1))\n ),\n ctx\n );\n case \"><\":\n return this.associateContextAndReturn(\n new XorExpr(\n this.visit(ctx.singleExpr(0)),\n this.visit(ctx.singleExpr(1))\n ),\n ctx\n );\n }\n throw new SyntaxErrorException(\n ctx._op.text,\n ctx._op.line,\n ctx._op.column,\n `Unknown boolean operator ${ctx._op.text}`\n );\n };\n\n visitBooleanLiteral: (ctx: BooleanLiteralContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new BooleanLiteralExpr(ctx.BOOLEAN().getText().toUpperCase() === \"TRUE\"),\n ctx\n );\n };\n\n visitLogicalLiteral: (ctx: LogicalLiteralContext) => Expr<any> = (ctx) => {\n // the only literal we recognize is 'UNKNOWN' (true and false are boolean literals)\n return this.associateContextAndReturn(\n new LogicalLiteralExpr(LogicalValue.UNKNOWN_VALUE),\n ctx\n );\n };\n\n visitSENot: (ctx: SENotContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new NotExpr(this.visit(ctx.singleExpr())),\n ctx\n );\n };\n\n /*================================================\n * ArrayExpr\n *===============================================*/\n\n visitArrayExpr: (ctx: ArrayExprContext) => Expr<any> = (ctx) => {\n return this.associateContextAndReturn(\n new ArrayExpr(this.collectArrayElements(ctx.arrayElementList())),\n ctx\n );\n };\n\n collectArrayElements: (ctx: ArrayElementListContext) => Array<Expr<any>> = (\n ctx\n ) => {\n if (!isNullish(ctx)) {\n const first = this.visit(ctx.singleExpr());\n const rest = ctx.arrayElementList();\n if (!isNullish(rest)) {\n const arr = this.collectArrayElements(rest);\n arr.unshift(first);\n return arr;\n }\n return [first];\n }\n return [];\n };\n\n /*================================================\n * FuncExpr\n *===============================================*/\n\n visitFunctionCall: (ctx: FunctionCallContext) => Expr<any> = (ctx) => {\n const args = isNullish(ctx.exprList())\n ? []\n : this.collectFunctionArguments(ctx.exprList());\n return this.associateContextAndReturn(\n new FunctionExpr(ctx.IDENTIFIER().getText(), args),\n ctx\n );\n };\n\n collectFunctionArguments: (\n ctx: ExprListContext,\n resultSoFar?: Array<Expr<any>>\n ) => Array<Expr<any>> = (ctx, resultSoFar?: Array<Expr<any>>) => {\n if (isNullish(resultSoFar)) {\n resultSoFar = [];\n }\n if (!isNullish(ctx)) {\n resultSoFar.push(this.visit(ctx.singleExpr()));\n const rest = ctx.exprList();\n if (!isNullish(rest)) {\n return this.collectFunctionArguments(rest, resultSoFar);\n }\n }\n return resultSoFar;\n };\n\n private static failNode(ctx: ParserRuleContext) {\n throw new Error(`Cannot parse (sub)expression ${ctx.getText()}`);\n }\n\n visitLiteral: (ctx: LiteralContext) => Expr<any> = (ctx) => {\n return this.visit(ctx.getChild(0));\n };\n}\n"]}
|
|
@@ -27,8 +27,8 @@ class IfcExpressionValidationListener extends IfcExpressionListener_js_1.default
|
|
|
27
27
|
throw new InvalidSyntaxException_js_1.InvalidSyntaxException("--", ctx);
|
|
28
28
|
};
|
|
29
29
|
this.exitSEBooleanBinaryOp = (ctx) => {
|
|
30
|
-
this.typeManager.
|
|
31
|
-
this.typeManager.
|
|
30
|
+
this.typeManager.requireLogicalOrBoolean(ctx._left);
|
|
31
|
+
this.typeManager.requireLogicalOrBoolean(ctx._right);
|
|
32
32
|
this.typeManager.setType(ctx, Types_js_1.Types.boolean());
|
|
33
33
|
};
|
|
34
34
|
this.exitSEComparison = (ctx) => {
|
|
@@ -53,6 +53,9 @@ class IfcExpressionValidationListener extends IfcExpressionListener_js_1.default
|
|
|
53
53
|
this.exitBooleanLiteral = (ctx) => {
|
|
54
54
|
this.typeManager.setType(ctx, Types_js_1.Types.boolean());
|
|
55
55
|
};
|
|
56
|
+
this.exitLogicalLiteral = (ctx) => {
|
|
57
|
+
this.typeManager.setType(ctx, Types_js_1.Types.logical());
|
|
58
|
+
};
|
|
56
59
|
this.exitExpr = (ctx) => {
|
|
57
60
|
this.typeManager.copyTypeFrom(ctx, ctx.singleExpr());
|
|
58
61
|
};
|
|
@@ -73,7 +76,7 @@ class IfcExpressionValidationListener extends IfcExpressionListener_js_1.default
|
|
|
73
76
|
this.typeManager.copyTypeFrom(ctx, ctx._sub);
|
|
74
77
|
};
|
|
75
78
|
this.exitSENot = (ctx) => {
|
|
76
|
-
this.typeManager.
|
|
79
|
+
this.typeManager.requireLogicalOrBoolean(ctx._sub);
|
|
77
80
|
this.typeManager.setType(ctx, Types_js_1.Types.boolean());
|
|
78
81
|
};
|
|
79
82
|
this.exitSEVariableRef = (ctx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/compiler/IfcExpressionValidationListener.ts"],"names":[],"mappings":";;;;;;AAAA,sGAA2E;AAC3E,iFA2B8C;AAC9C,gGAA0F;AAC1F,oFAA8E;AAC9E,kFAA4E;AAC5E,+CAA+C;AAE/C,qDAA+C;AAC/C,4EAAsE;AACtE,yEAA0D;AAC1D,4EAAsE;AAGtE,MAAa,+BAAgC,SAAQ,kCAAqB;IAGxE;QACE,KAAK,EAAE,CAAC;QAFF,0BAAqB,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I,CAAC,gBAAgB,EAAE,eAAI,CAAC,eAAe,CAAC,CACtD,CAAC;QACJ,CAAC,CAAC;QA1NA,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAW,EAAE,CAAC;IACvC,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAgIO,oBAAoB,CAAC,GAAsB;QACjD,IAAI,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE;YAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;YACtE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;SACpD;aAAM;YACL,MAAM,IAAI,4CAAmB,CAC3B,yEAAyE,EACzE,GAAG,CACJ,CAAC;SACH;IACH,CAAC;CA4EF;AAhOD,0EAgOC","file":"compiler/IfcExpressionValidationListener.js","sourcesContent":["import IfcExpressionListener from \"../gen/parser/IfcExpressionListener.js\";\nimport {\n ArrayElementListContext,\n ArrayExprContext,\n BooleanLiteralContext,\n ExprContext,\n ExprListContext,\n FunctionCallContext,\n LiteralContext,\n MethodCallChainEndContext,\n MethodCallChainInnerContext,\n NumLiteralContext,\n SEAddSubContext,\n SEArrayExprContext,\n SEBooleanBinaryOpContext,\n SEComparisonContext,\n SEFunctionCallContext,\n SELiteralContext,\n SEMethodCallContext,\n SEMulDivContext,\n SENotContext,\n SEParenthesisContext,\n SEPowerContext,\n SEUnaryMinusContext,\n SEUnaryMultipleMinusContext,\n SEVariableRefContext,\n StringLiteralContext,\n VariableRefContext,\n} from \"../gen/parser/IfcExpressionParser.js\";\nimport { IfcExpressionFunctions } from \"../expression/function/IfcExpressionFunctions.js\";\nimport { NoSuchFunctionException } from \"../error/NoSuchFunctionException.js\";\nimport { InvalidSyntaxException } from \"../error/InvalidSyntaxException.js\";\nimport { Type, Types } from \"../type/Types.js\";\nimport { ParserRuleContext } from \"antlr4\";\nimport { TypeManager } from \"./TypeManager.js\";\nimport { ExpressionTypeError } from \"../error/ExpressionTypeError.js\";\nimport { isNullish } from \"../util/IfcExpressionUtils.js\";\nimport { ValidationException } from \"../error/ValidationException.js\";\nimport { ExprType } from \"../type/ExprType.js\";\n\nexport class IfcExpressionValidationListener extends IfcExpressionListener {\n private readonly typeManager: TypeManager;\n private methodCallTargetStack = [];\n constructor() {\n super();\n this.typeManager = new TypeManager();\n }\n\n public getTypeManager(): TypeManager {\n return this.typeManager;\n }\n\n enterFunctionCall: (ctx: FunctionCallContext) => void = (ctx) => {\n if (!IfcExpressionFunctions.isBuiltinFunction(ctx.IDENTIFIER().getText())) {\n throw new NoSuchFunctionException(ctx.IDENTIFIER().getText(), ctx);\n }\n };\n\n enterSEUnaryMultipleMinus: (ctx: SEUnaryMultipleMinusContext) => void = (\n ctx\n ) => {\n throw new InvalidSyntaxException(\"--\", ctx);\n };\n\n exitSEBooleanBinaryOp: (ctx: SEBooleanBinaryOpContext) => void = (ctx) => {\n this.typeManager.requireBoolean(ctx._left);\n this.typeManager.requireBoolean(ctx._right);\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitSEComparison: (ctx: SEComparisonContext) => void = (ctx) => {\n this.typeManager.requireTypesOverlap(ctx._left, ctx._right);\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitSEParenthesis: (ctx: SEParenthesisContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n\n exitSELiteral: (ctx: SELiteralContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n exitLiteral: (ctx: LiteralContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx.getChild(0) as ParserRuleContext);\n };\n exitNumLiteral: (ctx: NumLiteralContext) => void = (ctx) => {\n this.typeManager.setType(ctx, Types.numeric());\n };\n exitStringLiteral: (ctx: StringLiteralContext) => void = (ctx) => {\n this.typeManager.setType(ctx, Types.string());\n };\n\n exitBooleanLiteral: (ctx: BooleanLiteralContext) => void = (ctx) => {\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitExpr: (ctx: ExprContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx.singleExpr());\n };\n\n exitSEMulDiv: (ctx: SEMulDivContext) => void = (ctx) => {\n this.typeManager.requireNumeric(ctx._left);\n this.typeManager.requireNumeric(ctx._right);\n this.typeManager.setType(ctx, Types.numeric());\n };\n\n exitSEPower: (ctx: SEPowerContext) => void = (ctx) => {\n this.typeManager.requireNumeric(ctx._left);\n this.typeManager.requireNumeric(ctx._right);\n this.typeManager.setType(ctx, Types.numeric());\n };\n exitSEFunctionCall: (ctx: SEFunctionCallContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n exitSEArrayExpr: (ctx: SEArrayExprContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n\n exitSENot: (ctx: SENotContext) => void = (ctx) => {\n this.typeManager.requireBoolean(ctx._sub);\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitSEVariableRef: (ctx: SEVariableRefContext) => void = (ctx) => {\n switch (ctx._sub.IDENTIFIER().getText()) {\n case \"property\":\n this.typeManager.setType(ctx, Type.IFC_PROPERTY_REF);\n return;\n case \"element\":\n this.typeManager.setType(ctx, Type.IFC_ELEMENT_REF);\n return;\n }\n throw new ValidationException(\n `Encountered Variable ref that was neither $property nor $element`,\n ctx\n );\n };\n\n exitSEUnaryMinus: (ctx: SEUnaryMinusContext) => void = (ctx) => {\n this.typeManager.requireNumeric(ctx._sub);\n this.typeManager.setType(ctx, Types.numeric());\n };\n exitSEAddSub: (ctx: SEAddSubContext) => void = (ctx) => {\n if (this.typeManager.overlapsWithString(ctx._left, ctx._right)) {\n this.typeManager.setType(ctx, Types.string());\n } else if (this.typeManager.overlapsWithNumeric(ctx._left, ctx._right)) {\n this.typeManager.setType(ctx, Types.numeric());\n } else {\n throw new ExpressionTypeError(\n `Operator '+' does not allow provided operand types ${this.typeManager\n .getType(ctx._left)\n .getName()}(left operand) and ${this.typeManager\n .getType(ctx._right)\n .getName()}(right operand). Operands must be both string or both numeric.`,\n ctx\n );\n }\n };\n\n exitSEMethodCall: (ctx: SEMethodCallContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._call);\n };\n\n enterMethodCallChainInner: (ctx: MethodCallChainInnerContext) => void = (\n ctx\n ) => {\n this.pushMethodCallTarget(ctx);\n };\n exitMethodCallChainInner: (ctx: MethodCallChainInnerContext) => void = (\n ctx\n ) => {\n this.typeManager.copyTypeFrom(ctx, ctx._call);\n };\n\n enterMethodCallChainEnd: (ctx: MethodCallChainEndContext) => void = (ctx) => {\n this.pushMethodCallTarget(ctx);\n };\n\n private pushMethodCallTarget(ctx: ParserRuleContext) {\n if (ctx.parentCtx[\"_target\"]) {\n const targetType = this.typeManager.getType(ctx.parentCtx[\"_target\"]);\n this.methodCallTargetStack.push([ctx, targetType]);\n } else {\n throw new ValidationException(\n \"Did not find expected context attribute 'target' in parent rule context\",\n ctx\n );\n }\n }\n\n exitMethodCallChainEnd: (ctx: MethodCallChainEndContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx.functionCall());\n };\n exitFunctionCall: (ctx: FunctionCallContext) => void = (ctx) => {\n const func = IfcExpressionFunctions.getFunction(ctx.IDENTIFIER().getText());\n const argumentTypes = this.collectArgumentTypes(ctx.exprList());\n const parent = ctx.parentCtx;\n if (\n parent instanceof MethodCallChainInnerContext ||\n parent instanceof MethodCallChainEndContext ||\n parent instanceof SEMethodCallContext\n ) {\n argumentTypes.unshift(this.methodCallTargetStack.pop());\n }\n const returnType = func.checkArgumentsAndGetReturnType(argumentTypes, ctx);\n this.typeManager.setType(ctx, returnType);\n };\n\n private collectArgumentTypes: (\n ctx: ExprListContext,\n resultSoFar?: Array<[ParserRuleContext, ExprType]>\n ) => Array<[ParserRuleContext, ExprType]> = (\n ctx,\n resultSoFar?: Array<[ParserRuleContext, ExprType]>\n ) => {\n if (isNullish(resultSoFar)) {\n resultSoFar = [];\n }\n if (!isNullish(ctx)) {\n resultSoFar.push([\n ctx.singleExpr(),\n this.typeManager.getType(ctx.singleExpr()),\n ]);\n const rest = ctx.exprList();\n if (!isNullish(rest)) {\n return this.collectArgumentTypes(rest, resultSoFar);\n }\n }\n return resultSoFar;\n };\n\n exitExprList: (ctx: ExprListContext) => void;\n\n exitArrayExpr: (ctx: ArrayExprContext) => void = (ctx) => {\n this.typeManager.setType(\n ctx,\n Types.tuple(...this.collectArrayElementTypes(ctx.arrayElementList()))\n );\n };\n\n private collectArrayElementTypes: (\n ctx: ArrayElementListContext,\n resultSoFar?: Array<ExprType>\n ) => Array<ExprType> = (ctx, resultSoFar?: Array<ExprType>) => {\n if (isNullish(resultSoFar)) {\n resultSoFar = [];\n }\n if (!isNullish(ctx)) {\n resultSoFar.push(this.typeManager.getType(ctx.singleExpr()));\n const rest = ctx.arrayElementList();\n if (!isNullish(rest)) {\n return this.collectArrayElementTypes(rest, resultSoFar);\n }\n }\n return resultSoFar;\n };\n\n exitArrayElementList: (ctx: ArrayElementListContext) => void;\n exitVariableRef: (ctx: VariableRefContext) => void = (ctx) => {\n this.typeManager.setType(\n ctx,\n Types.or(Type.IFC_PROPERTY_REF, Type.IFC_ELEMENT_REF)\n );\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/compiler/IfcExpressionValidationListener.ts"],"names":[],"mappings":";;;;;;AAAA,sGAA2E;AAC3E,iFA4B8C;AAC9C,gGAA0F;AAC1F,oFAA8E;AAC9E,kFAA4E;AAC5E,+CAA+C;AAE/C,qDAA+C;AAC/C,4EAAsE;AACtE,yEAA0D;AAC1D,4EAAsE;AAGtE,MAAa,+BAAgC,SAAQ,kCAAqB;IAGxE;QACE,KAAK,EAAE,CAAC;QAFF,0BAAqB,GAAG,EAAE,CAAC;QAUnC,sBAAiB,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AGF,oBAAe,GAAsC,CAAC,GAAG,EAAE,EAAE;YAC3D,IAAI,CAAC,WAAW,CAAC,OAAO,CACtB,GAAG,EACH,gBAAK,CAAC,EAAE,CAAC,eAAI,CAAC,gBAAgB,EAAE,eAAI,CAAC,eAAe,CAAC,CACtD,CAAC;QACJ,CAAC,CAAC;QA/NA,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAW,EAAE,CAAC;IACvC,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAoIO,oBAAoB,CAAC,GAAsB;QACjD,IAAI,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE;YAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;YACtE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;SACpD;aAAM;YACL,MAAM,IAAI,4CAAmB,CAC3B,yEAAyE,EACzE,GAAG,CACJ,CAAC;SACH;IACH,CAAC;CA6EF;AArOD,0EAqOC","file":"compiler/IfcExpressionValidationListener.js","sourcesContent":["import IfcExpressionListener from \"../gen/parser/IfcExpressionListener.js\";\nimport {\n ArrayElementListContext,\n ArrayExprContext,\n BooleanLiteralContext,\n ExprContext,\n ExprListContext,\n FunctionCallContext,\n LiteralContext,\n LogicalLiteralContext,\n MethodCallChainEndContext,\n MethodCallChainInnerContext,\n NumLiteralContext,\n SEAddSubContext,\n SEArrayExprContext,\n SEBooleanBinaryOpContext,\n SEComparisonContext,\n SEFunctionCallContext,\n SELiteralContext,\n SEMethodCallContext,\n SEMulDivContext,\n SENotContext,\n SEParenthesisContext,\n SEPowerContext,\n SEUnaryMinusContext,\n SEUnaryMultipleMinusContext,\n SEVariableRefContext,\n StringLiteralContext,\n VariableRefContext,\n} from \"../gen/parser/IfcExpressionParser.js\";\nimport { IfcExpressionFunctions } from \"../expression/function/IfcExpressionFunctions.js\";\nimport { NoSuchFunctionException } from \"../error/NoSuchFunctionException.js\";\nimport { InvalidSyntaxException } from \"../error/InvalidSyntaxException.js\";\nimport { Type, Types } from \"../type/Types.js\";\nimport { ParserRuleContext } from \"antlr4\";\nimport { TypeManager } from \"./TypeManager.js\";\nimport { ExpressionTypeError } from \"../error/ExpressionTypeError.js\";\nimport { isNullish } from \"../util/IfcExpressionUtils.js\";\nimport { ValidationException } from \"../error/ValidationException.js\";\nimport { ExprType } from \"../type/ExprType.js\";\n\nexport class IfcExpressionValidationListener extends IfcExpressionListener {\n private readonly typeManager: TypeManager;\n private methodCallTargetStack = [];\n constructor() {\n super();\n this.typeManager = new TypeManager();\n }\n\n public getTypeManager(): TypeManager {\n return this.typeManager;\n }\n\n enterFunctionCall: (ctx: FunctionCallContext) => void = (ctx) => {\n if (!IfcExpressionFunctions.isBuiltinFunction(ctx.IDENTIFIER().getText())) {\n throw new NoSuchFunctionException(ctx.IDENTIFIER().getText(), ctx);\n }\n };\n\n enterSEUnaryMultipleMinus: (ctx: SEUnaryMultipleMinusContext) => void = (\n ctx\n ) => {\n throw new InvalidSyntaxException(\"--\", ctx);\n };\n\n exitSEBooleanBinaryOp: (ctx: SEBooleanBinaryOpContext) => void = (ctx) => {\n this.typeManager.requireLogicalOrBoolean(ctx._left);\n this.typeManager.requireLogicalOrBoolean(ctx._right);\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitSEComparison: (ctx: SEComparisonContext) => void = (ctx) => {\n this.typeManager.requireTypesOverlap(ctx._left, ctx._right);\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitSEParenthesis: (ctx: SEParenthesisContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n\n exitSELiteral: (ctx: SELiteralContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n exitLiteral: (ctx: LiteralContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx.getChild(0) as ParserRuleContext);\n };\n exitNumLiteral: (ctx: NumLiteralContext) => void = (ctx) => {\n this.typeManager.setType(ctx, Types.numeric());\n };\n exitStringLiteral: (ctx: StringLiteralContext) => void = (ctx) => {\n this.typeManager.setType(ctx, Types.string());\n };\n\n exitBooleanLiteral: (ctx: BooleanLiteralContext) => void = (ctx) => {\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitLogicalLiteral: (ctx: LogicalLiteralContext) => void = (ctx) => {\n this.typeManager.setType(ctx, Types.logical());\n };\n\n exitExpr: (ctx: ExprContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx.singleExpr());\n };\n\n exitSEMulDiv: (ctx: SEMulDivContext) => void = (ctx) => {\n this.typeManager.requireNumeric(ctx._left);\n this.typeManager.requireNumeric(ctx._right);\n this.typeManager.setType(ctx, Types.numeric());\n };\n\n exitSEPower: (ctx: SEPowerContext) => void = (ctx) => {\n this.typeManager.requireNumeric(ctx._left);\n this.typeManager.requireNumeric(ctx._right);\n this.typeManager.setType(ctx, Types.numeric());\n };\n exitSEFunctionCall: (ctx: SEFunctionCallContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n exitSEArrayExpr: (ctx: SEArrayExprContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._sub);\n };\n\n exitSENot: (ctx: SENotContext) => void = (ctx) => {\n this.typeManager.requireLogicalOrBoolean(ctx._sub);\n this.typeManager.setType(ctx, Types.boolean());\n };\n\n exitSEVariableRef: (ctx: SEVariableRefContext) => void = (ctx) => {\n switch (ctx._sub.IDENTIFIER().getText()) {\n case \"property\":\n this.typeManager.setType(ctx, Type.IFC_PROPERTY_REF);\n return;\n case \"element\":\n this.typeManager.setType(ctx, Type.IFC_ELEMENT_REF);\n return;\n }\n throw new ValidationException(\n `Encountered Variable ref that was neither $property nor $element`,\n ctx\n );\n };\n\n exitSEUnaryMinus: (ctx: SEUnaryMinusContext) => void = (ctx) => {\n this.typeManager.requireNumeric(ctx._sub);\n this.typeManager.setType(ctx, Types.numeric());\n };\n exitSEAddSub: (ctx: SEAddSubContext) => void = (ctx) => {\n if (this.typeManager.overlapsWithString(ctx._left, ctx._right)) {\n this.typeManager.setType(ctx, Types.string());\n } else if (this.typeManager.overlapsWithNumeric(ctx._left, ctx._right)) {\n this.typeManager.setType(ctx, Types.numeric());\n } else {\n throw new ExpressionTypeError(\n `Operator '+' does not allow provided operand types ${this.typeManager\n .getType(ctx._left)\n .getName()}(left operand) and ${this.typeManager\n .getType(ctx._right)\n .getName()}(right operand). Operands must be both string or both numeric.`,\n ctx\n );\n }\n };\n\n exitSEMethodCall: (ctx: SEMethodCallContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx._call);\n };\n\n enterMethodCallChainInner: (ctx: MethodCallChainInnerContext) => void = (\n ctx\n ) => {\n this.pushMethodCallTarget(ctx);\n };\n exitMethodCallChainInner: (ctx: MethodCallChainInnerContext) => void = (\n ctx\n ) => {\n this.typeManager.copyTypeFrom(ctx, ctx._call);\n };\n\n enterMethodCallChainEnd: (ctx: MethodCallChainEndContext) => void = (ctx) => {\n this.pushMethodCallTarget(ctx);\n };\n\n private pushMethodCallTarget(ctx: ParserRuleContext) {\n if (ctx.parentCtx[\"_target\"]) {\n const targetType = this.typeManager.getType(ctx.parentCtx[\"_target\"]);\n this.methodCallTargetStack.push([ctx, targetType]);\n } else {\n throw new ValidationException(\n \"Did not find expected context attribute 'target' in parent rule context\",\n ctx\n );\n }\n }\n\n exitMethodCallChainEnd: (ctx: MethodCallChainEndContext) => void = (ctx) => {\n this.typeManager.copyTypeFrom(ctx, ctx.functionCall());\n };\n\n exitFunctionCall: (ctx: FunctionCallContext) => void = (ctx) => {\n const func = IfcExpressionFunctions.getFunction(ctx.IDENTIFIER().getText());\n const argumentTypes = this.collectArgumentTypes(ctx.exprList());\n const parent = ctx.parentCtx;\n if (\n parent instanceof MethodCallChainInnerContext ||\n parent instanceof MethodCallChainEndContext ||\n parent instanceof SEMethodCallContext\n ) {\n argumentTypes.unshift(this.methodCallTargetStack.pop());\n }\n const returnType = func.checkArgumentsAndGetReturnType(argumentTypes, ctx);\n this.typeManager.setType(ctx, returnType);\n };\n\n private collectArgumentTypes: (\n ctx: ExprListContext,\n resultSoFar?: Array<[ParserRuleContext, ExprType]>\n ) => Array<[ParserRuleContext, ExprType]> = (\n ctx,\n resultSoFar?: Array<[ParserRuleContext, ExprType]>\n ) => {\n if (isNullish(resultSoFar)) {\n resultSoFar = [];\n }\n if (!isNullish(ctx)) {\n resultSoFar.push([\n ctx.singleExpr(),\n this.typeManager.getType(ctx.singleExpr()),\n ]);\n const rest = ctx.exprList();\n if (!isNullish(rest)) {\n return this.collectArgumentTypes(rest, resultSoFar);\n }\n }\n return resultSoFar;\n };\n\n exitExprList: (ctx: ExprListContext) => void;\n\n exitArrayExpr: (ctx: ArrayExprContext) => void = (ctx) => {\n this.typeManager.setType(\n ctx,\n Types.tuple(...this.collectArrayElementTypes(ctx.arrayElementList()))\n );\n };\n\n private collectArrayElementTypes: (\n ctx: ArrayElementListContext,\n resultSoFar?: Array<ExprType>\n ) => Array<ExprType> = (ctx, resultSoFar?: Array<ExprType>) => {\n if (isNullish(resultSoFar)) {\n resultSoFar = [];\n }\n if (!isNullish(ctx)) {\n resultSoFar.push(this.typeManager.getType(ctx.singleExpr()));\n const rest = ctx.arrayElementList();\n if (!isNullish(rest)) {\n return this.collectArrayElementTypes(rest, resultSoFar);\n }\n }\n return resultSoFar;\n };\n\n exitArrayElementList: (ctx: ArrayElementListContext) => void;\n exitVariableRef: (ctx: VariableRefContext) => void = (ctx) => {\n this.typeManager.setType(\n ctx,\n Types.or(Type.IFC_PROPERTY_REF, Type.IFC_ELEMENT_REF)\n );\n };\n}\n"]}
|
|
@@ -25,6 +25,14 @@ class TypeManager {
|
|
|
25
25
|
const actualType = this.types.get(ctx);
|
|
26
26
|
Types_js_1.Types.requireWeakIsAssignableFrom(Types_js_1.Type.BOOLEAN, this.types.get(ctx), () => new ExpressionTypeError_js_1.ExpressionTypeError(`expected type boolean, actual type is ${actualType.getName()}`, ctx));
|
|
27
27
|
}
|
|
28
|
+
requireLogicalOrBoolean(ctx) {
|
|
29
|
+
return this.requireOneOf(ctx, Types_js_1.Type.BOOLEAN, Types_js_1.Type.LOGICAL);
|
|
30
|
+
}
|
|
31
|
+
requireOneOf(ctx, ...types) {
|
|
32
|
+
const requiredType = Types_js_1.Types.or(...types);
|
|
33
|
+
const actualType = this.types.get(ctx);
|
|
34
|
+
Types_js_1.Types.requireWeakIsAssignableFrom(requiredType, this.types.get(ctx), () => new ExpressionTypeError_js_1.ExpressionTypeError(`expected type ${requiredType}, actual type is ${actualType.getName()}`, ctx));
|
|
35
|
+
}
|
|
28
36
|
requireNumeric(ctx) {
|
|
29
37
|
const actualType = this.types.get(ctx);
|
|
30
38
|
Types_js_1.Types.requireWeakIsAssignableFrom(Types_js_1.Type.NUMERIC, actualType, () => new ExpressionTypeError_js_1.ExpressionTypeError(`expected type numeric, actual type is ${actualType.getName()}`, ctx));
|
|
@@ -49,9 +57,15 @@ class TypeManager {
|
|
|
49
57
|
isBoolean(...ctxs) {
|
|
50
58
|
return this.isType(Types_js_1.Type.BOOLEAN, ...ctxs);
|
|
51
59
|
}
|
|
60
|
+
isLogical(...ctxs) {
|
|
61
|
+
return this.isType(Types_js_1.Type.LOGICAL, ...ctxs);
|
|
62
|
+
}
|
|
52
63
|
overlapsWithBoolean(...ctxs) {
|
|
53
64
|
return this.overlapsWith(Types_js_1.Type.BOOLEAN, ...ctxs);
|
|
54
65
|
}
|
|
66
|
+
overlapsWithLogical(...ctxs) {
|
|
67
|
+
return this.overlapsWith(Types_js_1.Type.LOGICAL, ...ctxs);
|
|
68
|
+
}
|
|
55
69
|
isNumeric(...ctxs) {
|
|
56
70
|
return this.isType(Types_js_1.Type.NUMERIC, ...ctxs);
|
|
57
71
|
}
|
|
@@ -1 +1 @@
|
|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AAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;IAEM,QAAQ,CAAC,GAAG,IAAI;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC;IAEM,kBAAkB,CAAC,GAAG,IAAI;QAC/B,OAAO,IAAI,CAAC,YAAY,CAAC,eAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,SAAS,CAAC,GAAG,IAAI;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS,CAAC,GAAG,IAAI;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;IAEM,mBAAmB,CAAC,GAAG,IAAI;QAChC,OAAO,IAAI,CAAC,YAAY,CAAC,eAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,mBAAmB,CAAC,GAAG,IAAI;QAChC,OAAO,IAAI,CAAC,YAAY,CAAC,eAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,SAAS,CAAC,GAAG,IAAI;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;IAEM,mBAAmB,CAAC,GAAG,IAAI;QAChC,OAAO,IAAI,CAAC,YAAY,CAAC,eAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAClD,CAAC;CACF;AAhID,kCAgIC","file":"compiler/TypeManager.js","sourcesContent":["import { ParserRuleContext } from \"antlr4\";\nimport { Type, Types } from \"../type/Types.js\";\nimport { ExpressionTypeError } from \"../error/ExpressionTypeError.js\";\nimport { ExprType } from \"../type/ExprType.js\";\n\nexport class TypeManager {\n private readonly types = new Map<ParserRuleContext, ExprType>();\n\n constructor() {}\n\n public setType(parserRuleContext: ParserRuleContext, type: ExprType) {\n this.types.set(parserRuleContext, type);\n }\n\n public getType(parserRuleContext: ParserRuleContext): ExprType {\n return this.types.get(parserRuleContext);\n }\n\n public copyTypeFrom(ctx: ParserRuleContext, from: ParserRuleContext) {\n const theType = this.types.get(from as ParserRuleContext);\n this.types.set(ctx, theType);\n }\n\n public requireString(ctx: ParserRuleContext) {\n const actualType = this.types.get(ctx as ParserRuleContext);\n Types.requireWeakIsAssignableFrom(\n Type.STRING,\n this.types.get(ctx as ParserRuleContext),\n () =>\n new ExpressionTypeError(\n `expected type string, actual type is ${actualType.getName()}`,\n ctx\n )\n );\n }\n\n public requireBoolean(ctx: ParserRuleContext) {\n const actualType = this.types.get(ctx as ParserRuleContext);\n Types.requireWeakIsAssignableFrom(\n Type.BOOLEAN,\n this.types.get(ctx as ParserRuleContext),\n () =>\n new ExpressionTypeError(\n `expected type boolean, actual type is ${actualType.getName()}`,\n ctx\n )\n );\n }\n\n public requireLogicalOrBoolean(ctx: ParserRuleContext) {\n return this.requireOneOf(ctx, Type.BOOLEAN, Type.LOGICAL);\n }\n\n public requireOneOf(ctx: ParserRuleContext, ...types: Array<ExprType>) {\n const requiredType = Types.or(...types);\n const actualType = this.types.get(ctx as ParserRuleContext);\n Types.requireWeakIsAssignableFrom(\n requiredType,\n this.types.get(ctx as ParserRuleContext),\n () =>\n new ExpressionTypeError(\n `expected type ${requiredType}, actual type is ${actualType.getName()}`,\n ctx\n )\n );\n }\n\n public requireNumeric(ctx: ParserRuleContext) {\n const actualType = this.types.get(ctx as ParserRuleContext);\n Types.requireWeakIsAssignableFrom(\n Type.NUMERIC,\n actualType,\n () =>\n new ExpressionTypeError(\n `expected type numeric, actual type is ${actualType.getName()}`,\n ctx\n )\n );\n }\n\n public requireTypesOverlap(ctxA: ParserRuleContext, ctxB: ParserRuleContext) {\n Types.requireTypesOverlap(\n this.types.get(ctxA),\n this.types.get(ctxB),\n () =>\n new ExpressionTypeError(\n `Types ${this.types.get(ctxA).getName()} and ${this.types\n .get(ctxB)\n .getName()} are required to overlap but they don't.`,\n ctxA\n )\n );\n }\n\n public isType(type: ExprType, ...ctxs) {\n return ctxs.every((ctx) => Types.isType(this.types.get(ctx), type));\n }\n\n public overlapsWith(type: ExprType, ...ctxs) {\n return ctxs.every((ctx) => type.overlapsWith(this.types.get(ctx)));\n }\n\n public isString(...ctxs) {\n return this.isType(Type.STRING, ...ctxs);\n }\n\n public overlapsWithString(...ctxs) {\n return this.overlapsWith(Type.STRING, ...ctxs);\n }\n\n public isBoolean(...ctxs) {\n return this.isType(Type.BOOLEAN, ...ctxs);\n }\n\n public isLogical(...ctxs) {\n return this.isType(Type.LOGICAL, ...ctxs);\n }\n\n public overlapsWithBoolean(...ctxs) {\n return this.overlapsWith(Type.BOOLEAN, ...ctxs);\n }\n\n public overlapsWithLogical(...ctxs) {\n return this.overlapsWith(Type.LOGICAL, ...ctxs);\n }\n\n public isNumeric(...ctxs) {\n return this.isType(Type.NUMERIC, ...ctxs);\n }\n\n public overlapsWithNumeric(...ctxs) {\n return this.overlapsWith(Type.NUMERIC, ...ctxs);\n }\n}\n"]}
|
|
@@ -17,11 +17,14 @@ const WrongFunctionArgumentTypeExceptionMapper_js_1 = require("./mapper/WrongFun
|
|
|
17
17
|
const InvalidSyntaxException_js_1 = require("./InvalidSyntaxException.js");
|
|
18
18
|
const ValidationExceptionMapper_js_1 = require("./mapper/ValidationExceptionMapper.js");
|
|
19
19
|
const ValidationException_js_1 = require("./ValidationException.js");
|
|
20
|
+
const SpuriousFunctionArgumentExceptionMapper_js_1 = require("./mapper/SpuriousFunctionArgumentExceptionMapper.js");
|
|
21
|
+
const SpuriousFunctionArgumentException_js_1 = require("./SpuriousFunctionArgumentException.js");
|
|
20
22
|
const mappers = new Map();
|
|
21
23
|
mappers.set(SyntaxErrorException_js_1.SyntaxErrorException.name, new SyntaxErrorMapper_js_1.SyntaxErrorMapper());
|
|
22
24
|
mappers.set(ValidationException_js_1.ValidationException.name, new ValidationExceptionMapper_js_1.ValidationExceptionMapper());
|
|
23
25
|
mappers.set(ExpressionTypeError_js_1.ExpressionTypeError.name, mappers.get(ValidationException_js_1.ValidationException.name));
|
|
24
26
|
mappers.set(MissingFunctionArgumentException_js_1.MissingFunctionArgumentException.name, new MissingFunctionArgumentExceptionMapper_js_1.MissingFunctionArgumentExceptionMapper());
|
|
27
|
+
mappers.set(SpuriousFunctionArgumentException_js_1.SpuriousFunctionArgumentException.name, new SpuriousFunctionArgumentExceptionMapper_js_1.SpuriousFunctionArgumentExceptionMapper());
|
|
25
28
|
mappers.set(NoSuchFunctionException_js_1.NoSuchFunctionException.name, new NoSuchFunctionExceptionMapper_js_1.NoSuchFunctionExceptionMapper());
|
|
26
29
|
mappers.set(NoSuchMethodException_js_1.NoSuchMethodException.name, mappers.get(NoSuchFunctionException_js_1.NoSuchFunctionException.name));
|
|
27
30
|
mappers.set(WrongFunctionArgumentTypeException_js_1.WrongFunctionArgumentTypeException.name, new WrongFunctionArgumentTypeExceptionMapper_js_1.WrongFunctionArgumentTypeExceptionMapper());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/error/ExceptionToExprEvalErrorMapper.ts"],"names":[],"mappings":";;;AAAA,uEAIyC;AACzC,uEAAiE;AACjE,wEAAkE;AAClE,yEAA0D;AAC1D,2DAAqD;AACrD,kHAA4G;AAC5G,gGAA0F;AAC1F,qEAA+D;AAC/D,+FAAyF;AACzF,6EAAuE;AACvE,yEAAmE;AACnE,mGAA6F;AAC7F,sHAAgH;AAChH,2EAAqE;AACrE,wFAAkF;AAClF,qEAA+D;
|
|
1
|
+
{"version":3,"sources":["../../src/error/ExceptionToExprEvalErrorMapper.ts"],"names":[],"mappings":";;;AAAA,uEAIyC;AACzC,uEAAiE;AACjE,wEAAkE;AAClE,yEAA0D;AAC1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C,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,IAAA,iCAAS,EAAC,MAAM,CAAC,EAAE;QACrB,OAAO,IAAI,oCAAgB,CACzB,sBAAQ,CAAC,WAAW,EACpB,kCAAc,CAAC,KAAK,EACpB,CAAC,CAAC,OAAO,EACT,IAAI,CAAC,WAAW,EAAE,CACnB,CAAC;KACH;IACD,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAXD,oCAWC","file":"error/ExceptionToExprEvalErrorMapper.js","sourcesContent":["import {\n ExprEvalError,\n ExprEvalErrorObj,\n ExprEvalStatus,\n} from \"../expression/ExprEvalResult.js\";\nimport { SyntaxErrorException } from \"./SyntaxErrorException.js\";\nimport { SyntaxErrorMapper } from \"./mapper/SyntaxErrorMapper.js\";\nimport { isNullish } from \"../util/IfcExpressionUtils.js\";\nimport { ExprKind } from \"../expression/ExprKind.js\";\nimport { MissingFunctionArgumentExceptionMapper } from \"./mapper/MissingFunctionArgumentExceptionMapper.js\";\nimport { NoSuchFunctionExceptionMapper } from \"./mapper/NoSuchFunctionExceptionMapper.js\";\nimport { ExpressionTypeError } from \"./ExpressionTypeError.js\";\nimport { MissingFunctionArgumentException } from \"./MissingFunctionArgumentException.js\";\nimport { NoSuchFunctionException } from \"./NoSuchFunctionException.js\";\nimport { NoSuchMethodException } from \"./NoSuchMethodException.js\";\nimport { WrongFunctionArgumentTypeException } from \"./WrongFunctionArgumentTypeException.js\";\nimport { WrongFunctionArgumentTypeExceptionMapper } from \"./mapper/WrongFunctionArgumentTypeExceptionMapper.js\";\nimport { InvalidSyntaxException } from \"./InvalidSyntaxException.js\";\nimport { ValidationExceptionMapper } from \"./mapper/ValidationExceptionMapper.js\";\nimport { ValidationException } from \"./ValidationException.js\";\nimport { SpuriousFunctionArgumentExceptionMapper } from \"./mapper/SpuriousFunctionArgumentExceptionMapper\";\nimport { SpuriousFunctionArgumentException } from \"./SpuriousFunctionArgumentException\";\n\nexport interface ExceptionToExprEvalErrorMapper<T extends Error> {\n mapException(exception: T): ExprEvalError;\n}\n\nconst mappers = new Map<string, ExceptionToExprEvalErrorMapper<Error>>();\nmappers.set(SyntaxErrorException.name, new SyntaxErrorMapper());\nmappers.set(ValidationException.name, new ValidationExceptionMapper());\nmappers.set(ExpressionTypeError.name, mappers.get(ValidationException.name));\nmappers.set(\n MissingFunctionArgumentException.name,\n new MissingFunctionArgumentExceptionMapper()\n);\nmappers.set(\n SpuriousFunctionArgumentException.name,\n new SpuriousFunctionArgumentExceptionMapper()\n);\nmappers.set(NoSuchFunctionException.name, new NoSuchFunctionExceptionMapper());\nmappers.set(\n NoSuchMethodException.name,\n mappers.get(NoSuchFunctionException.name)\n);\nmappers.set(\n WrongFunctionArgumentTypeException.name,\n new WrongFunctionArgumentTypeExceptionMapper()\n);\nmappers.set(InvalidSyntaxException.name, mappers.get(ValidationException.name));\n\nexport function mapException(e: Error): ExprEvalError {\n const mapper = mappers.get(e.constructor.name);\n if (isNullish(mapper)) {\n return new ExprEvalErrorObj(\n ExprKind.PARSE_ERROR,\n ExprEvalStatus.ERROR,\n e.message,\n this.getTextSpan()\n );\n }\n return mapper.mapException(e);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionArgumentException = void 0;
|
|
4
|
+
const ValidationException_js_1 = require("./ValidationException.js");
|
|
5
|
+
class FunctionArgumentException extends ValidationException_js_1.ValidationException {
|
|
6
|
+
constructor(message, functionName, argumentName, index, ctx) {
|
|
7
|
+
super(`${message} - argument ${argumentName} of function ${functionName} (at 0-based index ${index})`, ctx);
|
|
8
|
+
this.functionName = functionName;
|
|
9
|
+
this.argumentName = argumentName;
|
|
10
|
+
this.index = index;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.FunctionArgumentException = FunctionArgumentException;
|
|
14
|
+
//# sourceMappingURL=FunctionArgumentException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/error/FunctionArgumentException.ts"],"names":[],"mappings":";;;AAAA,qEAA+D;AAE/D,MAAsB,yBAA0B,SAAQ,4CAAmB;IAKzE,YACE,OAAe,EACf,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,GAAG;QAEH,KAAK,CACH,GAAG,OAAO,eAAe,YAAY,gBAAgB,YAAY,sBAAsB,KAAK,GAAG,EAC/F,GAAG,CACJ,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AApBD,8DAoBC","file":"error/FunctionArgumentException.js","sourcesContent":["import { ValidationException } from \"./ValidationException.js\";\n\nexport abstract class FunctionArgumentException extends ValidationException {\n readonly functionName: string;\n readonly argumentName: string;\n readonly index: number;\n\n constructor(\n message: string,\n functionName: string,\n argumentName: string,\n index: number,\n ctx\n ) {\n super(\n `${message} - argument ${argumentName} of function ${functionName} (at 0-based index ${index})`,\n ctx\n );\n this.functionName = functionName;\n this.argumentName = argumentName;\n this.index = index;\n }\n}\n"]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MissingFunctionArgumentException = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.argumentName = argumentName;
|
|
10
|
-
this.index = index;
|
|
4
|
+
const FunctionArgumentException_js_1 = require("./FunctionArgumentException.js");
|
|
5
|
+
const IfcExpressionUtils_js_1 = require("../util/IfcExpressionUtils.js");
|
|
6
|
+
class MissingFunctionArgumentException extends FunctionArgumentException_js_1.FunctionArgumentException {
|
|
7
|
+
constructor(functionName, argumentName, index, ctx, message) {
|
|
8
|
+
super((0, IfcExpressionUtils_js_1.isNullish)(message) ? "Required argument missing" : message, functionName, argumentName, index, ctx);
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
11
|
exports.MissingFunctionArgumentException = MissingFunctionArgumentException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/error/MissingFunctionArgumentException.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../src/error/MissingFunctionArgumentException.ts"],"names":[],"mappings":";;;AACA,iFAA2E;AAC3E,yEAA0D;AAE1D,MAAa,gCAAiC,SAAQ,wDAAyB;IAC7E,YACE,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,GAAG,EACH,OAAgB;QAEhB,KAAK,CACH,IAAA,iCAAS,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,OAAO,EAC1D,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,GAAG,CACJ,CAAC;IACJ,CAAC;CACF;AAhBD,4EAgBC","file":"error/MissingFunctionArgumentException.js","sourcesContent":["import { ValidationException } from \"./ValidationException.js\";\nimport { FunctionArgumentException } from \"./FunctionArgumentException\";\nimport { isNullish } from \"../util/IfcExpressionUtils\";\n\nexport class MissingFunctionArgumentException extends FunctionArgumentException {\n constructor(\n functionName: string,\n argumentName: string,\n index: number,\n ctx,\n message?: string\n ) {\n super(\n isNullish(message) ? \"Required argument missing\" : message,\n functionName,\n argumentName,\n index,\n ctx\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpuriousFunctionArgumentException = void 0;
|
|
4
|
+
const FunctionArgumentException_js_1 = require("./FunctionArgumentException.js");
|
|
5
|
+
const IfcExpressionUtils_js_1 = require("../util/IfcExpressionUtils.js");
|
|
6
|
+
class SpuriousFunctionArgumentException extends FunctionArgumentException_js_1.FunctionArgumentException {
|
|
7
|
+
constructor(functionName, argumentName, index, ctx, message) {
|
|
8
|
+
super((0, IfcExpressionUtils_js_1.isNullish)(message) ? "Spurious function argument" : message, functionName, argumentName, index, ctx);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SpuriousFunctionArgumentException = SpuriousFunctionArgumentException;
|
|
12
|
+
//# sourceMappingURL=SpuriousFunctionArgumentException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/error/SpuriousFunctionArgumentException.ts"],"names":[],"mappings":";;;AAAA,iFAA2E;AAC3E,yEAA0D;AAE1D,MAAa,iCAAkC,SAAQ,wDAAyB;IAC9E,YACE,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,GAAG,EACH,OAAgB;QAEhB,KAAK,CACH,IAAA,iCAAS,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,OAAO,EAC3D,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,GAAG,CACJ,CAAC;IACJ,CAAC;CACF;AAhBD,8EAgBC","file":"error/SpuriousFunctionArgumentException.js","sourcesContent":["import { FunctionArgumentException } from \"./FunctionArgumentException\";\nimport { isNullish } from \"../util/IfcExpressionUtils\";\n\nexport class SpuriousFunctionArgumentException extends FunctionArgumentException {\n constructor(\n functionName: string,\n argumentName: string,\n index: number,\n ctx,\n message?: string\n ) {\n super(\n isNullish(message) ? \"Spurious function argument\" : message,\n functionName,\n argumentName,\n index,\n ctx\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/error/mapper/MissingFunctionArgumentExceptionMapper.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/error/mapper/MissingFunctionArgumentExceptionMapper.ts"],"names":[],"mappings":";;;AACA,0EAI4C;AAE5C,wDAAkD;AAElD,MAAa,sCAAsC;IAGjD,YAAY,CAAC,SAA2C;QACtD,OAAO,IAAI,2DAAuC,CAChD,SAAS,CAAC,OAAO,EACjB,SAAS,CAAC,YAAY,EACtB,SAAS,CAAC,YAAY,EACtB,SAAS,CAAC,KAAK,EACf,sBAAQ,CAAC,EAAE,CACT,SAAS,CAAC,QAAQ,EAClB,SAAS,CAAC,UAAU,GAAG,CAAC,EACxB,SAAS,CAAC,MAAM,EAChB,SAAS,CAAC,QAAQ,GAAG,CAAC,CACvB,CACF,CAAC;IACJ,CAAC;CACF;AAjBD,wFAiBC","file":"error/mapper/MissingFunctionArgumentExceptionMapper.js","sourcesContent":["import { ExceptionToExprEvalErrorMapper } from \"../ExceptionToExprEvalErrorMapper.js\";\nimport {\n ExprEvalError,\n ExprEvalMissingFunctionArgumentErrorObj,\n ExprEvalValidationError,\n} from \"../../expression/ExprEvalResult.js\";\nimport { MissingFunctionArgumentException } from \"../MissingFunctionArgumentException.js\";\nimport { TextSpan } from \"../../util/TextSpan.js\";\n\nexport class MissingFunctionArgumentExceptionMapper\n implements ExceptionToExprEvalErrorMapper<MissingFunctionArgumentException>\n{\n mapException(exception: MissingFunctionArgumentException): ExprEvalError {\n return new ExprEvalMissingFunctionArgumentErrorObj(\n exception.message,\n exception.functionName,\n exception.argumentName,\n exception.index,\n TextSpan.of(\n exception.fromLine,\n exception.fromColumn + 1,\n exception.toLine,\n exception.toColumn + 1\n )\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpuriousFunctionArgumentExceptionMapper = void 0;
|
|
4
|
+
const ExprEvalResult_js_1 = require("../../expression/ExprEvalResult.js");
|
|
5
|
+
const TextSpan_js_1 = require("../../util/TextSpan.js");
|
|
6
|
+
class SpuriousFunctionArgumentExceptionMapper {
|
|
7
|
+
mapException(exception) {
|
|
8
|
+
return new ExprEvalResult_js_1.ExprEvalSpuriousFunctionArgumentErrorObj(exception.message, exception.functionName, exception.argumentName, exception.index, TextSpan_js_1.TextSpan.of(exception.fromLine, exception.fromColumn + 1, exception.toLine, exception.toColumn + 1));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SpuriousFunctionArgumentExceptionMapper = SpuriousFunctionArgumentExceptionMapper;
|
|
12
|
+
//# sourceMappingURL=SpuriousFunctionArgumentExceptionMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/error/mapper/SpuriousFunctionArgumentExceptionMapper.ts"],"names":[],"mappings":";;;AACA,0EAK4C;AAE5C,wDAAkD;AAGlD,MAAa,uCAAuC;IAGlD,YAAY,CAAC,SAA4C;QACvD,OAAO,IAAI,4DAAwC,CACjD,SAAS,CAAC,OAAO,EACjB,SAAS,CAAC,YAAY,EACtB,SAAS,CAAC,YAAY,EACtB,SAAS,CAAC,KAAK,EACf,sBAAQ,CAAC,EAAE,CACT,SAAS,CAAC,QAAQ,EAClB,SAAS,CAAC,UAAU,GAAG,CAAC,EACxB,SAAS,CAAC,MAAM,EAChB,SAAS,CAAC,QAAQ,GAAG,CAAC,CACvB,CACF,CAAC;IACJ,CAAC;CACF;AAjBD,0FAiBC","file":"error/mapper/SpuriousFunctionArgumentExceptionMapper.js","sourcesContent":["import { ExceptionToExprEvalErrorMapper } from \"../ExceptionToExprEvalErrorMapper.js\";\nimport {\n ExprEvalError,\n ExprEvalMissingFunctionArgumentErrorObj,\n ExprEvalSpuriousFunctionArgumentErrorObj,\n ExprEvalValidationError,\n} from \"../../expression/ExprEvalResult.js\";\nimport { MissingFunctionArgumentException } from \"../MissingFunctionArgumentException.js\";\nimport { TextSpan } from \"../../util/TextSpan.js\";\nimport { SpuriousFunctionArgumentException } from \"../SpuriousFunctionArgumentException\";\n\nexport class SpuriousFunctionArgumentExceptionMapper\n implements ExceptionToExprEvalErrorMapper<SpuriousFunctionArgumentException>\n{\n mapException(exception: SpuriousFunctionArgumentException): ExprEvalError {\n return new ExprEvalSpuriousFunctionArgumentErrorObj(\n exception.message,\n exception.functionName,\n exception.argumentName,\n exception.index,\n TextSpan.of(\n exception.fromLine,\n exception.fromColumn + 1,\n exception.toLine,\n exception.toColumn + 1\n )\n );\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExprEvalWrongFunctionArgumentTypeErrorObj = exports.ExprEvalMissingFunctionArgumentErrorObj = exports.ExprEvalUnknownFunctionErrorObj = exports.ExprEvalValidationErrorObj = exports.ExprEvalParseErrorObj = exports.ExprEvalTypeErrorObj = exports.ExprEvalValueErrorObj = exports.ExprEvalMissingRequiredFunctionArgumentErrorObj = exports.ExprEvalFunctionEvaluationConsequentialErrorObj = exports.ExprEvalFunctionEvaluationObjectNotFoundErrorObj = exports.ExprEvalFunctionEvaluationErrorObj = exports.ExprEvalConsequentialError1Obj = exports.isExprEvalError = exports.ExprEvalError2Obj = exports.ExprEvalError1Obj = exports.ExprEvalErrorUndefinedResult = exports.mapErrorObjectToMessage = exports.ExprEvalErrorObj = exports.ExprEvalSuccessObj = exports.isExprEvalSuccess = exports.isExprEvalStatus = exports.ExprEvalStatus = void 0;
|
|
3
|
+
exports.ExprEvalWrongFunctionArgumentTypeErrorObj = exports.ExprEvalSpuriousFunctionArgumentErrorObj = exports.ExprEvalMissingFunctionArgumentErrorObj = exports.ExprEvalUnknownFunctionErrorObj = exports.ExprEvalValidationErrorObj = exports.ExprEvalParseErrorObj = exports.ExprEvalTypeErrorObj = exports.ExprEvalValueErrorObj = exports.ExprEvalMissingRequiredFunctionArgumentErrorObj = exports.ExprEvalFunctionEvaluationConsequentialErrorObj = exports.ExprEvalFunctionEvaluationObjectNotFoundErrorObj = exports.ExprEvalFunctionEvaluationErrorObj = exports.ExprEvalConsequentialError1Obj = exports.isExprEvalError = exports.ExprEvalError2Obj = exports.ExprEvalError1Obj = exports.ExprEvalErrorUndefinedResult = exports.mapErrorObjectToMessage = exports.ExprEvalErrorObj = exports.ExprEvalSuccessObj = exports.isExprEvalSuccess = exports.isExprEvalStatus = exports.ExprEvalStatus = void 0;
|
|
4
4
|
const ExprKind_js_1 = require("./ExprKind.js");
|
|
5
5
|
const IfcExpressionUtils_js_1 = require("../util/IfcExpressionUtils.js");
|
|
6
6
|
var ExprEvalStatus;
|
|
@@ -23,7 +23,8 @@ var ExprEvalStatus;
|
|
|
23
23
|
ExprEvalStatus[ExprEvalStatus["MISSING_OPERAND"] = 2084] = "MISSING_OPERAND";
|
|
24
24
|
ExprEvalStatus[ExprEvalStatus["MISSING_REQUIRED_FUNCTION_ARGUMENT"] = 2085] = "MISSING_REQUIRED_FUNCTION_ARGUMENT";
|
|
25
25
|
ExprEvalStatus[ExprEvalStatus["UNKNOWN_FUNCTION"] = 2086] = "UNKNOWN_FUNCTION";
|
|
26
|
-
ExprEvalStatus[ExprEvalStatus["WRONG_FUNCTION_ARGUMENT_TYPE"] =
|
|
26
|
+
ExprEvalStatus[ExprEvalStatus["WRONG_FUNCTION_ARGUMENT_TYPE"] = 2087] = "WRONG_FUNCTION_ARGUMENT_TYPE";
|
|
27
|
+
ExprEvalStatus[ExprEvalStatus["SPURIOUS_FUNCTION_ARGUMENT"] = 2088] = "SPURIOUS_FUNCTION_ARGUMENT";
|
|
27
28
|
})(ExprEvalStatus || (exports.ExprEvalStatus = ExprEvalStatus = {}));
|
|
28
29
|
function isExprEvalStatus(candidate) {
|
|
29
30
|
return (typeof candidate === "number" &&
|
|
@@ -170,15 +171,24 @@ class ExprEvalUnknownFunctionErrorObj extends ExprEvalValidationErrorObj {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
exports.ExprEvalUnknownFunctionErrorObj = ExprEvalUnknownFunctionErrorObj;
|
|
173
|
-
class ExprEvalMissingFunctionArgumentErrorObj extends
|
|
174
|
+
class ExprEvalMissingFunctionArgumentErrorObj extends ExprEvalErrorObj {
|
|
174
175
|
constructor(message, functionName, argumentName, argumentIndex, textSpan) {
|
|
175
|
-
super(ExprEvalStatus.MISSING_REQUIRED_FUNCTION_ARGUMENT, message, textSpan);
|
|
176
|
+
super(ExprKind_js_1.ExprKind.FUNCTION_ARGUMENTS, ExprEvalStatus.MISSING_REQUIRED_FUNCTION_ARGUMENT, message, textSpan);
|
|
176
177
|
this.functionName = functionName;
|
|
177
178
|
this.argumentName = argumentName;
|
|
178
179
|
this.argumentIndex = argumentIndex;
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
exports.ExprEvalMissingFunctionArgumentErrorObj = ExprEvalMissingFunctionArgumentErrorObj;
|
|
183
|
+
class ExprEvalSpuriousFunctionArgumentErrorObj extends ExprEvalErrorObj {
|
|
184
|
+
constructor(message, functionName, argumentName, argumentIndex, textSpan) {
|
|
185
|
+
super(ExprKind_js_1.ExprKind.FUNCTION_ARGUMENTS, ExprEvalStatus.SPURIOUS_FUNCTION_ARGUMENT, message, textSpan);
|
|
186
|
+
this.functionName = functionName;
|
|
187
|
+
this.argumentName = argumentName;
|
|
188
|
+
this.argumentIndex = argumentIndex;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
exports.ExprEvalSpuriousFunctionArgumentErrorObj = ExprEvalSpuriousFunctionArgumentErrorObj;
|
|
182
192
|
class ExprEvalWrongFunctionArgumentTypeErrorObj extends ExprEvalValidationErrorObj {
|
|
183
193
|
constructor(message, functionName, argumentName, argumentIndex, expectedType, actualType, textSpan) {
|
|
184
194
|
super(ExprEvalStatus.WRONG_FUNCTION_ARGUMENT_TYPE, message, textSpan);
|