* @param _file The html source file being tokenized. * @param _getTagDefinition A function that will retrieve a tag definition for a given tag name. * @param options Configuration of the tokenization.
(
_file: ParseSourceFile,
private _getTagDefinition: (tagName: string) => TagDefinition,
options: TokenizeOptions,
)
| 182 | * @param options Configuration of the tokenization. |
| 183 | */ |
| 184 | constructor( |
| 185 | _file: ParseSourceFile, |
| 186 | private _getTagDefinition: (tagName: string) => TagDefinition, |
| 187 | options: TokenizeOptions, |
| 188 | ) { |
| 189 | this._tokenizeIcu = options.tokenizeExpansionForms || false; |
| 190 | this._leadingTriviaCodePoints = |
| 191 | options.leadingTriviaChars && options.leadingTriviaChars.map((c) => c.codePointAt(0) || 0); |
| 192 | const range = options.range || { |
| 193 | endPos: _file.content.length, |
| 194 | startPos: 0, |
| 195 | startLine: 0, |
| 196 | startCol: 0, |
| 197 | }; |
| 198 | this._cursor = options.escapedString |
| 199 | ? new EscapedCharacterCursor(_file, range) |
| 200 | : new PlainCharacterCursor(_file, range); |
| 201 | this._preserveLineEndings = options.preserveLineEndings || false; |
| 202 | this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false; |
| 203 | this._tokenizeBlocks = options.tokenizeBlocks ?? true; |
| 204 | this._tokenizeLet = options.tokenizeLet ?? true; |
| 205 | this._selectorlessEnabled = options.selectorlessEnabled ?? false; |
| 206 | try { |
| 207 | this._cursor.init(); |
| 208 | } catch (e) { |
| 209 | this.handleError(e); |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | private _processCarriageReturns(content: string): string { |
| 214 | if (this._preserveLineEndings) { |
nothing calls this directly
no test coverage detected