@eslint-community/regexpp 4.1.0 → 4.3.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
@@ -72,11 +72,13 @@ function restoreRanges(data) {
72
72
  }
73
73
 
74
74
  class DataSet {
75
- constructor(raw2018, raw2019, raw2020, raw2021) {
75
+ constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023) {
76
76
  this._raw2018 = raw2018;
77
77
  this._raw2019 = raw2019;
78
78
  this._raw2020 = raw2020;
79
79
  this._raw2021 = raw2021;
80
+ this._raw2022 = raw2022;
81
+ this._raw2023 = raw2023;
80
82
  }
81
83
  get es2018() {
82
84
  var _a;
@@ -94,12 +96,20 @@ class DataSet {
94
96
  var _a;
95
97
  return ((_a = this._set2021) !== null && _a !== void 0 ? _a : (this._set2021 = new Set(this._raw2021.split(" "))));
96
98
  }
99
+ get es2022() {
100
+ var _a;
101
+ return ((_a = this._set2022) !== null && _a !== void 0 ? _a : (this._set2022 = new Set(this._raw2022.split(" "))));
102
+ }
103
+ get es2023() {
104
+ var _a;
105
+ return ((_a = this._set2023) !== null && _a !== void 0 ? _a : (this._set2023 = new Set(this._raw2023.split(" "))));
106
+ }
97
107
  }
98
108
  const gcNameSet = new Set(["General_Category", "gc"]);
99
109
  const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]);
100
- const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "");
101
- const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi");
102
- const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict");
110
+ const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "");
111
+ const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "");
112
+ const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "");
103
113
  function isValidUnicodeProperty(version, name, value) {
104
114
  if (gcNameSet.has(name)) {
105
115
  return version >= 2018 && gcValueSets.es2018.has(value);
@@ -108,7 +118,8 @@ function isValidUnicodeProperty(version, name, value) {
108
118
  return ((version >= 2018 && scValueSets.es2018.has(value)) ||
109
119
  (version >= 2019 && scValueSets.es2019.has(value)) ||
110
120
  (version >= 2020 && scValueSets.es2020.has(value)) ||
111
- (version >= 2021 && scValueSets.es2021.has(value)));
121
+ (version >= 2021 && scValueSets.es2021.has(value)) ||
122
+ (version >= 2022 && scValueSets.es2022.has(value)));
112
123
  }
113
124
  return false;
114
125
  }
@@ -118,105 +129,105 @@ function isValidLoneUnicodeProperty(version, value) {
118
129
  (version >= 2021 && binPropertySets.es2021.has(value)));
119
130
  }
120
131
 
121
- const Backspace = 0x08;
122
- const CharacterTabulation = 0x09;
123
- const LineFeed = 0x0a;
124
- const LineTabulation = 0x0b;
125
- const FormFeed = 0x0c;
126
- const CarriageReturn = 0x0d;
127
- const ExclamationMark = 0x21;
128
- const DollarSign = 0x24;
129
- const LeftParenthesis = 0x28;
130
- const RightParenthesis = 0x29;
131
- const Asterisk = 0x2a;
132
- const PlusSign = 0x2b;
133
- const Comma = 0x2c;
134
- const HyphenMinus = 0x2d;
135
- const FullStop = 0x2e;
136
- const Solidus = 0x2f;
137
- const DigitZero = 0x30;
138
- const DigitOne = 0x31;
139
- const DigitSeven = 0x37;
140
- const DigitNine = 0x39;
141
- const Colon = 0x3a;
142
- const LessThanSign = 0x3c;
143
- const EqualsSign = 0x3d;
144
- const GreaterThanSign = 0x3e;
145
- const QuestionMark = 0x3f;
146
- const LatinCapitalLetterA = 0x41;
147
- const LatinCapitalLetterB = 0x42;
148
- const LatinCapitalLetterD = 0x44;
149
- const LatinCapitalLetterF = 0x46;
150
- const LatinCapitalLetterP = 0x50;
151
- const LatinCapitalLetterS = 0x53;
152
- const LatinCapitalLetterW = 0x57;
153
- const LatinCapitalLetterZ = 0x5a;
154
- const LowLine = 0x5f;
155
- const LatinSmallLetterA = 0x61;
156
- const LatinSmallLetterB = 0x62;
157
- const LatinSmallLetterC = 0x63;
158
- const LatinSmallLetterD = 0x64;
159
- const LatinSmallLetterF = 0x66;
160
- const LatinSmallLetterG = 0x67;
161
- const LatinSmallLetterI = 0x69;
162
- const LatinSmallLetterK = 0x6b;
163
- const LatinSmallLetterM = 0x6d;
164
- const LatinSmallLetterN = 0x6e;
165
- const LatinSmallLetterP = 0x70;
166
- const LatinSmallLetterR = 0x72;
167
- const LatinSmallLetterS = 0x73;
168
- const LatinSmallLetterT = 0x74;
169
- const LatinSmallLetterU = 0x75;
170
- const LatinSmallLetterV = 0x76;
171
- const LatinSmallLetterW = 0x77;
172
- const LatinSmallLetterX = 0x78;
173
- const LatinSmallLetterY = 0x79;
174
- const LatinSmallLetterZ = 0x7a;
175
- const LeftSquareBracket = 0x5b;
176
- const ReverseSolidus = 0x5c;
177
- const RightSquareBracket = 0x5d;
178
- const CircumflexAccent = 0x5e;
179
- const LeftCurlyBracket = 0x7b;
180
- const VerticalLine = 0x7c;
181
- const RightCurlyBracket = 0x7d;
182
- const ZeroWidthNonJoiner = 0x200c;
183
- const ZeroWidthJoiner = 0x200d;
184
- const LineSeparator = 0x2028;
185
- const ParagraphSeparator = 0x2029;
186
- const MinCodePoint = 0x00;
187
- 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;
188
199
  function isLatinLetter(code) {
189
- return ((code >= LatinCapitalLetterA && code <= LatinCapitalLetterZ) ||
190
- (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));
191
202
  }
