UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

25 lines (24 loc) 1.03 kB
export 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}`; } } } //# sourceMappingURL=ValidationException.js.map