ifc-expressions 0.1.0 → 0.2.0

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.
@@ -1,7 +1,22 @@
1
1
  import { ErrorListener, Token } from "antlr4";
2
+ import { IfcExpressionErrorListener } from "./IfcExpressionErrorListener";
2
3
  import { IfcExpressionContext } from "./context/IfcExpressionContext";
3
- import { LiteralValueAnyArity } from "./context/value/LiteralValueAnyArity";
4
+ import { Expr } from "./expression/Expr";
4
5
  import { ExprContext } from "../generated/parser/IfcExpressionParser";
6
+ import { IfcElementAccessor } from "./context/IfcElementAccessor";
7
+ import { Value } from "./value/Value";
8
+ import { StringValue } from "./value/StringValue";
9
+ import { NumericValue } from "./value/NumericValue";
10
+ import { BooleanValue } from "./value/BooleanValue";
11
+ import { LogicalValue } from "./value/LogicalValue";
12
+ import { LiteralValue } from "./value/LiteralValue";
13
+ import { ReferenceValue } from "./value/ReferenceValue";
14
+ import { IfcExpressionEvaluationException } from "./expression/IfcExpressionEvaluationException";
15
+ import IfcExpressionVisitor from "../generated/parser/IfcExpressionVisitor";
16
+ import type { LiteralValueAnyArity } from "./value/LiteralValueAnyArity";
17
+ import type { PrimitiveValueType } from "./value/PrimitiveValueType";
18
+ export { IfcElementAccessor, IfcExpressionContext, Value, StringValue, BooleanValue, LogicalValue, NumericValue, LiteralValue, ReferenceValue, Expr, IfcExpressionEvaluationException, IfcExpressionErrorListener, IfcExpressionVisitor, };
19
+ export type { PrimitiveValueType, LiteralValueAnyArity };
5
20
  export declare class IfcExpression {
6
21
  static parse(input: string, errorListener?: ErrorListener<Token>): ExprContext;
7
22
  static evaluate(expression: string, context: IfcExpressionContext): LiteralValueAnyArity;
@@ -1,6 +1,6 @@
1
1
  import { ErrorListener, RecognitionException, Recognizer, Token } from "antlr4";
2
2
  import { SyntaxErrorException } from "./SyntaxErrorException";
3
- export declare class IfcErrorListener extends ErrorListener<Token> {
3
+ export declare class IfcExpressionErrorListener extends ErrorListener<Token> {
4
4
  private exception;
5
5
  syntaxError(recognizer: Recognizer<Token>, offendingSymbol: Token, line: number, column: number, msg: string, e: RecognitionException | undefined): void;
6
6
  isErrorOccurred(): boolean;
@@ -3,13 +3,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.IfcExpression = void 0;
6
+ exports.IfcExpression = exports.IfcExpressionVisitor = exports.IfcExpressionErrorListener = exports.IfcExpressionEvaluationException = exports.ReferenceValue = exports.NumericValue = exports.LogicalValue = exports.BooleanValue = exports.StringValue = exports.Value = exports.IfcElementAccessor = void 0;
7
7
  const antlr4_1 = require("antlr4");
8
8
  const ExprVisitor_1 = require("./ExprVisitor");
9
- const IfcErrorListener_1 = require("./IfcErrorListener");
9
+ const IfcExpressionErrorListener_1 = require("./IfcExpressionErrorListener");
10
+ Object.defineProperty(exports, "IfcExpressionErrorListener", { enumerable: true, get: function () { return IfcExpressionErrorListener_1.IfcExpressionErrorListener; } });
10
11
  const utils_1 = require("./utils");
11
12
  const IfcExpressionParser_1 = __importDefault(require("../generated/parser/IfcExpressionParser"));
12
13
  const IfcExpressionLexer_1 = __importDefault(require("../generated/parser/IfcExpressionLexer"));
14
+ const IfcElementAccessor_1 = require("./context/IfcElementAccessor");
15
+ Object.defineProperty(exports, "IfcElementAccessor", { enumerable: true, get: function () { return IfcElementAccessor_1.IfcElementAccessor; } });
16
+ const Value_1 = require("./value/Value");
17
+ Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return Value_1.Value; } });
18
+ const StringValue_1 = require("./value/StringValue");
19
+ Object.defineProperty(exports, "StringValue", { enumerable: true, get: function () { return StringValue_1.StringValue; } });
20
+ const NumericValue_1 = require("./value/NumericValue");
21
+ Object.defineProperty(exports, "NumericValue", { enumerable: true, get: function () { return NumericValue_1.NumericValue; } });
22
+ const BooleanValue_1 = require("./value/BooleanValue");
23
+ Object.defineProperty(exports, "BooleanValue", { enumerable: true, get: function () { return BooleanValue_1.BooleanValue; } });
24
+ const LogicalValue_1 = require("./value/LogicalValue");
25
+ Object.defineProperty(exports, "LogicalValue", { enumerable: true, get: function () { return LogicalValue_1.LogicalValue; } });
26
+ const ReferenceValue_1 = require("./value/ReferenceValue");
27
+ Object.defineProperty(exports, "ReferenceValue", { enumerable: true, get: function () { return ReferenceValue_1.ReferenceValue; } });
28
+ const IfcExpressionEvaluationException_1 = require("./expression/IfcExpressionEvaluationException");
29
+ Object.defineProperty(exports, "IfcExpressionEvaluationException", { enumerable: true, get: function () { return IfcExpressionEvaluationException_1.IfcExpressionEvaluationException; } });
30
+ const IfcExpressionVisitor_1 = __importDefault(require("../generated/parser/IfcExpressionVisitor"));
31
+ exports.IfcExpressionVisitor = IfcExpressionVisitor_1.default;
13
32
  class IfcExpression {
14
33
  static parse(input, errorListener) {
15
34
  const chars = new antlr4_1.CharStream(input); // replace this with a FileStream as required
@@ -23,7 +42,7 @@ class IfcExpression {
23
42
  return parser.expr();
24
43
  }
25
44
  static evaluate(expression, context) {
26
- const errorListener = new IfcErrorListener_1.IfcErrorListener();
45
+ const errorListener = new IfcExpressionErrorListener_1.IfcExpressionErrorListener();
27
46
  const tree = IfcExpression.parse(expression, errorListener);
28
47
  if (errorListener.isErrorOccurred()) {
29
48
  throw errorListener.getException();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ifc-expressions",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Parsing and evaluation of IFC expressions",
5
5
  "main": "dist/cjs/ifcExpression.js",
6
6
  "module": "dist/mjs/ifcExpression.js",