source: frontend/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 970 bytes
Line 
1'use strict';
2
3const Mixin = require('../../utils/mixin');
4
5class ErrorReportingMixinBase extends Mixin {
6 constructor(host, opts) {
7 super(host);
8
9 this.posTracker = null;
10 this.onParseError = opts.onParseError;
11 }
12
13 _setErrorLocation(err) {
14 err.startLine = err.endLine = this.posTracker.line;
15 err.startCol = err.endCol = this.posTracker.col;
16 err.startOffset = err.endOffset = this.posTracker.offset;
17 }
18
19 _reportError(code) {
20 const err = {
21 code: code,
22 startLine: -1,
23 startCol: -1,
24 startOffset: -1,
25 endLine: -1,
26 endCol: -1,
27 endOffset: -1
28 };
29
30 this._setErrorLocation(err);
31 this.onParseError(err);
32 }
33
34 _getOverriddenMethods(mxn) {
35 return {
36 _err(code) {
37 mxn._reportError(code);
38 }
39 };
40 }
41}
42
43module.exports = ErrorReportingMixinBase;
Note: See TracBrowser for help on using the repository browser.