@eslint-community/regexpp 4.2.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -129,105 +129,105 @@ function isValidLoneUnicodeProperty(version, value) {
129
129
  (version >= 2021 && binPropertySets.es2021.has(value)));
130
130
  }
131
131
 
132
- const Backspace = 0x08;
133
- const CharacterTabulation = 0x09;
134
- const LineFeed = 0x0a;
135
- const LineTabulation = 0x0b;
136
- const FormFeed = 0x0c;
137
- const CarriageReturn = 0x0d;
138
- const ExclamationMark = 0x21;
139
- const DollarSign = 0x24;
140
- const LeftParenthesis = 0x28;
141
- const RightParenthesis = 0x29;
142
- const Asterisk = 0x2a;
143
- const PlusSign = 0x2b;
144
- const Comma = 0x2c;
145
- const HyphenMinus = 0x2d;
146
- const FullStop = 0x2e;
147
- const Solidus = 0x2f;
148
- const DigitZero = 0x30;
149
- const DigitOne = 0x31;
150
- const DigitSeven = 0x37;
151
- const DigitNine = 0x39;
152
- const Colon = 0x3a;
153
- const LessThanSign = 0x3c;
154
- const EqualsSign = 0x3d;
155
- const GreaterThanSign = 0x3e;
156
- const QuestionMark = 0x3f;
157
- const LatinCapitalLetterA = 0x41;
158
- const LatinCapitalLetterB = 0x42;
159
- const LatinCapitalLetterD = 0x44;
160
- const LatinCapitalLetterF = 0x46;
161
- const LatinCapitalLetterP = 0x50;
162
- const LatinCapitalLetterS = 0x53;
163
- const LatinCapitalLetterW = 0x57;
164
- const LatinCapitalLetterZ = 0x5a;
165
- const LowLine = 0x5f;
166
- const LatinSmallLetterA = 0x61;
167
- const LatinSmallLetterB = 0x62;
168
- const LatinSmallLetterC = 0x63;
169
- const LatinSmallLetterD = 0x64;
170
- const LatinSmallLetterF = 0x66;
171
- const LatinSmallLetterG = 0x67;
172
- const LatinSmallLetterI = 0x69;
173
- const LatinSmallLetterK = 0x6b;
174
- const LatinSmallLetterM = 0x6d;
175
- const LatinSmallLetterN = 0x6e;
176
- const LatinSmallLetterP = 0x70;
177
- const LatinSmallLetterR = 0x72;
178
- const LatinSmallLetterS = 0x73;
179
- const LatinSmallLetterT = 0x74;
180
- const LatinSmallLetterU = 0x75;
181
- const LatinSmallLetterV = 0x76;
182
- const LatinSmallLetterW = 0x77;
183
- const LatinSmallLetterX = 0x78;
184
- const LatinSmallLetterY = 0x79;
185
- const LatinSmallLetterZ = 0x7a;
186
- const LeftSquareBracket = 0x5b;
187
- const ReverseSolidus = 0x5c;
188
- const RightSquareBracket = 0x5d;
189
- const CircumflexAccent = 0x5e;
190
- const LeftCurlyBracket = 0x7b;
191
- const VerticalLine = 0x7c;
192
- const RightCurlyBracket = 0x7d;
193
- const ZeroWidthNonJoiner = 0x200c;
194
- const ZeroWidthJoiner = 0x200d;
195
- const LineSeparator = 0x2028;
196
- const ParagraphSeparator = 0x2029;
197
- const MinCodePoint = 0x00;
198
- const MaxCodePoint = 0x10ffff;
132
+ const BACKSPACE = 0x08;
133
+ const CHARACTER_TABULATION = 0x09;
134
+ const LINE_FEED = 0x0a;
135
+ const LINE_TABULATION = 0x0b;
136
+ const FORM_FEED = 0x0c;
137
+ const CARRIAGE_RETURN = 0x0d;
138
+ const EXCLAMATION_MARK = 0x21;
139
+ const DOLLAR_SIGN = 0x24;
140
+ const LEFT_PARENTHESIS = 0x28;
141
+ const RIGHT_PARENTHESIS = 0x29;
142
+ const ASTERISK = 0x2a;
143
+ const PLUS_SIGN = 0x2b;
144
+ const COMMA = 0x2c;
145
+ const HYPHEN_MINUS = 0x2d;
146
+ const FULL_STOP = 0x2e;
147
+ const SOLIDUS = 0x2f;
148
+ const DIGIT_ZERO = 0x30;
149
+ const DIGIT_ONE = 0x31;
150
+ const DIGIT_SEVEN = 0x37;
151
+ const DIGIT_NINE = 0x39;
152
+ const COLON = 0x3a;
153
+ const LESS_THAN_SIGN = 0x3c;
154
+ const EQUALS_SIGN = 0x3d;
155
+ const GREATER_THAN_SIGN = 0x3e;
156
+ const QUESTION_MARK = 0x3f;
157
+ const LATIN_CAPITAL_LETTER_A = 0x41;
158
+ const LATIN_CAPITAL_LETTER_B = 0x42;
159
+ const LATIN_CAPITAL_LETTER_D = 0x44;
160
+ const LATIN_CAPITAL_LETTER_F = 0x46;
161
+ const LATIN_CAPITAL_LETTER_P = 0x50;
162
+ const LATIN_CAPITAL_LETTER_S = 0x53;
163
+ const LATIN_CAPITAL_LETTER_W = 0x57;
164
+ const LATIN_CAPITAL_LETTER_Z = 0x5a;
165
+ const LOW_LINE = 0x5f;
166
+ const LATIN_SMALL_LETTER_A = 0x61;
167
+ const LATIN_SMALL_LETTER_B = 0x62;
168
+ const LATIN_SMALL_LETTER_C = 0x63;
169
+ const LATIN_SMALL_LETTER_D = 0x64;
170
+ const LATIN_SMALL_LETTER_F = 0x66;
171
+ const LATIN_SMALL_LETTER_G = 0x67;
172
+ const LATIN_SMALL_LETTER_I = 0x69;
173
+ const LATIN_SMALL_LETTER_K = 0x6b;
174
+ const LATIN_SMALL_LETTER_M = 0x6d;
175
+ const LATIN_SMALL_LETTER_N = 0x6e;
176
+ const LATIN_SMALL_LETTER_P = 0x70;
177
+ const LATIN_SMALL_LETTER_R = 0x72;
178
+ const LATIN_SMALL_LETTER_S = 0x73;
179
+ const LATIN_SMALL_LETTER_T = 0x74;
180
+ const LATIN_SMALL_LETTER_U = 0x75;
181
+ const LATIN_SMALL_LETTER_V = 0x76;
182
+ const LATIN_SMALL_LETTER_W = 0x77;
183
+ const LATIN_SMALL_LETTER_X = 0x78;
184
+ const LATIN_SMALL_LETTER_Y = 0x79;
185
+ const LATIN_SMALL_LETTER_Z = 0x7a;
186
+ const LEFT_SQUARE_BRACKET = 0x5b;
187
+ const REVERSE_SOLIDUS = 0x5c;
188
+ const RIGHT_SQUARE_BRACKET = 0x5d;
189
+ const CIRCUMFLEX_ACCENT = 0x5e;
190
+ const LEFT_CURLY_BRACKET = 0x7b;
191
+ const VERTICAL_LINE = 0x7c;
192
+ const RIGHT_CURLY_BRACKET = 0x7d;
193
+ const ZERO_WIDTH_NON_JOINER = 0x200c;
194
+ const ZERO_WIDTH_JOINER = 0x200d;
195
+ const LINE_SEPARATOR = 0x2028;
196
+ const PARAGRAPH_SEPARATOR = 0x2029;
197
+ const MIN_CODE_POINT = 0x00;
198
+ const MAX_CODE_POINT = 0x10ffff;
199
199
  function isLatinLetter(code) {
200
- return ((code >= LatinCapitalLetterA && code <= LatinCapitalLetterZ) ||
201
- (code >= LatinSmallLetterA && code <= LatinSmallLetterZ));
200
+ return ((code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_Z) ||
201
+ (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_Z));
202
202
  }
