ifc-expressions
Version:
Parsing and evaluation of IFC expressions
23 lines (22 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExprManager = void 0;
const ValidationException_js_1 = require("../error/ValidationException.js");
const IfcExpressionUtils_js_1 = require("../util/IfcExpressionUtils.js");
class ExprManager {
constructor() {
this.contextToExpr = new Map();
}
registerExprWithContext(expr, ctx) {
const otherCtx = this.contextToExpr.get(expr);
if (!(0, IfcExpressionUtils_js_1.isNullish)(otherCtx) && otherCtx !== ctx) {
throw new ValidationException_js_1.ValidationException(`Expression (of kind '${expr.getKind}') at line ${ctx.start.line}, column ${ctx.start.start} is already associated with a ParserRuleContext of type ${otherCtx.constructor.name}' cannot associate it with another one (${ctx.constructor.name} at ${ctx.start.line}:${ctx.start.start}')`, ctx);
}
this.contextToExpr.set(expr, ctx);
}
getContext(expr) {
return this.contextToExpr.get(expr);
}
}
exports.ExprManager = ExprManager;
//# sourceMappingURL=ExprManager.js.map