192
203
  function isDecimalDigit(code) {
193
- return code >= DigitZero && code <= DigitNine;
204
+ return code >= DIGIT_ZERO && code <= DIGIT_NINE;
194
205
  }
195
206
  function isOctalDigit(code) {
196
- return code >= DigitZero && code <= DigitSeven;
207
+ return code >= DIGIT_ZERO && code <= DIGIT_SEVEN;
197
208
  }
198
209
  function isHexDigit(code) {
199
- return ((code >= DigitZero && code <= DigitNine) ||
200
- (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) ||
201
- (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));
202
213
  }
203
214
  function isLineTerminator(code) {
204
- return (code === LineFeed ||
205
- code === CarriageReturn ||
206
- code === LineSeparator ||
207
- code === ParagraphSeparator);
215
+ return (code === LINE_FEED ||
216
+ code === CARRIAGE_RETURN ||
217
+ code === LINE_SEPARATOR ||
218
+ code === PARAGRAPH_SEPARATOR);
208
219
  }
209
220
  function isValidUnicode(code) {
210
- return code >= MinCodePoint && code <= MaxCodePoint;
221
+ return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT;
211
222
  }
212
223
  function digitToInt(code) {
213
- if (code >= LatinSmallLetterA && code <= LatinSmallLetterF) {
214
- return code - LatinSmallLetterA + 10;
224
+ if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) {
225
+ return code - LATIN_SMALL_LETTER_A + 10;
215
226
  }
216
- if (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) {
217
- return code - LatinCapitalLetterA + 10;
227
+ if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) {
228
+ return code - LATIN_CAPITAL_LETTER_A + 10;
218
229
  }
219
- return code - DigitZero;
230
+ return code - DIGIT_ZERO;
220
231
  }
221
232
  function isLeadSurrogate(code) {
222
233
  return code >= 0xd800 && code <= 0xdbff;
@@ -346,33 +357,33 @@ class RegExpSyntaxError extends SyntaxError {
346
357
  }
347
358
 
348
359
  function isSyntaxCharacter(cp) {
349
- return (cp === CircumflexAccent ||
350
- cp === DollarSign ||
351
- cp === ReverseSolidus ||
352
- cp === FullStop ||
353
- cp === Asterisk ||
354
- cp === PlusSign ||
355
- cp === QuestionMark ||
356
- cp === LeftParenthesis ||
357
- cp === RightParenthesis ||
358
- cp === LeftSquareBracket ||
359
- cp === RightSquareBracket ||
360
- cp === LeftCurlyBracket ||
361
- cp === RightCurlyBracket ||
362
- 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);
363
374
  }
364
375
  function isRegExpIdentifierStart(cp) {
365
- return isIdStart(cp) || cp === DollarSign || cp === LowLine;
376
+ return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE;
366
377
  }
367
378
  function isRegExpIdentifierPart(cp) {
368
379
  return (isIdContinue(cp) ||
369
- cp === DollarSign ||
370
- cp === LowLine ||
371
- cp === ZeroWidthNonJoiner ||
372
- cp === ZeroWidthJoiner);
380
+ cp === DOLLAR_SIGN ||
381
+ cp === LOW_LINE ||
382
+ cp === ZERO_WIDTH_NON_JOINER ||
383
+ cp === ZERO_WIDTH_JOINER);
373
384
  }
374
385
  function isUnicodePropertyNameCharacter(cp) {
375
- return isLatinLetter(cp) || cp === LowLine;
386
+ return isLatinLetter(cp) || cp === LOW_LINE;
376
387
  }
377
388
  function isUnicodePropertyValueCharacter(cp) {
378
389
  return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp);
