MCPcopy
hub / github.com/inikulin/parse5 / constructor

Method constructor

packages/parse5/lib/tokenizer/index.ts:225–258  ·  view source on GitHub ↗
(
        protected options: TokenizerOptions,
        protected handler: TokenHandler,
    )

Source from the content-addressed store, hash-verified

223 protected currentAttr: Attribute = { name: '', value: '' };
224
225 constructor(
226 protected options: TokenizerOptions,
227 protected handler: TokenHandler,
228 ) {
229 this.preprocessor = new Preprocessor(handler);
230 this.currentLocation = this.getCurrentLocation(-1);
231
232 this.entityDecoder = new EntityDecoder(
233 htmlDecodeTree,
234 (cp: number, consumed: number) => {
235 // Note: Set `pos` _before_ flushing, as flushing might drop
236 // the current chunk and invalidate `entityStartPos`.
237 this.preprocessor.pos = this.entityStartPos + consumed - 1;
238 this._flushCodePointConsumedAsCharacterReference(cp);
239 },
240 handler.onParseError
241 ? {
242 missingSemicolonAfterCharacterReference: (): void => {
243 this._err(ERR.missingSemicolonAfterCharacterReference, 1);
244 },
245 absenceOfDigitsInNumericCharacterReference: (consumed: number): void => {
246 this._err(
247 ERR.absenceOfDigitsInNumericCharacterReference,
248 this.entityStartPos - this.preprocessor.pos + consumed,
249 );
250 },
251 validateNumericCharacterReference: (code: number): void => {
252 const error = getErrorForNumericCharacterReference(code);
253 if (error) this._err(error, 1);
254 },
255 }
256 : undefined,
257 );
258 }
259
260 //Errors
261 protected _err(code: ERR, cpOffset = 0): void {

Callers

nothing calls this directly

Tested by

no test coverage detected