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