@@ -398,7 +409,7 @@ class RegExpValidator {
398
409
  this._uFlag = this._nFlag = false;
399
410
  this.reset(source, start, end);
400
411
  this.onLiteralEnter(start);
401
- if (this.eat(Solidus) && this.eatRegExpBody() && this.eat(Solidus)) {
412
+ if (this.eat(SOLIDUS) && this.eatRegExpBody() && this.eat(SOLIDUS)) {
402
413
  const flagStart = this.index;
403
414
  const uFlag = source.includes("u", flagStart);
404
415
  this.validateFlags(source, flagStart, end);
@@ -428,32 +439,44 @@ class RegExpValidator {
428
439
  this.raise(`Duplicated flag '${source[i]}'`);
429
440
  }
430
441
  existingFlags.add(flag);
431
- if (flag === LatinSmallLetterG) {
442
+ if (flag === LATIN_SMALL_LETTER_G) {
432
443
  global = true;
433
444
  }
434
- else if (flag === LatinSmallLetterI) {
445
+ else if (flag === LATIN_SMALL_LETTER_I) {
435
446
  ignoreCase = true;
436
447
  }
437
- else if (flag === LatinSmallLetterM) {
448
+ else if (flag === LATIN_SMALL_LETTER_M) {
438
449
  multiline = true;
439
450
  }
440
- else if (flag === LatinSmallLetterU && this.ecmaVersion >= 2015) {
451
+ else if (flag === LATIN_SMALL_LETTER_U &&
452
+ this.ecmaVersion >= 2015) {
441
453
  unicode = true;
442
454
  }
443
- else if (flag === LatinSmallLetterY && this.ecmaVersion >= 2015) {
455
+ else if (flag === LATIN_SMALL_LETTER_Y &&
456
+ this.ecmaVersion >= 2015) {
444
457
  sticky = true;
445
458
  }
446
- else if (flag === LatinSmallLetterS && this.ecmaVersion >= 2018) {
459
+ else if (flag === LATIN_SMALL_LETTER_S &&
460
+ this.ecmaVersion >= 2018) {
447
461
  dotAll = true;
448
462
  }
449
- else if (flag === LatinSmallLetterD && this.ecmaVersion >= 2022) {
463
+ else if (flag === LATIN_SMALL_LETTER_D &&
464
+ this.ecmaVersion >= 2022) {
450
465
  hasIndices = true;
451
466
  }
452
467
  else {
453
468
  this.raise(`Invalid flag '${source[i]}'`);
454
469
  }
455
470
  }
456
- 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
+ });
457
480
  }
458
481
  validatePattern(source, start = 0, end = source.length, uFlag = false) {
459
482
  this._uFlag = uFlag && this.ecmaVersion >= 2015;
@@ -485,9 +508,12 @@ class RegExpValidator {
485
508
  this._options.onLiteralLeave(start, end);
486
509
  }
487
510
  }
488
- 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
+ }
489
515
  if (this._options.onFlags) {
490
- 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);
491
517
  }
492
518
  }
493
519
  onPatternEnter(start) {
@@ -657,17 +683,17 @@ class RegExpValidator {
657
683
  if (escaped) {
658
684
  escaped = false;
659
685
  }
660
- else if (cp === ReverseSolidus) {
686
+ else if (cp === REVERSE_SOLIDUS) {
661
687
  escaped = true;
662
688
  }
663
- else if (cp === LeftSquareBracket) {
689
+ else if (cp === LEFT_SQUARE_BRACKET) {
664
690
  inClass = true;
665
691
  }
666
- else if (cp === RightSquareBracket) {
692
+ else if (cp === RIGHT_SQUARE_BRACKET) {
667
693
  inClass = false;
668
694
  }
669
- else if ((cp === Solidus && !inClass) ||
670
- (cp === Asterisk && this.index === start)) {
695
+ else if ((cp === SOLIDUS && !inClass) ||
696
+ (cp === ASTERISK && this.index === start)) {
671
697
  break;
672
698
  }
673
699
  this.advance();
@@ -683,13 +709,13 @@ class RegExpValidator {
683
709
  this.consumeDisjunction();
684
710
  const cp = this.currentCodePoint;
685
711
  if (this.currentCodePoint !== -1) {
686
- if (cp === RightParenthesis) {
712
+ if (cp === RIGHT_PARENTHESIS) {
687
713
  this.raise("Unmatched ')'");
688
714
  }
689
- if (cp === ReverseSolidus) {
715
+ if (cp === REVERSE_SOLIDUS) {
690
716
  this.raise("\\ at end of pattern");
691
717
  }
692
- if (cp === RightSquareBracket || cp === RightCurlyBracket) {
718
+ if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) {
693
719
  this.raise("Lone quantifier brackets");
694
720
  }
695
721
  const c = String.fromCodePoint(cp);
@@ -712,21 +738,21 @@ class RegExpValidator {
712
738
  if (escaped) {
713
739
  escaped = false;
714
740
  }
715
- else if (cp === ReverseSolidus) {
741
+ else if (cp === REVERSE_SOLIDUS) {
716
742
  escaped = true;
717
743
  }
718
- else if (cp === LeftSquareBracket) {
744
+ else if (cp === LEFT_SQUARE_BRACKET) {
719
745
  inClass = true;
720
746
  }
721
- else if (cp === RightSquareBracket) {
747
+ else if (cp === RIGHT_SQUARE_BRACKET) {
722
748
  inClass = false;
723
749
  }
724
- else if (cp === LeftParenthesis &&
750
+ else if (cp === LEFT_PARENTHESIS &&
725
751
  !inClass &&
726
- (this.nextCodePoint !== QuestionMark ||
727
- (this.nextCodePoint2 === LessThanSign &&
728
- this.nextCodePoint3 !== EqualsSign &&
729
- this.nextCodePoint3 !== ExclamationMark))) {
752
+ (this.nextCodePoint !== QUESTION_MARK ||
753
+ (this.nextCodePoint2 === LESS_THAN_SIGN &&
754
+ this.nextCodePoint3 !== EQUALS_SIGN &&
755
+ this.nextCodePoint3 !== EXCLAMATION_MARK))) {
730
756
  count += 1;
731
757
  }
732
758
  this.advance();
@@ -740,11 +766,11 @@ class RegExpValidator {
740
766
  this.onDisjunctionEnter(start);
741
767
  do {
742
768
  this.consumeAlternative(i++);
743
- } while (this.eat(VerticalLine));
769
+ } while (this.eat(VERTICAL_LINE));
744
770
  if (this.consumeQuantifier(true)) {
745
771
  this.raise("Nothing to repeat");
746
772
  }
747
- if (this.eat(LeftCurlyBracket)) {
773
+ if (this.eat(LEFT_CURLY_BRACKET)) {
748
774
  this.raise("Lone quantifier brackets");
749
775
  }
750
776
  this.onDisjunctionLeave(start, this.index);
@@ -773,30 +799,31 @@ class RegExpValidator {
773
799
  consumeAssertion() {
774
800
  const start = this.index;
775
801
  this._lastAssertionIsQuantifiable = false;
776
- if (this.eat(CircumflexAccent)) {
802
+ if (this.eat(CIRCUMFLEX_ACCENT)) {
777
803
  this.onEdgeAssertion(start, this.index, "start");
778
804
  return true;
779
805
  }
780
- if (this.eat(DollarSign)) {
806
+ if (this.eat(DOLLAR_SIGN)) {
781
807
  this.onEdgeAssertion(start, this.index, "end");
782
808
  return true;
783
809
  }
784
- if (this.eat2(ReverseSolidus, LatinCapitalLetterB)) {
810
+ if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) {
785
811
  this.onWordBoundaryAssertion(start, this.index, "word", true);
786
812
  return true;
787
813
  }
788
- if (this.eat2(ReverseSolidus, LatinSmallLetterB)) {
814
+ if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) {
789
815
  this.onWordBoundaryAssertion(start, this.index, "word", false);
790
816
  return true;
791
817
  }
792
- if (this.eat2(LeftParenthesis, QuestionMark)) {
793
- 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);
794
820
  let negate = false;
795
- if (this.eat(EqualsSign) || (negate = this.eat(ExclamationMark))) {
821
+ if (this.eat(EQUALS_SIGN) ||
822
+ (negate = this.eat(EXCLAMATION_MARK))) {
796
823
  const kind = lookbehind ? "lookbehind" : "lookahead";
797
824
  this.onLookaroundAssertionEnter(start, kind, negate);
798
825
  this.consumeDisjunction();
799
- if (!this.eat(RightParenthesis)) {
826
+ if (!this.eat(RIGHT_PARENTHESIS)) {
800
827
  this.raise("Unterminated group");
801
828
  }
802
829
  this._lastAssertionIsQuantifiable = !lookbehind && !this.strict;
@@ -812,15 +839,15 @@ class RegExpValidator {
812
839
  let min = 0;
813
840
  let max = 0;
814
841
  let greedy = false;
815
- if (this.eat(Asterisk)) {
842
+ if (this.eat(ASTERISK)) {
816
843
  min = 0;
817
844
  max = Number.POSITIVE_INFINITY;
818
845
  }
819
- else if (this.eat(PlusSign)) {
846
+ else if (this.eat(PLUS_SIGN)) {
820
847
  min = 1;
821
848
  max = Number.POSITIVE_INFINITY;
822
849
  }
823
- else if (this.eat(QuestionMark)) {
850
+ else if (this.eat(QUESTION_MARK)) {
824
851
  min = 0;
825
852
  max = 1;
826
853
  }
@@ -831,7 +858,7 @@ class RegExpValidator {
831
858
  else {
832
859
  return false;
833
860
  }
834
- greedy = !this.eat(QuestionMark);
861
+ greedy = !this.eat(QUESTION_MARK);
835
862
  if (!noConsume) {
836
863
  this.onQuantifier(start, this.index, min, max, greedy);
837
864
  }
@@ -839,17 +866,17 @@ class RegExpValidator {
839
866
  }
840
867
  eatBracedQuantifier(noError) {
841
868
  const start = this.index;
842
- if (this.eat(LeftCurlyBracket)) {
869
+ if (this.eat(LEFT_CURLY_BRACKET)) {
843
870
  this._lastMinValue = 0;
844
871
  this._lastMaxValue = Number.POSITIVE_INFINITY;
845
872
  if (this.eatDecimalDigits()) {
846
873
  this._lastMinValue = this._lastMaxValue = this._lastIntValue;
847
- if (this.eat(Comma)) {
874
+ if (this.eat(COMMA)) {
848
875
  this._lastMaxValue = this.eatDecimalDigits()
849
876
  ? this._lastIntValue
850
877
  : Number.POSITIVE_INFINITY;
851
878
  }
852
- if (this.eat(RightCurlyBracket)) {
879
+ if (this.eat(RIGHT_CURLY_BRACKET)) {
853
880
  if (!noError && this._lastMaxValue < this._lastMinValue) {
854
881
  this.raise("numbers out of order in {} quantifier");
855
882
  }
@@ -872,7 +899,7 @@ class RegExpValidator {
872
899
  this.consumeCapturingGroup());
873
900
  }
874
901
  consumeDot() {
875
- if (this.eat(FullStop)) {
902
+ if (this.eat(FULL_STOP)) {
876
903
  this.onAnyCharacterSet(this.index - 1, this.index, "any");
877
904
  return true;
878
905
  }
@@ -880,7 +907,7 @@ class RegExpValidator {
880
907
  }
881
908
  consumeReverseSolidusAtomEscape() {
882
909
  const start = this.index;
883
- if (this.eat(ReverseSolidus)) {
910
+ if (this.eat(REVERSE_SOLIDUS)) {
884
911
  if (this.consumeAtomEscape()) {
885
912
  return true;
886
913
  }
@@ -890,10 +917,10 @@ class RegExpValidator {
890
917
  }
891
918
  consumeUncapturingGroup() {
892
919
  const start = this.index;
893
- if (this.eat3(LeftParenthesis, QuestionMark, Colon)) {
920
+ if (this.eat3(LEFT_PARENTHESIS, QUESTION_MARK, COLON)) {
894
921
  this.onGroupEnter(start);
895
922
  this.consumeDisjunction();
896
- if (!this.eat(RightParenthesis)) {
923
+ if (!this.eat(RIGHT_PARENTHESIS)) {
897
924
  this.raise("Unterminated group");
898
925
  }
899
926
  this.onGroupLeave(start, this.index);
@@ -903,19 +930,19 @@ class RegExpValidator {
903
930
  }
904
931
  consumeCapturingGroup() {
905
932
  const start = this.index;
906
- if (this.eat(LeftParenthesis)) {
933
+ if (this.eat(LEFT_PARENTHESIS)) {
907
934
  let name = null;
908
935
  if (this.ecmaVersion >= 2018) {
909
936
  if (this.consumeGroupSpecifier()) {
910
937
  name = this._lastStrValue;
911
938
  }
912
939
  }
913
- else if (this.currentCodePoint === QuestionMark) {
940
+ else if (this.currentCodePoint === QUESTION_MARK) {
914
941
  this.raise("Invalid group");
915
942
  }
916
943
  this.onCapturingGroupEnter(start, name);
917
944
  this.consumeDisjunction();
918
- if (!this.eat(RightParenthesis)) {
945
+ if (!this.eat(RIGHT_PARENTHESIS)) {
919
946
  this.raise("Unterminated group");
920
947
  }
921
948
  this.onCapturingGroupLeave(start, this.index, name);
@@ -935,11 +962,11 @@ class RegExpValidator {
935
962
  }
936
963
  consumeReverseSolidusFollowedByC() {
937
964
  const start = this.index;
938
- if (this.currentCodePoint === ReverseSolidus &&
939
- this.nextCodePoint === LatinSmallLetterC) {
965
+ if (this.currentCodePoint === REVERSE_SOLIDUS &&
966
+ this.nextCodePoint === LATIN_SMALL_LETTER_C) {
940
967
  this._lastIntValue = this.currentCodePoint;
941
968
  this.advance();
942
- this.onCharacter(start, this.index, ReverseSolidus);
969
+ this.onCharacter(start, this.index, REVERSE_SOLIDUS);
943
970
  return true;
944
971
  }
945
972
  return false;
@@ -964,17 +991,17 @@ class RegExpValidator {
964
991
  const start = this.index;
965
992
  const cp = this.currentCodePoint;
966
993
  if (cp !== -1 &&
967
- cp !== CircumflexAccent &&
968
- cp !== DollarSign &&
969
- cp !== ReverseSolidus &&
970
- cp !== FullStop &&
971
- cp !== Asterisk &&
972
- cp !== PlusSign &&
973
- cp !== QuestionMark &&
974
- cp !== LeftParenthesis &&
975
- cp !== RightParenthesis &&
976
- cp !== LeftSquareBracket &&
977
- 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) {
978
1005
  this.advance();
979
1006
  this.onCharacter(start, this.index, cp);
980
1007
  return true;
@@ -982,7 +1009,7 @@ class RegExpValidator {
982
1009
  return false;
983
1010
  }
984
1011
  consumeGroupSpecifier() {
985
- if (this.eat(QuestionMark)) {
1012
+ if (this.eat(QUESTION_MARK)) {
986
1013
  if (this.eatGroupName()) {
987
1014
  if (!this._groupNames.has(this._lastStrValue)) {
988
1015
  this._groupNames.add(this._lastStrValue);
@@ -1023,32 +1050,32 @@ class RegExpValidator {
1023
1050
  }
1024
1051
  consumeCharacterClassEscape() {
1025
1052
  const start = this.index;
1026
- if (this.eat(LatinSmallLetterD)) {
1053
+ if (this.eat(LATIN_SMALL_LETTER_D)) {
1027
1054
  this._lastIntValue = -1;
1028
1055
  this.onEscapeCharacterSet(start - 1, this.index, "digit", false);
1029
1056
  return true;
1030
1057
  }
1031
- if (this.eat(LatinCapitalLetterD)) {
1058
+ if (this.eat(LATIN_CAPITAL_LETTER_D)) {
1032
1059
  this._lastIntValue = -1;
1033
1060
  this.onEscapeCharacterSet(start - 1, this.index, "digit", true);
1034
1061
  return true;
1035
1062
  }
1036
- if (this.eat(LatinSmallLetterS)) {
1063
+ if (this.eat(LATIN_SMALL_LETTER_S)) {
1037
1064
  this._lastIntValue = -1;
1038
1065
  this.onEscapeCharacterSet(start - 1, this.index, "space", false);
1039
1066
  return true;
1040
1067
  }
1041
- if (this.eat(LatinCapitalLetterS)) {
1068
+ if (this.eat(LATIN_CAPITAL_LETTER_S)) {
1042
1069
  this._lastIntValue = -1;
1043
1070
  this.onEscapeCharacterSet(start - 1, this.index, "space", true);
1044
1071
  return true;
1045
1072
  }
1046
- if (this.eat(LatinSmallLetterW)) {
1073
+ if (this.eat(LATIN_SMALL_LETTER_W)) {
1047
1074
  this._lastIntValue = -1;
1048
1075
  this.onEscapeCharacterSet(start - 1, this.index, "word", false);
1049
1076
  return true;
1050
1077
  }
1051
- if (this.eat(LatinCapitalLetterW)) {
1078
+ if (this.eat(LATIN_CAPITAL_LETTER_W)) {
1052
1079
  this._lastIntValue = -1;
1053
1080
  this.onEscapeCharacterSet(start - 1, this.index, "word", true);
1054
1081
  return true;
@@ -1056,12 +1083,12 @@ class RegExpValidator {
1056
1083
  let negate = false;
1057
1084
  if (this._uFlag &&
1058
1085
  this.ecmaVersion >= 2018 &&
1059
- (this.eat(LatinSmallLetterP) ||
1060
- (negate = this.eat(LatinCapitalLetterP)))) {
1086
+ (this.eat(LATIN_SMALL_LETTER_P) ||
1087
+ (negate = this.eat(LATIN_CAPITAL_LETTER_P)))) {
1061
1088
  this._lastIntValue = -1;
1062
- if (this.eat(LeftCurlyBracket) &&
1089
+ if (this.eat(LEFT_CURLY_BRACKET) &&
1063
1090
  this.eatUnicodePropertyValueExpression() &&
1064
- this.eat(RightCurlyBracket)) {
1091
+ this.eat(RIGHT_CURLY_BRACKET)) {
1065
1092
  this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", this._lastKeyValue, this._lastValValue || null, negate);
1066
1093
  return true;
1067
1094
  }
@@ -1087,7 +1114,7 @@ class RegExpValidator {
1087
1114
  }
1088
1115
  consumeKGroupName() {
1089
1116
  const start = this.index;
1090
- if (this.eat(LatinSmallLetterK)) {
1117
+ if (this.eat(LATIN_SMALL_LETTER_K)) {
1091
1118
  if (this.eatGroupName()) {
1092
1119
  const groupName = this._lastStrValue;
1093
1120
  this._backreferenceNames.add(groupName);
@@ -1100,11 +1127,11 @@ class RegExpValidator {
1100
1127
  }
1101
1128
  consumeCharacterClass() {
1102
1129
  const start = this.index;
1103
- if (this.eat(LeftSquareBracket)) {
1104
- const negate = this.eat(CircumflexAccent);
1130
+ if (this.eat(LEFT_SQUARE_BRACKET)) {
1131
+ const negate = this.eat(CIRCUMFLEX_ACCENT);
1105
1132
  this.onCharacterClassEnter(start, negate);
1106
1133
  this.consumeClassRanges();
1107
- if (!this.eat(RightSquareBracket)) {
1134
+ if (!this.eat(RIGHT_SQUARE_BRACKET)) {
1108
1135
  this.raise("Unterminated character class");
1109
1136
  }
1110
1137
  this.onCharacterClassLeave(start, this.index, negate);
@@ -1120,10 +1147,10 @@ class RegExpValidator {
1120
1147
  break;
1121
1148
  }
1122
1149
  const min = this._lastIntValue;
1123
- if (!this.eat(HyphenMinus)) {
1150
+ if (!this.eat(HYPHEN_MINUS)) {
1124
1151
  continue;
1125
1152
  }
1126
- this.onCharacter(this.index - 1, this.index, HyphenMinus);
1153
+ this.onCharacter(this.index - 1, this.index, HYPHEN_MINUS);
1127
1154
  if (!this.consumeClassAtom()) {
1128
1155
  break;
1129
1156
  }
@@ -1143,18 +1170,21 @@ class RegExpValidator {
1143
1170
  consumeClassAtom() {
1144
1171
  const start = this.index;
1145
1172
  const cp = this.currentCodePoint;
1146
- if (cp !== -1 && cp !== ReverseSolidus && cp !== RightSquareBracket) {
1173
+ if (cp !== -1 &&
1174
+ cp !== REVERSE_SOLIDUS &&
1175
+ cp !== RIGHT_SQUARE_BRACKET) {
1147
1176
  this.advance();
1148
1177
  this._lastIntValue = cp;
1149
1178
  this.onCharacter(start, this.index, this._lastIntValue);
1150
1179
  return true;
1151
1180
  }
1152
- if (this.eat(ReverseSolidus)) {
1181
+ if (this.eat(REVERSE_SOLIDUS)) {
1153
1182
  if (this.consumeClassEscape()) {
1154
1183
  return true;
1155
1184
  }
1156
- if (!this.strict && this.currentCodePoint === LatinSmallLetterC) {
1157
- this._lastIntValue = ReverseSolidus;
1185
+ if (!this.strict &&
1186
+ this.currentCodePoint === LATIN_SMALL_LETTER_C) {
1187
+ this._lastIntValue = REVERSE_SOLIDUS;
1158
1188
  this.onCharacter(start, this.index, this._lastIntValue);
1159
1189
  return true;
1160
1190
  }
@@ -1167,21 +1197,21 @@ class RegExpValidator {
1167
1197
  }
1168
1198
  consumeClassEscape() {
1169
1199
  const start = this.index;
1170
- if (this.eat(LatinSmallLetterB)) {
1171
- this._lastIntValue = Backspace;
1200
+ if (this.eat(LATIN_SMALL_LETTER_B)) {
1201
+ this._lastIntValue = BACKSPACE;
1172
1202
  this.onCharacter(start - 1, this.index, this._lastIntValue);
1173
1203
  return true;
1174
1204
  }
1175
- if (this._uFlag && this.eat(HyphenMinus)) {
1176
- this._lastIntValue = HyphenMinus;
1205
+ if (this._uFlag && this.eat(HYPHEN_MINUS)) {
1206
+ this._lastIntValue = HYPHEN_MINUS;
1177
1207
  this.onCharacter(start - 1, this.index, this._lastIntValue);
1178
1208
  return true;
1179
1209
  }
1180
1210
  let cp = 0;
1181
1211
  if (!this.strict &&
1182
1212
  !this._uFlag &&
1183
- this.currentCodePoint === LatinSmallLetterC &&
1184
- (isDecimalDigit((cp = this.nextCodePoint)) || cp === LowLine)) {
1213
+ this.currentCodePoint === LATIN_SMALL_LETTER_C &&
1214
+ (isDecimalDigit((cp = this.nextCodePoint)) || cp === LOW_LINE)) {
1185
1215
  this.advance();
1186
1216
  this.advance();
1187
1217
  this._lastIntValue = cp % 0x20;
@@ -1191,8 +1221,8 @@ class RegExpValidator {
1191
1221
  return (this.consumeCharacterClassEscape() || this.consumeCharacterEscape());
1192
1222
  }
1193
1223
  eatGroupName() {
1194
- if (this.eat(LessThanSign)) {
1195
- if (this.eatRegExpIdentifierName() && this.eat(GreaterThanSign)) {
1224
+ if (this.eat(LESS_THAN_SIGN)) {
1225
+ if (this.eatRegExpIdentifierName() && this.eat(GREATER_THAN_SIGN)) {
1196
1226
  return true;
1197
1227
  }
1198
1228
  this.raise("Invalid capture group name");
@@ -1214,7 +1244,7 @@ class RegExpValidator {
1214
1244
  const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020;
1215
1245
  let cp = this.currentCodePoint;
1216
1246
  this.advance();
1217
- if (cp === ReverseSolidus &&
1247
+ if (cp === REVERSE_SOLIDUS &&
1218
1248
  this.eatRegExpUnicodeEscapeSequence(forceUFlag)) {
1219
1249
  cp = this._lastIntValue;
1220
1250
  }
@@ -1238,7 +1268,7 @@ class RegExpValidator {
1238
1268
  const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020;
1239
1269
  let cp = this.currentCodePoint;
1240
1270
  this.advance();
1241
- if (cp === ReverseSolidus &&
1271
+ if (cp === REVERSE_SOLIDUS &&
1242
1272
  this.eatRegExpUnicodeEscapeSequence(forceUFlag)) {
1243
1273
  cp = this._lastIntValue;
1244
1274
  }
@@ -1259,7 +1289,7 @@ class RegExpValidator {
1259
1289
  }
1260
1290
  eatCControlLetter() {
1261
1291
  const start = this.index;
1262
- if (this.eat(LatinSmallLetterC)) {
1292
+ if (this.eat(LATIN_SMALL_LETTER_C)) {
1263
1293
  if (this.eatControlLetter()) {
1264
1294
  return true;
1265
1295
  }
@@ -1268,7 +1298,7 @@ class RegExpValidator {
1268
1298
  return false;
1269
1299
  }
1270
1300
  eatZero() {
1271
- if (this.currentCodePoint === DigitZero &&
1301
+ if (this.currentCodePoint === DIGIT_ZERO &&
1272
1302
  !isDecimalDigit(this.nextCodePoint)) {
1273
1303
  this._lastIntValue = 0;
1274
1304
  this.advance();
@@ -1277,24 +1307,24 @@ class RegExpValidator {
1277
1307
  return false;
1278
1308
  }
1279
1309
  eatControlEscape() {
1280
- if (this.eat(LatinSmallLetterF)) {
1281
- this._lastIntValue = FormFeed;
1310
+ if (this.eat(LATIN_SMALL_LETTER_F)) {
1311
+ this._lastIntValue = FORM_FEED;
1282
1312
  return true;
1283
1313
  }
1284
- if (this.eat(LatinSmallLetterN)) {
1285
- this._lastIntValue = LineFeed;
1314
+ if (this.eat(LATIN_SMALL_LETTER_N)) {
1315
+ this._lastIntValue = LINE_FEED;
1286
1316
  return true;
1287
1317
  }
1288
- if (this.eat(LatinSmallLetterR)) {
1289
- this._lastIntValue = CarriageReturn;
1318
+ if (this.eat(LATIN_SMALL_LETTER_R)) {
1319
+ this._lastIntValue = CARRIAGE_RETURN;
1290
1320
  return true;
1291
1321
  }
1292
- if (this.eat(LatinSmallLetterT)) {
1293
- this._lastIntValue = CharacterTabulation;
1322
+ if (this.eat(LATIN_SMALL_LETTER_T)) {
1323
+ this._lastIntValue = CHARACTER_TABULATION;
1294
1324
  return true;
1295
1325
  }
1296
- if (this.eat(LatinSmallLetterV)) {
1297
- this._lastIntValue = LineTabulation;
1326
+ if (this.eat(LATIN_SMALL_LETTER_V)) {
1327
+ this._lastIntValue = LINE_TABULATION;
1298
1328
  return true;
1299
1329
  }
1300
1330
  return false;
@@ -1311,7 +1341,7 @@ class RegExpValidator {
1311
1341
  eatRegExpUnicodeEscapeSequence(forceUFlag = false) {
1312
1342
  const start = this.index;
1313
1343
  const uFlag = forceUFlag || this._uFlag;
1314
- if (this.eat(LatinSmallLetterU)) {
1344
+ if (this.eat(LATIN_SMALL_LETTER_U)) {
1315
1345
  if ((uFlag && this.eatRegExpUnicodeSurrogatePairEscape()) ||
1316
1346
  this.eatFixedHexDigits(4) ||
1317
1347
  (uFlag && this.eatRegExpUnicodeCodePointEscape())) {
@@ -1329,8 +1359,8 @@ class RegExpValidator {
1329
1359
  if (this.eatFixedHexDigits(4)) {
1330
1360
  const lead = this._lastIntValue;
1331
1361
  if (isLeadSurrogate(lead) &&
1332
- this.eat(ReverseSolidus) &&
1333
- this.eat(LatinSmallLetterU) &&
1362
+ this.eat(REVERSE_SOLIDUS) &&
1363
+ this.eat(LATIN_SMALL_LETTER_U) &&
1334
1364
  this.eatFixedHexDigits(4)) {
1335
1365
  const trail = this._lastIntValue;
1336
1366
  if (isTrailSurrogate(trail)) {
@@ -1344,9 +1374,9 @@ class RegExpValidator {
1344
1374
  }
1345
1375
  eatRegExpUnicodeCodePointEscape() {
1346
1376
  const start = this.index;
1347
- if (this.eat(LeftCurlyBracket) &&
1377
+ if (this.eat(LEFT_CURLY_BRACKET) &&
1348
1378
  this.eatHexDigits() &&
1349
- this.eat(RightCurlyBracket) &&
1379
+ this.eat(RIGHT_CURLY_BRACKET) &&
1350
1380
  isValidUnicode(this._lastIntValue)) {
1351
1381
  return true;
1352
1382
  }
@@ -1367,32 +1397,32 @@ class RegExpValidator {
1367
1397
  return false;
1368
1398
  }
1369
1399
  if (this._uFlag) {
1370
- return isSyntaxCharacter(cp) || cp === Solidus;
1400
+ return isSyntaxCharacter(cp) || cp === SOLIDUS;
1371
1401
  }
1372
1402
  if (this.strict) {
1373
1403
  return !isIdContinue(cp);
1374
1404
  }
1375
1405
  if (this._nFlag) {
1376
- return !(cp === LatinSmallLetterC || cp === LatinSmallLetterK);
1406
+ return !(cp === LATIN_SMALL_LETTER_C || cp === LATIN_SMALL_LETTER_K);
1377
1407
  }
1378
- return cp !== LatinSmallLetterC;
1408
+ return cp !== LATIN_SMALL_LETTER_C;
1379
1409
  }
1380
1410
  eatDecimalEscape() {
1381
1411
  this._lastIntValue = 0;
1382
1412
  let cp = this.currentCodePoint;
1383
- if (cp >= DigitOne && cp <= DigitNine) {
1413
+ if (cp >= DIGIT_ONE && cp <= DIGIT_NINE) {
1384
1414
  do {
1385
- this._lastIntValue = 10 * this._lastIntValue + (cp - DigitZero);
1415
+ this._lastIntValue = 10 * this._lastIntValue + (cp - DIGIT_ZERO);
1386
1416
  this.advance();
1387
- } while ((cp = this.currentCodePoint) >= DigitZero &&
1388
- cp <= DigitNine);
1417
+ } while ((cp = this.currentCodePoint) >= DIGIT_ZERO &&
1418
+ cp <= DIGIT_NINE);
1389
1419
  return true;
1390
1420
  }
1391
1421
  return false;
1392
1422
  }
1393
1423
  eatUnicodePropertyValueExpression() {
1394
1424
  const start = this.index;
1395
- if (this.eatUnicodePropertyName() && this.eat(EqualsSign)) {
1425
+ if (this.eatUnicodePropertyName() && this.eat(EQUALS_SIGN)) {
1396
1426
  this._lastKeyValue = this._lastStrValue;
1397
1427
  if (this.eatUnicodePropertyValue()) {
1398
1428
  this._lastValValue = this._lastStrValue;
@@ -1440,7 +1470,7 @@ class RegExpValidator {
1440
1470
  }
1441
1471
  eatHexEscapeSequence() {
1442
1472
  const start = this.index;
1443
- if (this.eat(LatinSmallLetterX)) {
1473
+ if (this.eat(LATIN_SMALL_LETTER_X)) {
1444
1474
  if (this.eatFixedHexDigits(2)) {
1445
1475
  return true;
1446
1476
  }
@@ -1494,7 +1524,7 @@ class RegExpValidator {
1494
1524
  const cp = this.currentCodePoint;
1495
1525
  if (isOctalDigit(cp)) {
1496
1526
  this.advance();
1497
- this._lastIntValue = cp - DigitZero;
1527
+ this._lastIntValue = cp - DIGIT_ZERO;
1498
1528
  return true;
1499
1529
  }
1500
1530
  this._lastIntValue = 0;
@@ -1516,14 +1546,14 @@ class RegExpValidator {
1516
1546
  }
1517
1547
  }
1518
1548
 
1519
- const DummyPattern = {};
1520
- const DummyFlags = {};
1521
- const DummyCapturingGroup = {};
1549
+ const DUMMY_PATTERN = {};
1550
+ const DUMMY_FLAGS = {};
1551
+ const DUMMY_CAPTURING_GROUP = {};
1522
1552
  class RegExpParserState {
1523
1553
  constructor(options) {
1524
1554
  var _a;
1525
- this._node = DummyPattern;
1526
- this._flags = DummyFlags;
1555
+ this._node = DUMMY_PATTERN;
1556
+ this._flags = DUMMY_FLAGS;
1527
1557
  this._backreferences = [];
1528
1558
  this._capturingGroups = [];
1529
1559
  this.source = "";
@@ -1542,7 +1572,7 @@ class RegExpParserState {
1542
1572
  }
1543
1573
  return this._flags;
1544
1574
  }
1545
- onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) {
1575
+ onRegExpFlags(start, end, { global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices, }) {
1546
1576
  this._flags = {
1547
1577
  type: "Flags",
1548
1578
  parent: null,
@@ -1813,7 +1843,7 @@ class RegExpParserState {
1813
1843
  end,
1814
1844
  raw: this.source.slice(start, end),
1815
1845
  ref,
1816
- resolved: DummyCapturingGroup,
1846
+ resolved: DUMMY_CAPTURING_GROUP,
1817
1847
  };
1818
1848
  parent.elements.push(node);
1819
1849
  this._backreferences.push(node);
@@ -1859,7 +1889,7 @@ class RegExpParserState {
1859
1889
  min.type !== "Character" ||
1860
1890
  max.type !== "Character" ||
1861
1891
  hyphen.type !== "Character" ||
1862
- hyphen.value !== HyphenMinus) {
1892
+ hyphen.value !== HYPHEN_MINUS) {
1863
1893
  throw new Error("UnknownError");
1864
1894
  }
1865
1895
  const node = {