Add node modules and new code for release (#39)
Co-authored-by: tbarnes94 <tbarnes94@users.noreply.github.com>
This commit is contained in:
parent
a10d84bc2e
commit
7ad2aa66bb
7655 changed files with 1763577 additions and 14 deletions
43
node_modules/parse5/lib/extensions/error-reporting/mixin-base.js
generated
vendored
Normal file
43
node_modules/parse5/lib/extensions/error-reporting/mixin-base.js
generated
vendored
Normal file
|
@ -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;
|
52
node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js
generated
vendored
Normal file
52
node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
|
||||
const ErrorReportingMixinBase = require('./mixin-base');
|
||||
const ErrorReportingTokenizerMixin = require('./tokenizer-mixin');
|
||||
const LocationInfoTokenizerMixin = require('../location-info/tokenizer-mixin');
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class ErrorReportingParserMixin extends ErrorReportingMixinBase {
|
||||
constructor(parser, opts) {
|
||||
super(parser, opts);
|
||||
|
||||
this.opts = opts;
|
||||
this.ctLoc = null;
|
||||
this.locBeforeToken = false;
|
||||
}
|
||||
|
||||
_setErrorLocation(err) {
|
||||
if (this.ctLoc) {
|
||||
err.startLine = this.ctLoc.startLine;
|
||||
err.startCol = this.ctLoc.startCol;
|
||||
err.startOffset = this.ctLoc.startOffset;
|
||||
|
||||
err.endLine = this.locBeforeToken ? this.ctLoc.startLine : this.ctLoc.endLine;
|
||||
err.endCol = this.locBeforeToken ? this.ctLoc.startCol : this.ctLoc.endCol;
|
||||
err.endOffset = this.locBeforeToken ? this.ctLoc.startOffset : this.ctLoc.endOffset;
|
||||
}
|
||||
}
|
||||
|
||||
_getOverriddenMethods(mxn, orig) {
|
||||
return {
|
||||
_bootstrap(document, fragmentContext) {
|
||||
orig._bootstrap.call(this, document, fragmentContext);
|
||||
|
||||
Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts);
|
||||
Mixin.install(this.tokenizer, LocationInfoTokenizerMixin);
|
||||
},
|
||||
|
||||
_processInputToken(token) {
|
||||
mxn.ctLoc = token.location;
|
||||
|
||||
orig._processInputToken.call(this, token);
|
||||
},
|
||||
|
||||
_err(code, options) {
|
||||
mxn.locBeforeToken = options && options.beforeToken;
|
||||
mxn._reportError(code);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ErrorReportingParserMixin;
|
24
node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js
generated
vendored
Normal file
24
node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
const ErrorReportingMixinBase = require('./mixin-base');
|
||||
const PositionTrackingPreprocessorMixin = require('../position-tracking/preprocessor-mixin');
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase {
|
||||
constructor(preprocessor, opts) {
|
||||
super(preprocessor, opts);
|
||||
|
||||
this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin);
|
||||
this.lastErrOffset = -1;
|
||||
}
|
||||
|
||||
_reportError(code) {
|
||||
//NOTE: avoid reporting error twice on advance/retreat
|
||||
if (this.lastErrOffset !== this.posTracker.offset) {
|
||||
this.lastErrOffset = this.posTracker.offset;
|
||||
super._reportError(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ErrorReportingPreprocessorMixin;
|
17
node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js
generated
vendored
Normal file
17
node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
const ErrorReportingMixinBase = require('./mixin-base');
|
||||
const ErrorReportingPreprocessorMixin = require('./preprocessor-mixin');
|
||||
const Mixin = require('../../utils/mixin');
|
||||
|
||||
class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase {
|
||||
constructor(tokenizer, opts) {
|
||||
super(tokenizer, opts);
|
||||
|
||||
const preprocessorMixin = Mixin.install(tokenizer.preprocessor, ErrorReportingPreprocessorMixin, opts);
|
||||
|
||||
this.posTracker = preprocessorMixin.posTracker;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ErrorReportingTokenizerMixin;
|
Loading…
Add table
Add a link
Reference in a new issue