340
*/
341
private _regex() {
343
>
344
>
let inEscape = false;
345
>
let inCharacterClass = false;
346
>
while (true) {
347
>
if (p >= this._input.length) {
348
this._current = p;
349
this._error(hintDidYouForgetToEscapeSlash);
350
return;
351
}
353
>
const ch = this._input.charCodeAt(p);
354
>
355
>
if (inEscape) { // parsing an escape character
356
inEscape = false;
357
>
} else if (ch === CharCode.Slash && !inCharacterClass) { // end of regex
scanner.ts
358
p++;
359
break;
360
>
} else if (ch === CharCode.OpenSquareBracket) {
scanner.ts
361
inCharacterClass = true;
362
>
} else if (ch === CharCode.Backslash) {
scanner.ts
363
inEscape = true;
364
>
} else if (ch === CharCode.CloseSquareBracket) {
scanner.ts
365
inCharacterClass = false;
366
}
368
>
}
369
370
// Consume flags // TODO@ulugbekna: use regex instead
371
>
while (p < this._input.length && Scanner._regexFlags.has(this._input.charCodeAt(p))) {
scanner.ts
372
p++;
373
}