203
203
  function isDecimalDigit(code) {
204
- return code >= DigitZero && code <= DigitNine;
204
+ return code >= DIGIT_ZERO && code <= DIGIT_NINE;
205
205
  }
206
206
  function isOctalDigit(code) {
207
- return code >= DigitZero && code <= DigitSeven;
207
+ return code >= DIGIT_ZERO && code <= DIGIT_SEVEN;
208
208
  }
209
209
  function isHexDigit(code) {
210
- return ((code >= DigitZero && code <= DigitNine) ||
211
- (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) ||
212
- (code >= LatinSmallLetterA && code <= LatinSmallLetterF));
210
+ return ((code >= DIGIT_ZERO && code <= DIGIT_NINE) ||
211
+ (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) ||
212
+ (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F));
213
213
  }
214
214
  function isLineTerminator(code) {
215
- return (code === LineFeed ||
216
- code === CarriageReturn ||
217
- code === LineSeparator ||
218
- code === ParagraphSeparator);
215
+ return (code === LINE_FEED ||
216
+ code === CARRIAGE_RETURN ||
217
+ code === LINE_SEPARATOR ||
218
+ code === PARAGRAPH_SEPARATOR);
219
219
  }
220
220
  function isValidUnicode(code) {
221
- return code >= MinCodePoint && code <= MaxCodePoint;
221
+ return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT;
222
222
  }
223
223
  function digitToInt(code) {
224
- if (code >= LatinSmallLetterA && code <= LatinSmallLetterF) {
225
- return code - LatinSmallLetterA + 10;
224
+ if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) {
225
+ return code - LATIN_SMALL_LETTER_A + 10;
226
226
  }
227
- if (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) {
228
- return code - LatinCapitalLetterA + 10;
227
+ if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) {
228
+ return code - LATIN_CAPITAL_LETTER_A + 10;
229
229
  }
230
- return code - DigitZero;
230
+ return code - DIGIT_ZERO;
231
231
  }
232
232
  function isLeadSurrogate(code) {
233
233
  return code >= 0xd800 && code <= 0xdbff;
@@ -357,33 +357,33 @@ class RegExpSyntaxError extends SyntaxError {
357
357
  }
358
358
 
359
359
  function isSyntaxCharacter(cp) {
360
- return (cp === CircumflexAccent ||
361
- cp === DollarSign ||
362
- cp === ReverseSolidus ||
363
- cp === FullStop ||
364
- cp === Asterisk ||
365
- cp === PlusSign ||
366
- cp === QuestionMark ||
367
- cp === LeftParenthesis ||
368
- cp === RightParenthesis ||
369
- cp === LeftSquareBracket ||
370
- cp === RightSquareBracket ||
371
- cp === LeftCurlyBracket ||
372
- cp === RightCurlyBracket ||
373
- cp === VerticalLine);
360
+ return (cp === CIRCUMFLEX_ACCENT ||
361
+ cp === DOLLAR_SIGN ||
362
+ cp === REVERSE_SOLIDUS ||
363
+ cp === FULL_STOP ||
364
+ cp === ASTERISK ||
365
+ cp === PLUS_SIGN ||
366
+ cp === QUESTION_MARK ||
367
+ cp === LEFT_PARENTHESIS ||
368
+ cp === RIGHT_PARENTHESIS ||
369
+ cp === LEFT_SQUARE_BRACKET ||
370
+ cp === RIGHT_SQUARE_BRACKET ||
371
+ cp === LEFT_CURLY_BRACKET ||
372
+ cp === RIGHT_CURLY_BRACKET ||
373
+ cp === VERTICAL_LINE);
374
374
  }
375
375
  function isRegExpIdentifierStart(cp) {
376
- return isIdStart(cp) || cp === DollarSign || cp === LowLine;
376
+ return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE;
377
377
  }
378
378
  function isRegExpIdentifierPart(cp) {
379
379
  return (isIdContinue(cp) ||
380
- cp === DollarSign ||
381
- cp === LowLine ||
382
- cp === ZeroWidthNonJoiner ||
383
- cp === ZeroWidthJoiner);
380
+ cp === DOLLAR_SIGN ||
381
+ cp === LOW_LINE ||
382
+ cp === ZERO_WIDTH_NON_JOINER ||
383
+ cp === ZERO_WIDTH_JOINER);
384
384
  }
