UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS and CSS.

26 lines (19 loc) 794 B
"use strict"; var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"]; var _utilLocation = require("../util/location"); var _index = require("./index"); var _index2 = _interopRequireDefault(_index); var pp = _index2["default"].prototype; // This function is used to raise exceptions on parse errors. It // takes an offset integer (into the current `input`) to indicate // the location of the error, attaches the position to the end // of the error message, and then raises a `SyntaxError` with that // message. pp.raise = function (pos, message) { var loc = _utilLocation.getLineInfo(this.input, pos); message += " (" + loc.line + ":" + loc.column + ")"; var err = new SyntaxError(message); err.pos = pos; err.loc = loc; throw err; };