* @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,
)
| 187 | * @param options Configuration of the tokenization. |
| 188 | */ |
| 189 | constructor( |
| 190 | _file: ParseSourceFile, |
| 191 | private _getTagDefinition: (tagName: string) => TagDefinition, |
| 192 | options: TokenizeOptions, |
| 193 | ) { |
| 194 | this._tokenizeIcu = options.tokenizeExpansionForms || false; |
| 195 | this._leadingTriviaCodePoints = |
| 196 | options.leadingTriviaChars && options.leadingTriviaChars.map((c) => c.codePointAt(0) || 0); |
| 197 | const range = options.range || { |
| 198 | endPos: _file.content.length, |
| 199 | startPos: 0, |
| 200 | startLine: 0, |
| 201 | startCol: 0, |
| 202 | }; |
| 203 | this._cursor = options.escapedString |
| 204 | ? new EscapedCharacterCursor(_file, range) |
| 205 | : new PlainCharacterCursor(_file, range); |
| 206 | this._preserveLineEndings = options.preserveLineEndings || false; |
| 207 | this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false; |
| 208 | this._tokenizeBlocks = options.tokenizeBlocks ?? true; |
| 209 | this._tokenizeLet = options.tokenizeLet ?? true; |
| 210 | this._selectorlessEnabled = options.selectorlessEnabled ?? false; |
| 211 | try { |
| 212 | this._cursor.init(); |
| 213 | } catch (e) { |
| 214 | this.handleError(e); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | private _processCarriageReturns(content: string): string { |
| 219 | if (this._preserveLineEndings) { |
nothing calls this directly
no test coverage detected