385
385
  function isUnicodePropertyNameCharacter(cp) {
386
- return isLatinLetter(cp) || cp === LowLine;
386
+ return isLatinLetter(cp) || cp === LOW_LINE;
387
387
  }
388
388
  function isUnicodePropertyValueCharacter(cp) {
389
389
  return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp);
@@ -409,7 +409,7 @@ class RegExpValidator {
409
409
  this._uFlag = this._nFlag = false;
410
410
  this.reset(source, start, end);
411
411
  this.onLiteralEnter(start);
412
- if (this.eat(Solidus) && this.eatRegExpBody() && this.eat(Solidus)) {
412
+ if (this.eat(SOLIDUS) && this.eatRegExpBody() && this.eat(SOLIDUS)) {
413
413
  const flagStart = this.index;
414
414
  const uFlag = source.includes("u", flagStart);
415
415
  this.validateFlags(source, flagStart, end);
@@ -439,32 +439,44 @@ class RegExpValidator {
439
439
  this.raise(`Duplicated flag '${source[i]}'`);
440
440
  }
441
441
  existingFlags.add(flag);
442
- if (flag === LatinSmallLetterG) {
442
+ if (flag === LATIN_SMALL_LETTER_G) {
443
443
  global = true;
444
444
  }
445
- else if (flag === LatinSmallLetterI) {
445
+ else if (flag === LATIN_SMALL_LETTER_I) {
446
446
  ignoreCase = true;
447
447
  }
448
- else if (flag === LatinSmallLetterM) {
448
+ else if (flag === LATIN_SMALL_LETTER_M) {
449
449
  multiline = true;
450
450
  }
451
- else if (flag === LatinSmallLetterU && this.ecmaVersion >= 2015) {
451
+ else if (flag === LATIN_SMALL_LETTER_U &&
452
+ this.ecmaVersion >= 2015) {
452
453
  unicode = true;
453
454
  }
454
- else if (flag === LatinSmallLetterY && this.ecmaVersion >= 2015) {
455
+ else if (flag === LATIN_SMALL_LETTER_Y &&
456
+ this.ecmaVersion >= 2015) {
455
457
  sticky = true;
456
458
  }
457
- else if (flag === LatinSmallLetterS && this.ecmaVersion >= 2018) {
459
+ else if (flag === LATIN_SMALL_LETTER_S &&
460
+ this.ecmaVersion >= 2018) {
458
461
  dotAll = true;
459
462
  }
460
- else if (flag === LatinSmallLetterD && this.ecmaVersion >= 2022) {
463
+ else if (flag === LATIN_SMALL_LETTER_D &&
464
+ this.ecmaVersion >= 2022) {
461
465
  hasIndices = true;
462
466
  }
463
467
  else {
464
468
  this.raise(`Invalid flag '${source[i]}'`);
465
469
  }
466
470
  }
467
- this.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices);
471
+ this.onRegExpFlags(start, end, {
472
+ global,
473
+ ignoreCase,
474
+ multiline,
475
+ unicode,
476
+ sticky,
477
+ dotAll,
478
+ hasIndices,
479
+ });
468
480
  }
469
481
  validatePattern(source, start = 0, end = source.length, uFlag = false) {
470
482
  this._uFlag = uFlag && this.ecmaVersion >= 2015;
@@ -496,9 +508,12 @@ class RegExpValidator {
496
508
  this._options.onLiteralLeave(start, end);
497
509
  }
498
510
  }
499
- onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) {
511
+ onRegExpFlags(start, end, flags) {
512
+ if (this._options.onRegExpFlags) {
513
+ this._options.onRegExpFlags(start, end, flags);
514
+ }
500
515
  if (this._options.onFlags) {
501
- this._options.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices);
516
+ this._options.onFlags(start, end, flags.global, flags.ignoreCase, flags.multiline, flags.unicode, flags.sticky, flags.dotAll, flags.hasIndices);
502
517
  }
503
518
  }
504
519
  onPatternEnter(start) {
@@ -668,17 +683,17 @@ class RegExpValidator {
668
683
  if (escaped) {
669
684
  escaped = false;
670
685
  }
671
- else if (cp === ReverseSolidus) {
686
+ else if (cp === REVERSE_SOLIDUS) {
672
687
  escaped = true;
673
688
  }
674
- else if (cp === LeftSquareBracket) {
689
+ else if (cp === LEFT_SQUARE_BRACKET) {
675
690
  inClass = true;
676
691
  }
677
- else if (cp === RightSquareBracket) {
692
+ else if (cp === RIGHT_SQUARE_BRACKET) {
678
693
  inClass = false;
679
694
  }
680
- else if ((cp === Solidus && !inClass) ||
681
- (cp === Asterisk && this.index === start)) {
695
+ else if ((cp === SOLIDUS && !inClass) ||
696
+ (cp === ASTERISK && this.index === start)) {
682
697
  break;
683
698
  }
684
699
  this.advance();
@@ -694,13 +709,13 @@ class RegExpValidator {
694
709
  this.consumeDisjunction();
695
710
  const cp = this.currentCodePoint;
696
711
  if (this.currentCodePoint !== -1) {
697
- if (cp === RightParenthesis) {
712
+ if (cp === RIGHT_PARENTHESIS) {
698
713
  this.raise("Unmatched ')'");
699
714
  }
700
- if (cp === ReverseSolidus) {
715
+ if (cp === REVERSE_SOLIDUS) {
701
716
  this.raise("\\ at end of pattern");
702
717
  }
703
- if (cp === RightSquareBracket || cp === RightCurlyBracket) {
718
+ if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) {
704
719
  this.raise("Lone quantifier brackets");
705
720
  }
706
721
  const c = String.fromCodePoint(cp);
@@ -723,21 +738,21 @@ class RegExpValidator {
723
738
  if (escaped) {
724
739
  escaped = false;
725
740
  }
726
- else if (cp === ReverseSolidus) {
741
+ else if (cp === REVERSE_SOLIDUS) {
727
742
  escaped = true;
728
743
  }
729
- else if (cp === LeftSquareBracket) {
744
+ else if (cp === LEFT_SQUARE_BRACKET) {
730
745
  inClass = true;
731
746
  }
732
- else if (cp === RightSquareBracket) {
747
+ else if (cp === RIGHT_SQUARE_BRACKET) {
733
748
  inClass = false;
734
749
  }
735
- else if (cp === LeftParenthesis &&
750
+ else if (cp === LEFT_PARENTHESIS &&
736
751
  !inClass &&
737
- (this.nextCodePoint !== QuestionMark ||
738
- (this.nextCodePoint2 === LessThanSign &&
739
- this.nextCodePoint3 !== EqualsSign &&
740
- this.nextCodePoint3 !== ExclamationMark))) {
752
+ (this.nextCodePoint !== QUESTION_MARK ||
753
+ (this.nextCodePoint2 === LESS_THAN_SIGN &&
754
+ this.nextCodePoint3 !== EQUALS_SIGN &&
755
+ this.nextCodePoint3 !== EXCLAMATION_MARK))) {
741
756
  count += 1;
742
757
  }
743
758
  this.advance();
@@ -751,11 +766,11 @@ class RegExpValidator {
751
766
  this.onDisjunctionEnter(start);
752
767
  do {
753
768
  this.consumeAlternative(i++);
754
- } while (this.eat(VerticalLine));
769
+ } while (this.eat(VERTICAL_LINE));
755
770
  if (this.consumeQuantifier(true)) {
756
771
  this.raise("Nothing to repeat");
757
772
  }
758
- if (this.eat(LeftCurlyBracket)) {
773
+ if (this.eat(LEFT_CURLY_BRACKET)) {
759
774
  this.raise("Lone quantifier brackets");
760
775
  }
761
776
  this.onDisjunctionLeave(start, this.index);
@@ -784,30 +799,31 @@ class RegExpValidator {
784
799
  consumeAssertion() {
785
800
  const start = this.index;
786
801
  this._lastAssertionIsQuantifiable = false;
787
- if (this.eat(CircumflexAccent)) {
802
+ if (this.eat(CIRCUMFLEX_ACCENT)) {
788
803
  this.onEdgeAssertion(start, this.index, "start");
789
804
  return true;
790
805
  }
791
- if (this.eat(DollarSign)) {
806
+ if (this.eat(DOLLAR_SIGN)) {
792
807
  this.onEdgeAssertion(start, this.index, "end");
793
808
  return true;
794
809
  }
795
- if (this.eat2(ReverseSolidus, LatinCapitalLetterB)) {
810
+ if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) {
796
811
  this.onWordBoundaryAssertion(start, this.index, "word", true);
797
812
  return true;
798
813
  }
799
- if (this.eat2(ReverseSolidus, LatinSmallLetterB)) {
814
+ if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) {
800
815
  this.onWordBoundaryAssertion(start, this.index, "word", false);
801
816
  return true;
802
817
  }
803
- if (this.eat2(LeftParenthesis, QuestionMark)) {
804
- const lookbehind = this.ecmaVersion >= 2018 && this.eat(LessThanSign);
818
+ if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) {
819
+ const lookbehind = this.ecmaVersion >= 2018 && this.eat(LESS_THAN_SIGN);
805
820
  let negate = false;
806
- if (this.eat(EqualsSign) || (negate = this.eat(ExclamationMark))) {
821
+ if (this.eat(EQUALS_SIGN) ||
822
+ (negate = this.eat(EXCLAMATION_MARK))) {
807
823
  const kind = lookbehind ? "lookbehind" : "lookahead";
808
824
  this.onLookaroundAssertionEnter(start, kind, negate);
809
825
  this.consumeDisjunction();
810
- if (!this.eat(RightParenthesis)) {
826
+ if (!this.eat(RIGHT_PARENTHESIS)) {
811
827
  this.raise("Unterminated group");
812
828
  }
813
829
  this._lastAssertionIsQuantifiable = !lookbehind && !this.strict;
@@ -823,15 +839,15 @@ class RegExpValidator {
823
839
  let min = 0;
824
840
  let max = 0;
825
841
  let greedy = false;
826
- if (this.eat(Asterisk)) {
842
+ if (this.eat(ASTERISK)) {
827
843
  min = 0;
828
844
  max = Number.POSITIVE_INFINITY;
829
845
  }
830
- else if (this.eat(PlusSign)) {
846
+ else if (this.eat(PLUS_SIGN)) {
831
847
  min = 1;
832
848
  max = Number.POSITIVE_INFINITY;
833
849
  }
834
- else if (this.eat(QuestionMark)) {
850
+ else if (this.eat(QUESTION_MARK)) {
835
851
  min = 0;
836
852
  max = 1;
837
853
  }
@@ -842,7 +858,7 @@ class RegExpValidator {
842
858
  else {
843
859
  return false;
844
860
  }
845
- greedy = !this.eat(QuestionMark);
861
+ greedy = !this.eat(QUESTION_MARK);
846
862
  if (!noConsume) {
847
863
  this.onQuantifier(start, this.index, min, max, greedy);
848
864
  }
@@ -850,17 +866,17 @@ class RegExpValidator {
850
866
  }
851
867
  eatBracedQuantifier(noError) {
852
868
  const start = this.index;
853
- if (this.eat(LeftCurlyBracket)) {
869
+ if (this.eat(LEFT_CURLY_BRACKET)) {
854
870
  this._lastMinValue = 0;
855
871
  this._lastMaxValue = Number.POSITIVE_INFINITY;
856
872
  if (this.eatDecimalDigits()) {
857
873
  this._lastMinValue = this._lastMaxValue = this._lastIntValue;
858
- if (this.eat(Comma)) {
874
+ if (this.eat(COMMA)) {
859
875
  this._lastMaxValue = this.eatDecimalDigits()
860
876
  ? this._lastIntValue
861
877
  : Number.POSITIVE_INFINITY;
862
878
  }
863
- if (this.eat(RightCurlyBracket)) {
879
+ if (this.eat(RIGHT_CURLY_BRACKET)) {
864
880
  if (!noError && this._lastMaxValue < this._lastMinValue) {
865
881
  this.raise("numbers out of order in {} quantifier");
866
882
  }
@@ -883,7 +899,7 @@ class RegExpValidator {
883
899
  this.consumeCapturingGroup());
884
900
  }
885
901
  consumeDot() {
886
- if (this.eat(FullStop)) {
902
+ if (this.eat(FULL_STOP)) {
887
903
  this.onAnyCharacterSet(this.index - 1, this.index, "any");
888
904
  return true;
889
905
  }
@@ -891,7 +907,7 @@ class RegExpValidator {
891
907
  }
892
908
  consumeReverseSolidusAtomEscape() {
893
909
  const start = this.index;
894
- if (this.eat(ReverseSolidus)) {
910
+ if (this.eat(REVERSE_SOLIDUS)) {
895
911
  if (this.consumeAtomEscape()) {
896
912
  return true;
897
913
  }
@@ -901,10 +917,10 @@ class RegExpValidator {
901
917
  }
902
918
  consumeUncapturingGroup() {
903
919
  const start = this.index;
904
- if (this.eat3(LeftParenthesis, QuestionMark, Colon)) {
920
+ if (this.eat3(LEFT_PARENTHESIS, QUESTION_MARK, COLON)) {
905
921
  this.onGroupEnter(start);
906
922
  this.consumeDisjunction();
907
- if (!this.eat(RightParenthesis)) {
923
+ if (!this.eat(RIGHT_PARENTHESIS)) {
908
924
  this.raise("Unterminated group");
909
925
  }
910
926
  this.onGroupLeave(start, this.index);
@@ -914,19 +930,19 @@ class RegExpValidator {
914
930
  }
915
931
  consumeCapturingGroup() {
916
932
  const start = this.index;
917
- if (this.eat(LeftParenthesis)) {
933
+ if (this.eat(LEFT_PARENTHESIS)) {
918
934
  let name = null;
919
935
  if (this.ecmaVersion >= 2018) {
920
936
  if (this.consumeGroupSpecifier()) {
921
937
  name = this._lastStrValue;
922
938
  }
923
939
  }
924
- else if (this.currentCodePoint === QuestionMark) {
940
+ else if (this.currentCodePoint === QUESTION_MARK) {
925
941
  this.raise("Invalid group");
926
942
  }
927
943
  this.onCapturingGroupEnter(start, name);
928
944
  this.consumeDisjunction();
929
- if (!this.eat(RightParenthesis)) {
945
+ if (!this.eat(RIGHT_PARENTHESIS)) {
930
946
  this.raise("Unterminated group");
931
947
  }
932
948
  this.onCapturingGroupLeave(start, this.index, name);
@@ -946,11 +962,11 @@ class RegExpValidator {
946
962
  }
947
963
  consumeReverseSolidusFollowedByC() {
948
964
  const start = this.index;
949
- if (this.currentCodePoint === ReverseSolidus &&
950
- this.nextCodePoint === LatinSmallLetterC) {
965
+ if (this.currentCodePoint === REVERSE_SOLIDUS &&
966
+ this.nextCodePoint === LATIN_SMALL_LETTER_C) {
951
967
  this._lastIntValue = this.currentCodePoint;
952
968
  this.advance();
953
- this.onCharacter(start, this.index, ReverseSolidus);
969
+ this.onCharacter(start, this.index, REVERSE_SOLIDUS);
954
970
  return true;
955
971
  }
956
972
  return false;
@@ -975,17 +991,17 @@ class RegExpValidator {
975
991
  const start = this.index;
976
992
  const cp = this.currentCodePoint;
977
993
  if (cp !== -1 &&
978
- cp !== CircumflexAccent &&
979
- cp !== DollarSign &&
980
- cp !== ReverseSolidus &&
981
- cp !== FullStop &&
982
- cp !== Asterisk &&
983
- cp !== PlusSign &&
984
- cp !== QuestionMark &&
985
- cp !== LeftParenthesis &&
986
- cp !== RightParenthesis &&
987
- cp !== LeftSquareBracket &&
988
- cp !== VerticalLine) {
994
+ cp !== CIRCUMFLEX_ACCENT &&
995
+ cp !== DOLLAR_SIGN &&
996
+ cp !== REVERSE_SOLIDUS &&
997
+ cp !== FULL_STOP &&
998
+ cp !== ASTERISK &&
999
+ cp !== PLUS_SIGN &&
1000
+ cp !== QUESTION_MARK &&
1001
+ cp !== LEFT_PARENTHESIS &&
1002
+ cp !== RIGHT_PARENTHESIS &&
1003
+ cp !== LEFT_SQUARE_BRACKET &&
1004
+ cp !== VERTICAL_LINE) {
989
1005
  this.advance();
990
1006
  this.onCharacter(start, this.index, cp);
991
1007
  return true;
@@ -993,7 +1009,7 @@ class RegExpValidator {
993
1009
  return false;
994
1010
  }
995
1011
  consumeGroupSpecifier() {
996
- if (this.eat(QuestionMark)) {
1012
+ if (this.eat(QUESTION_MARK)) {
997
1013
  if (this.eatGroupName()) {
998
1014
  if (!this._groupNames.has(this._lastStrValue)) {
999
1015
  this._groupNames.add(this._lastStrValue);
@@ -1034,32 +1050,32 @@ class RegExpValidator {
1034
1050
  }
1035
1051
  consumeCharacterClassEscape() {
1036
1052
  const start = this.index;
1037
- if (this.eat(LatinSmallLetterD)) {
1053
+ if (this.eat(LATIN_SMALL_LETTER_D)) {
1038
1054
  this._lastIntValue = -1;
1039
1055
  this.onEscapeCharacterSet(start - 1, this.index, "digit", false);
1040
1056
  return true;
1041
1057
  }
1042
- if (this.eat(LatinCapitalLetterD)) {
1058
+ if (this.eat(LATIN_CAPITAL_LETTER_D)) {
1043
1059
  this._lastIntValue = -1;
1044
1060
  this.onEscapeCharacterSet(start - 1, this.index, "digit", true);
1045
1061
  return true;
1046
1062
  }
1047
- if (this.eat(LatinSmallLetterS)) {
1063
+ if (this.eat(LATIN_SMALL_LETTER_S)) {
1048
1064
  this._lastIntValue = -1;
1049
1065
  this.onEscapeCharacterSet(start - 1, this.index, "space", false);
1050
1066
  return true;
1051
1067
  }
1052
- if (this.eat(LatinCapitalLetterS)) {
1068
+ if (this.eat(LATIN_CAPITAL_LETTER_S)) {
1053
1069
  this._lastIntValue = -1;
1054
1070
  this.onEscapeCharacterSet(start - 1, this.index, "space", true);
1055
1071
  return true;
1056
1072
  }
1057
- if (this.eat(LatinSmallLetterW)) {
1073
+ if (this.eat(LATIN_SMALL_LETTER_W)) {
1058
1074
  this._lastIntValue = -1;
1059
1075
  this.onEscapeCharacterSet(start - 1, this.index, "word", false);
1060
1076
  return true;
1061
1077
  }
1062
- if (this.eat(LatinCapitalLetterW)) {
1078
+ if (this.eat(LATIN_CAPITAL_LETTER_W)) {
1063
1079
  this._lastIntValue = -1;
1064
1080
  this.onEscapeCharacterSet(start - 1, this.index, "word", true);
1065
1081
  return true;
@@ -1067,12 +1083,12 @@ class RegExpValidator {
1067
1083
  let negate = false;
1068
1084
  if (this._uFlag &&
1069
1085
  this.ecmaVersion >= 2018 &&
1070
- (this.eat(LatinSmallLetterP) ||
1071
- (negate = this.eat(LatinCapitalLetterP)))) {
1086
+ (this.eat(LATIN_SMALL_LETTER_P) ||
1087
+ (negate = this.eat(LATIN_CAPITAL_LETTER_P)))) {
1072
1088
  this._lastIntValue = -1;
1073
- if (this.eat(LeftCurlyBracket) &&
1089
+ if (this.eat(LEFT_CURLY_BRACKET) &&
1074
1090
  this.eatUnicodePropertyValueExpression() &&
1075
- this.eat(RightCurlyBracket)) {
1091
+ this.eat(RIGHT_CURLY_BRACKET)) {
1076
1092
  this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", this._lastKeyValue, this._lastValValue || null, negate);
1077
1093
  return true;
1078
1094
  }
@@ -1098,7 +1114,7 @@ class RegExpValidator {
1098
1114
  }
1099
1115
  consumeKGroupName() {
1100
1116
  const start = this.index;
1101
- if (this.eat(LatinSmallLetterK)) {
1117
+ if (this.eat(LATIN_SMALL_LETTER_K)) {
1102
1118
  if (this.eatGroupName()) {
1103
1119
  const groupName = this._lastStrValue;
1104
1120
  this._backreferenceNames.add(groupName);
@@ -1111,11 +1127,11 @@ class RegExpValidator {
1111
1127
  }
1112
1128
  consumeCharacterClass() {
1113
1129
  const start = this.index;
1114
- if (this.eat(LeftSquareBracket)) {
1115
- const negate = this.eat(CircumflexAccent);
1130
+ if (this.eat(LEFT_SQUARE_BRACKET)) {
1131
+ const negate = this.eat(CIRCUMFLEX_ACCENT);
1116
1132
  this.onCharacterClassEnter(start, negate);
1117
1133
  this.consumeClassRanges();
1118
- if (!this.eat(RightSquareBracket)) {
1134
+ if (!this.eat(RIGHT_SQUARE_BRACKET)) {
1119
1135
  this.raise("Unterminated character class");
1120
1136
  }
1121
1137
  this.onCharacterClassLeave(start, this.index, negate);
@@ -1131,10 +1147,10 @@ class RegExpValidator {
1131
1147
  break;
1132
1148
  }
1133
1149
  const min = this._lastIntValue;
1134
- if (!this.eat(HyphenMinus)) {
1150
+ if (!this.eat(HYPHEN_MINUS)) {
1135
1151
  continue;
1136
1152
  }
1137
- this.onCharacter(this.index - 1, this.index, HyphenMinus);
1153
+ this.onCharacter(this.index - 1, this.index, HYPHEN_MINUS);
1138
1154
  if (!this.consumeClassAtom()) {
1139
1155
  break;
1140
1156
  }
@@ -1154,18 +1170,21 @@ class RegExpValidator {
1154
1170
  consumeClassAtom() {
1155
1171
  const start = this.index;
1156
1172
  const cp = this.currentCodePoint;
1157
- if (cp !== -1 && cp !== ReverseSolidus && cp !== RightSquareBracket) {
1173
+ if (cp !== -1 &&
1174
+ cp !== REVERSE_SOLIDUS &&
1175
+ cp !== RIGHT_SQUARE_BRACKET) {
1158
1176
  this.advance();
1159
1177
  this._lastIntValue = cp;
1160
1178
  this.onCharacter(start, this.index, this._lastIntValue);
1161
1179
  return true;
1162
1180
  }
1163
- if (this.eat(ReverseSolidus)) {
1181
+ if (this.eat(REVERSE_SOLIDUS)) {
1164
1182
  if (this.consumeClassEscape()) {
1165
1183
  return true;
1166
1184
  }
1167
- if (!this.strict && this.currentCodePoint === LatinSmallLetterC) {
1168
- this._lastIntValue = ReverseSolidus;
1185
+ if (!this.strict &&
1186
+ this.currentCodePoint === LATIN_SMALL_LETTER_C) {
1187
+ this._lastIntValue = REVERSE_SOLIDUS;
1169
1188
  this.onCharacter(start, this.index, this._lastIntValue);
1170
1189
  return true;
1171
1190
  }
@@ -1178,21 +1197,21 @@ class RegExpValidator {
1178
1197
  }
1179
1198
  consumeClassEscape() {
1180
1199
  const start = this.index;
1181
- if (this.eat(LatinSmallLetterB)) {
1182
- this._lastIntValue = Backspace;
1200
+ if (this.eat(LATIN_SMALL_LETTER_B)) {
1201
+ this._lastIntValue = BACKSPACE;
1183
1202
  this.onCharacter(start - 1, this.index, this._lastIntValue);
1184
1203
  return true;
1185
1204
  }
1186
- if (this._uFlag && this.eat(HyphenMinus)) {
1187
- this._lastIntValue = HyphenMinus;
1205
+ if (this._uFlag && this.eat(HYPHEN_MINUS)) {
1206
+ this._lastIntValue = HYPHEN_MINUS;
1188
1207
  this.onCharacter(start - 1, this.index, this._lastIntValue);
1189
1208
  return true;
1190
1209
  }
1191
1210
  let cp = 0;
1192
1211
  if (!this.strict &&
1193
1212
  !this._uFlag &&
1194
- this.currentCodePoint === LatinSmallLetterC &&
1195
- (isDecimalDigit((cp = this.nextCodePoint)) || cp === LowLine)) {
1213
+ this.currentCodePoint === LATIN_SMALL_LETTER_C &&
1214
+ (isDecimalDigit((cp = this.nextCodePoint)) || cp === LOW_LINE)) {
1196
1215
  this.advance();
1197
1216
  this.advance();
1198
1217
  this._lastIntValue = cp % 0x20;
@@ -1202,8 +1221,8 @@ class RegExpValidator {
1202
1221
  return (this.consumeCharacterClassEscape() || this.consumeCharacterEscape());
1203
1222
  }
1204
1223
  eatGroupName() {
1205
- if (this.eat(LessThanSign)) {
1206
- if (this.eatRegExpIdentifierName() && this.eat(GreaterThanSign)) {
1224
+ if (this.eat(LESS_THAN_SIGN)) {
1225
+ if (this.eatRegExpIdentifierName() && this.eat(GREATER_THAN_SIGN)) {
1207
1226
  return true;
1208
1227
  }
1209
1228
  this.raise("Invalid capture group name");
@@ -1225,7 +1244,7 @@ class RegExpValidator {
1225
1244
  const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020;
1226
1245
  let cp = this.currentCodePoint;
1227
1246
  this.advance();
1228
- if (cp === ReverseSolidus &&
1247
+ if (cp === REVERSE_SOLIDUS &&
1229
1248
  this.eatRegExpUnicodeEscapeSequence(forceUFlag)) {
1230
1249
  cp = this._lastIntValue;
1231
1250
  }
@@ -1249,7 +1268,7 @@ class RegExpValidator {
1249
1268
  const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020;
1250
1269
  let cp = this.currentCodePoint;
1251
1270
  this.advance();
1252
- if (cp === ReverseSolidus &&
1271
+ if (cp === REVERSE_SOLIDUS &&
1253
1272
  this.eatRegExpUnicodeEscapeSequence(forceUFlag)) {
1254
1273
  cp = this._lastIntValue;
1255
1274
  }
@@ -1270,7 +1289,7 @@ class RegExpValidator {
1270
1289
  }
1271
1290
  eatCControlLetter() {
1272
1291
  const start = this.index;
1273
- if (this.eat(LatinSmallLetterC)) {
1292
+ if (this.eat(LATIN_SMALL_LETTER_C)) {
1274
1293
  if (this.eatControlLetter()) {
1275
1294
  return true;
1276
1295
  }
@@ -1279,7 +1298,7 @@ class RegExpValidator {
1279
1298
  return false;
1280
1299
  }
1281
1300
  eatZero() {
1282
- if (this.currentCodePoint === DigitZero &&
1301
+ if (this.currentCodePoint === DIGIT_ZERO &&
1283
1302
  !isDecimalDigit(this.nextCodePoint)) {
1284
1303
  this._lastIntValue = 0;
1285
1304
  this.advance();
@@ -1288,24 +1307,24 @@ class RegExpValidator {
1288
1307
  return false;
1289
1308
  }
1290
1309
  eatControlEscape() {
1291
- if (this.eat(LatinSmallLetterF)) {
1292
- this._lastIntValue = FormFeed;
1310
+ if (this.eat(LATIN_SMALL_LETTER_F)) {
1311
+ this._lastIntValue = FORM_FEED;
1293
1312
  return true;
1294
1313
  }
1295
- if (this.eat(LatinSmallLetterN)) {
1296
- this._lastIntValue = LineFeed;
1314
+ if (this.eat(LATIN_SMALL_LETTER_N)) {
1315
+ this._lastIntValue = LINE_FEED;
1297
1316
  return true;
1298
1317
  }
1299
- if (this.eat(LatinSmallLetterR)) {
1300
- this._lastIntValue = CarriageReturn;
1318
+ if (this.eat(LATIN_SMALL_LETTER_R)) {
1319
+ this._lastIntValue = CARRIAGE_RETURN;
1301
1320
  return true;
1302
1321
  }
1303
- if (this.eat(LatinSmallLetterT)) {
1304
- this._lastIntValue = CharacterTabulation;
1322
+ if (this.eat(LATIN_SMALL_LETTER_T)) {
1323
+ this._lastIntValue = CHARACTER_TABULATION;
1305
1324
  return true;
1306
1325
  }
1307
- if (this.eat(LatinSmallLetterV)) {
1308
- this._lastIntValue = LineTabulation;
1326
+ if (this.eat(LATIN_SMALL_LETTER_V)) {
1327
+ this._lastIntValue = LINE_TABULATION;
1309
1328
  return true;
1310
1329
  }
1311
1330
  return false;
@@ -1322,7 +1341,7 @@ class RegExpValidator {
1322
1341
  eatRegExpUnicodeEscapeSequence(forceUFlag = false) {
1323
1342
  const start = this.index;
1324
1343
  const uFlag = forceUFlag || this._uFlag;
1325
- if (this.eat(LatinSmallLetterU)) {
1344
+ if (this.eat(LATIN_SMALL_LETTER_U)) {
1326
1345
  if ((uFlag && this.eatRegExpUnicodeSurrogatePairEscape()) ||
1327
1346
  this.eatFixedHexDigits(4) ||
1328
1347
  (uFlag && this.eatRegExpUnicodeCodePointEscape())) {
@@ -1340,8 +1359,8 @@ class RegExpValidator {
1340
1359
  if (this.eatFixedHexDigits(4)) {
1341
1360
  const lead = this._lastIntValue;
1342
1361
  if (isLeadSurrogate(lead) &&
1343
- this.eat(ReverseSolidus) &&
1344
- this.eat(LatinSmallLetterU) &&
1362
+ this.eat(REVERSE_SOLIDUS) &&
1363
+ this.eat(LATIN_SMALL_LETTER_U) &&
1345
1364
  this.eatFixedHexDigits(4)) {
1346
1365
  const trail = this._lastIntValue;
1347
1366
  if (isTrailSurrogate(trail)) {
@@ -1355,9 +1374,9 @@ class RegExpValidator {
1355
1374
  }
1356
1375
  eatRegExpUnicodeCodePointEscape() {
1357
1376
  const start = this.index;
1358
- if (this.eat(LeftCurlyBracket) &&
1377
+ if (this.eat(LEFT_CURLY_BRACKET) &&
1359
1378
  this.eatHexDigits() &&
1360
- this.eat(RightCurlyBracket) &&
1379
+ this.eat(RIGHT_CURLY_BRACKET) &&
1361
1380
  isValidUnicode(this._lastIntValue)) {
1362
1381
  return true;
1363
1382
  }
@@ -1378,32 +1397,32 @@ class RegExpValidator {
1378
1397
  return false;
1379
1398
  }
1380
1399
  if (this._uFlag) {
1381
- return isSyntaxCharacter(cp) || cp === Solidus;
1400
+ return isSyntaxCharacter(cp) || cp === SOLIDUS;
1382
1401
  }
1383
1402
  if (this.strict) {
1384
1403
  return !isIdContinue(cp);
1385
1404
  }
1386
1405
  if (this._nFlag) {
1387
- return !(cp === LatinSmallLetterC || cp === LatinSmallLetterK);
1406
+ return !(cp === LATIN_SMALL_LETTER_C || cp === LATIN_SMALL_LETTER_K);
1388
1407
  }
1389
- return cp !== LatinSmallLetterC;
1408
+ return cp !== LATIN_SMALL_LETTER_C;
1390
1409
  }
1391
1410
  eatDecimalEscape() {
1392
1411
  this._lastIntValue = 0;
1393
1412
  let cp = this.currentCodePoint;
1394
- if (cp >= DigitOne && cp <= DigitNine) {
1413
+ if (cp >= DIGIT_ONE && cp <= DIGIT_NINE) {
1395
1414
  do {
1396
- this._lastIntValue = 10 * this._lastIntValue + (cp - DigitZero);
1415
+ this._lastIntValue = 10 * this._lastIntValue + (cp - DIGIT_ZERO);
1397
1416
  this.advance();
1398
- } while ((cp = this.currentCodePoint) >= DigitZero &&
1399
- cp <= DigitNine);
1417
+ } while ((cp = this.currentCodePoint) >= DIGIT_ZERO &&
1418
+ cp <= DIGIT_NINE);
1400
1419
  return true;
1401
1420
  }
1402
1421
  return false;
1403
1422
  }
1404
1423
  eatUnicodePropertyValueExpression() {
1405
1424
  const start = this.index;
1406
- if (this.eatUnicodePropertyName() && this.eat(EqualsSign)) {
1425
+ if (this.eatUnicodePropertyName() && this.eat(EQUALS_SIGN)) {
1407
1426
  this._lastKeyValue = this._lastStrValue;
1408
1427
  if (this.eatUnicodePropertyValue()) {
1409
1428
  this._lastValValue = this._lastStrValue;
@@ -1451,7 +1470,7 @@ class RegExpValidator {
1451
1470
  }
1452
1471
  eatHexEscapeSequence() {
1453
1472
  const start = this.index;
1454
- if (this.eat(LatinSmallLetterX)) {
1473
+ if (this.eat(LATIN_SMALL_LETTER_X)) {
1455
1474
  if (this.eatFixedHexDigits(2)) {
1456
1475
  return true;
1457
1476
  }
@@ -1505,7 +1524,7 @@ class RegExpValidator {
1505
1524
  const cp = this.currentCodePoint;
1506
1525
  if (isOctalDigit(cp)) {
1507
1526
  this.advance();
1508
- this._lastIntValue = cp - DigitZero;
1527
+ this._lastIntValue = cp - DIGIT_ZERO;
1509
1528
  return true;
1510
1529
  }
1511
1530
  this._lastIntValue = 0;
@@ -1527,14 +1546,14 @@ class RegExpValidator {
1527
1546
  }
1528
1547
  }
1529
1548
 
1530
- const DummyPattern = {};
1531
- const DummyFlags = {};
1532
- const DummyCapturingGroup = {};
1549
+ const DUMMY_PATTERN = {};
1550
+ const DUMMY_FLAGS = {};
1551
+ const DUMMY_CAPTURING_GROUP = {};
1533
1552
  class RegExpParserState {
1534
1553
  constructor(options) {
1535
1554
  var _a;
1536
- this._node = DummyPattern;
1537
- this._flags = DummyFlags;
1555
+ this._node = DUMMY_PATTERN;
1556
+ this._flags = DUMMY_FLAGS;
1538
1557
  this._backreferences = [];
1539
1558
  this._capturingGroups = [];
1540
1559
  this.source = "";
@@ -1553,7 +1572,7 @@ class RegExpParserState {
1553
1572
  }
1554
1573
  return this._flags;
1555
1574
  }
1556
- onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) {
1575
+ onRegExpFlags(start, end, { global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices, }) {
1557
1576
  this._flags = {
1558
1577
  type: "Flags",
1559
1578
  parent: null,
@@ -1824,7 +1843,7 @@ class RegExpParserState {
1824
1843
  end,
1825
1844
  raw: this.source.slice(start, end),
1826
1845
  ref,
1827
- resolved: DummyCapturingGroup,
1846
+ resolved: DUMMY_CAPTURING_GROUP,
1828
1847
  };
1829
1848
  parent.elements.push(node);
1830
1849
  this._backreferences.push(node);
@@ -1870,7 +1889,7 @@ class RegExpParserState {
1870
1889
  min.type !== "Character" ||
1871
1890
  max.type !== "Character" ||
1872
1891
  hyphen.type !== "Character" ||
1873
- hyphen.value !== HyphenMinus) {
1892
+ hyphen.value !== HYPHEN_MINUS) {
1874
1893
  throw new Error("UnknownError");
1875
1894
  }
1876
1895
  const node = {