UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

29 lines (28 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ValidationException = void 0; class ValidationException extends Error { constructor(message, ctx) { super(`Validation Failed: ${message} at ${ValidationException.makeColumnsString(ctx)}, near '${ctx.getText()}'`); this.fromLine = ctx.start.line; this.fromColumn = ctx.start.column; this.toLine = ctx.stop.line; this.toColumn = ctx.stop.column + (ctx.stop.text || "").length; } static makeColumnsString(ctx) { const fromLine = ctx.start.line; const fromColumn = ctx.start.column; const toLine = ctx.stop.line; const toColumn = ctx.stop.column + (ctx.stop.text || "").length; if (fromLine == toLine) { return fromColumn == toColumn ? `line ${fromLine}, column ${fromColumn}` : `line ${fromLine}, columns ${fromColumn}-${toColumn}`; } else { return `line ${fromLine}, column ${fromColumn} to line ${toLine}, column ${toColumn}`; } } } exports.ValidationException = ValidationException; //# sourceMappingURL=ValidationException.js.map