From 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 5 Mar 2022 19:02:27 +0200 Subject: Added node_modules for the updating to work properly. --- .../lib/extensions/error-reporting/mixin-base.js | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 node_modules/parse5/lib/extensions/error-reporting/mixin-base.js (limited to 'node_modules/parse5/lib/extensions/error-reporting/mixin-base.js') diff --git a/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js b/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js new file mode 100644 index 0000000..1e30cfc --- /dev/null +++ b/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js @@ -0,0 +1,43 @@ +'use strict'; + +const Mixin = require('../../utils/mixin'); + +class ErrorReportingMixinBase extends Mixin { + constructor(host, opts) { + super(host); + + this.posTracker = null; + this.onParseError = opts.onParseError; + } + + _setErrorLocation(err) { + err.startLine = err.endLine = this.posTracker.line; + err.startCol = err.endCol = this.posTracker.col; + err.startOffset = err.endOffset = this.posTracker.offset; + } + + _reportError(code) { + const err = { + code: code, + startLine: -1, + startCol: -1, + startOffset: -1, + endLine: -1, + endCol: -1, + endOffset: -1 + }; + + this._setErrorLocation(err); + this.onParseError(err); + } + + _getOverriddenMethods(mxn) { + return { + _err(code) { + mxn._reportError(code); + } + }; + } +} + +module.exports = ErrorReportingMixinBase; -- cgit v1.2.3