@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.mjs CHANGED
@@ -68,11 +68,13 @@ function restoreRanges(data) {
68
68
  }
69
69
 
70
70
  class DataSet {
71
- constructor(raw2018, raw2019, raw2020, raw2021) {
71
+ constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023) {
72
72
  this._raw2018 = raw2018;
73
73
  this._raw2019 = raw2019;
74
74
  this._raw2020 = raw2020;
75
75
  this._raw2021 = raw2021;
76
+ this._raw2022 = raw2022;
77
+ this._raw2023 = raw2023;
76
78
  }
77
79
  get es2018() {
78
80
  var _a;
@@ -90,12 +92,20 @@ class DataSet {
90
92
  var _a;
91
93
  return ((_a = this._set2021) !== null && _a !== void 0 ? _a : (this._set2021 = new Set(this._raw2021.split(" "))));
92
94
  }
95
+ get es2022() {
96
+ var _a;
97
+ return ((_a = this._set2022) !== null && _a !== void 0 ? _a : (this._set2022 = new Set(this._raw2022.split(" "))));
98
+ }
99
+ get es2023() {
100
+ var _a;
101
+ return ((_a = this._set2023) !== null && _a !== void 0 ? _a : (this._set2023 = new Set(this._raw2023.split(" "))));
102
+ }
93
103
  }
94
104
  const gcNameSet = new Set(["General_Category", "gc"]);
95
105
  const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]);
96
- 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", "", "", "");
97
- 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");
98
- 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");
106
+ 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", "", "", "", "", "");
107
+ 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", "");
108
+ 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", "", "");
99
109
  function isValidUnicodeProperty(version, name, value) {
100
110
  if (gcNameSet.has(name)) {
101
111
  return version >= 2018 && gcValueSets.es2018.has(value);
@@ -104,7 +114,8 @@ function isValidUnicodeProperty(version, name, value) {
104
114
  return ((version >= 2018 && scValueSets.es2018.has(value)) ||
105
115
  (version >= 2019 && scValueSets.es2019.has(value)) ||
106
116
  (version >= 2020 && scValueSets.es2020.has(value)) ||
107
- (version >= 2021 && scValueSets.es2021.has(value)));
117
+ (version >= 2021 && scValueSets.es2021.has(value)) ||
118
+ (version >= 2022 && scValueSets.es2022.has(value)));
108
119
  }
109
120
  return false;
110
121
  }
@@ -114,105 +125,105 @@ function isValidLoneUnicodeProperty(version, value) {
114
125
  (version >= 2021 && binPropertySets.es2021.has(value)));
115
126
  }
116
127
 
117
- const Backspace = 0x08;
118
- const CharacterTabulation = 0x09;
119
- const LineFeed = 0x0a;
120
- const LineTabulation = 0x0b;
121
- const FormFeed = 0x0c;
122
- const CarriageReturn = 0x0d;
123
- const ExclamationMark = 0x21;
124
- const DollarSign = 0x24;
125
- const LeftParenthesis = 0x28;
126
- const RightParenthesis = 0x29;
127
- const Asterisk = 0x2a;
128
- const PlusSign = 0x2b;
129
- const Comma = 0x2c;
130
- const HyphenMinus = 0x2d;
131
- const FullStop = 0x2e;
132
- const Solidus = 0x2f;
133
- const DigitZero = 0x30;
134
- const DigitOne = 0x31;
135
- const DigitSeven = 0x37;
136
- const DigitNine = 0x39;
137
- const Colon = 0x3a;
138
- const LessThanSign = 0x3c;
139
- const EqualsSign = 0x3d;
140
- const GreaterThanSign = 0x3e;
141
- const QuestionMark = 0x3f;
142
- const LatinCapitalLetterA = 0x41;
143
- const LatinCapitalLetterB = 0x42;
144
- const LatinCapitalLetterD = 0x44;
145
- const LatinCapitalLetterF = 0x46;
146
- const LatinCapitalLetterP = 0x50;
147
- const LatinCapitalLetterS = 0x53;
148
- const LatinCapitalLetterW = 0x57;
149
- const LatinCapitalLetterZ = 0x5a;
150
- const LowLine = 0x5f;
151
- const LatinSmallLetterA = 0x61;
152
- const LatinSmallLetterB = 0x62;
153
- const LatinSmallLetterC = 0x63;
154
- const LatinSmallLetterD = 0x64;
155
- const LatinSmallLetterF = 0x66;
156
- const LatinSmallLetterG = 0x67;
157
- const LatinSmallLetterI = 0x69;
158
- const LatinSmallLetterK = 0x6b;
159
- const LatinSmallLetterM = 0x6d;
160
- const LatinSmallLetterN = 0x6e;
161
- const LatinSmallLetterP = 0x70;
162
- const LatinSmallLetterR = 0x72;
163
- const LatinSmallLetterS = 0x73;
164
- const LatinSmallLetterT = 0x74;
165
- const LatinSmallLetterU = 0x75;
166
- const LatinSmallLetterV = 0x76;
167
- const LatinSmallLetterW = 0x77;
168
- const LatinSmallLetterX = 0x78;
169
- const LatinSmallLetterY = 0x79;
170
- const LatinSmallLetterZ = 0x7a;
171
- const LeftSquareBracket = 0x5b;
172
- const ReverseSolidus = 0x5c;
173
- const RightSquareBracket = 0x5d;
174
- const CircumflexAccent = 0x5e;
175
- const LeftCurlyBracket = 0x7b;
176
- const VerticalLine = 0x7c;
177
- const RightCurlyBracket = 0x7d;
178
- const ZeroWidthNonJoiner = 0x200c;
179
- const ZeroWidthJoiner = 0x200d;
180
- const LineSeparator = 0x2028;
181
- const ParagraphSeparator = 0x2029;
182
- const MinCodePoint = 0x00;
183
- const MaxCodePoint = 0x10ffff;
128
+ const BACKSPACE = 0x08;
129
+ const CHARACTER_TABULATION = 0x09;
130
+ const LINE_FEED = 0x0a;
131
+ const LINE_TABULATION = 0x0b;
132
+ const FORM_FEED = 0x0c;
133
+ const CARRIAGE_RETURN = 0x0d;
134
+ const EXCLAMATION_MARK = 0x21;
135
+ const DOLLAR_SIGN = 0x24;
136
+ const LEFT_PARENTHESIS = 0x28;
137
+ const RIGHT_PARENTHESIS = 0x29;
138
+ const ASTERISK = 0x2a;
139
+ const PLUS_SIGN = 0x2b;
140
+ const COMMA = 0x2c;
141
+ const HYPHEN_MINUS = 0x2d;
142
+ const FULL_STOP = 0x2e;
143
+ const SOLIDUS = 0x2f;
144
+ const DIGIT_ZERO = 0x30;
145
+ const DIGIT_ONE = 0x31;
146
+ const DIGIT_SEVEN = 0x37;
147
+ const DIGIT_NINE = 0x39;
148
+ const COLON = 0x3a;
149
+ const LESS_THAN_SIGN = 0x3c;
150
+ const EQUALS_SIGN = 0x3d;
151
+ const GREATER_THAN_SIGN = 0x3e;
152
+ const QUESTION_MARK = 0x3f;
153
+ const LATIN_CAPITAL_LETTER_A = 0x41;
154
+ const LATIN_CAPITAL_LETTER_B = 0x42;
155
+ const LATIN_CAPITAL_LETTER_D = 0x44;
156
+ const LATIN_CAPITAL_LETTER_F = 0x46;
157
+ const LATIN_CAPITAL_LETTER_P = 0x50;
158
+ const LATIN_CAPITAL_LETTER_S = 0x53;
159
+ const LATIN_CAPITAL_LETTER_W = 0x57;
160
+ const LATIN_CAPITAL_LETTER_Z = 0x5a;
161
+ const LOW_LINE = 0x5f;
162
+ const LATIN_SMALL_LETTER_A = 0x61;
163
+ const LATIN_SMALL_LETTER_B = 0x62;
164
+ const LATIN_SMALL_LETTER_C = 0x63;
165
+ const LATIN_SMALL_LETTER_D = 0x64;
166
+ const LATIN_SMALL_LETTER_F = 0x66;
167
+ const LATIN_SMALL_LETTER_G = 0x67;
168
+ const LATIN_SMALL_LETTER_I = 0x69;
169
+ const LATIN_SMALL_LETTER_K = 0x6b;
170
+ const LATIN_SMALL_LETTER_M = 0x6d;
171
+ const LATIN_SMALL_LETTER_N = 0x6e;
172
+ const LATIN_SMALL_LETTER_P = 0x70;
173
+ const LATIN_SMALL_LETTER_R = 0x72;
174
+ const LATIN_SMALL_LETTER_S = 0x73;
175
+ const LATIN_SMALL_LETTER_T = 0x74;
176
+ const LATIN_SMALL_LETTER_U = 0x75;
177
+ const LATIN_SMALL_LETTER_V = 0x76;
178
+ const LATIN_SMALL_LETTER_W = 0x77;
179
+ const LATIN_SMALL_LETTER_X = 0x78;
180
+ const LATIN_SMALL_LETTER_Y = 0x79;
181
+ const LATIN_SMALL_LETTER_Z = 0x7a;
182
+ const LEFT_SQUARE_BRACKET = 0x5b;
183
+ const REVERSE_SOLIDUS = 0x5c;
184
+ const RIGHT_SQUARE_BRACKET = 0x5d;
185
+ const CIRCUMFLEX_ACCENT = 0x5e;
186
+ const LEFT_CURLY_BRACKET = 0x7b;
187
+ const VERTICAL_LINE = 0x7c;
188
+ const RIGHT_CURLY_BRACKET = 0x7d;
189
+ const ZERO_WIDTH_NON_JOINER = 0x200c;
190
+ const ZERO_WIDTH_JOINER = 0x200d;
191
+ const LINE_SEPARATOR = 0x2028;
192
+ const PARAGRAPH_SEPARATOR = 0x2029;
193
+ const MIN_CODE_POINT = 0x00;
194
+ const MAX_CODE_POINT = 0x10ffff;
184
195
  function isLatinLetter(code) {
185
- return ((code >= LatinCapitalLetterA && code <= LatinCapitalLetterZ) ||
186
- (code >= LatinSmallLetterA && code <= LatinSmallLetterZ));
196
+ return ((code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_Z) ||
197
+ (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_Z));
187
198
  }
188
199
  function isDecimalDigit(code) {
189
- return code >= DigitZero && code <= DigitNine;
200
+ return code >= DIGIT_ZERO && code <= DIGIT_NINE;
190
201
  }
191
202
  function isOctalDigit(code) {
192
- return code >= DigitZero && code <= DigitSeven;
203
+ return code >= DIGIT_ZERO && code <= DIGIT_SEVEN;
193
204
  }
194
205
  function isHexDigit(code) {
195
- return ((code >= DigitZero && code <= DigitNine) ||
196
- (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) ||
197
- (code >= LatinSmallLetterA && code <= LatinSmallLetterF));
206
+ return ((code >= DIGIT_ZERO && code <= DIGIT_NINE) ||
207
+ (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) ||
208
+ (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F));
198
209
  }
199
210
  function isLineTerminator(code) {
200
- return (code === LineFeed ||
201
- code === CarriageReturn ||
202
- code === LineSeparator ||
203
- code === ParagraphSeparator);
211
+ return (code === LINE_FEED ||
212
+ code === CARRIAGE_RETURN ||
213
+ code === LINE_SEPARATOR ||
214
+ code === PARAGRAPH_SEPARATOR);
204
215
  }
205
216
  function isValidUnicode(code) {
206
- return code >= MinCodePoint && code <= MaxCodePoint;
217
+ return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT;
207
218
  }
208
219
  function digitToInt(code) {
209
- if (code >= LatinSmallLetterA && code <= LatinSmallLetterF) {
210
- return code - LatinSmallLetterA + 10;
220
+ if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) {
221
+ return code - LATIN_SMALL_LETTER_A + 10;
211
222
  }
212
- if (code >= LatinCapitalLetterA && code <= LatinCapitalLetterF) {
213
- return code - LatinCapitalLetterA + 10;
223
+ if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) {
224
+ return code - LATIN_CAPITAL_LETTER_A + 10;
214
225
  }
215
- return code - DigitZero;
226
+ return code - DIGIT_ZERO;
216
227
  }
217
228
  function isLeadSurrogate(code) {
218
229
  return code >= 0xd800 && code <= 0xdbff;
@@ -342,33 +353,33 @@ class RegExpSyntaxError extends SyntaxError {
342
353
  }
343
354
 
344
355
  function isSyntaxCharacter(cp) {
345
- return (cp === CircumflexAccent ||
346
- cp === DollarSign ||
347
- cp === ReverseSolidus ||
348
- cp === FullStop ||
349
- cp === Asterisk ||
350
- cp === PlusSign ||
351
- cp === QuestionMark ||
352
- cp === LeftParenthesis ||
353
- cp === RightParenthesis ||
354
- cp === LeftSquareBracket ||
355
- cp === RightSquareBracket ||
356
- cp === LeftCurlyBracket ||
357
- cp === RightCurlyBracket ||
358
- cp === VerticalLine);
356
+ return (cp === CIRCUMFLEX_ACCENT ||
357
+ cp === DOLLAR_SIGN ||
358
+ cp === REVERSE_SOLIDUS ||
359
+ cp === FULL_STOP ||
360
+ cp === ASTERISK ||
361
+ cp === PLUS_SIGN ||
362
+ cp === QUESTION_MARK ||
363
+ cp === LEFT_PARENTHESIS ||
364
+ cp === RIGHT_PARENTHESIS ||
365
+ cp === LEFT_SQUARE_BRACKET ||
366
+ cp === RIGHT_SQUARE_BRACKET ||
367
+ cp === LEFT_CURLY_BRACKET ||
368
+ cp === RIGHT_CURLY_BRACKET ||
369
+ cp === VERTICAL_LINE);
359
370
  }
360
371
  function isRegExpIdentifierStart(cp) {
361
- return isIdStart(cp) || cp === DollarSign || cp === LowLine;
372
+ return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE;
362
373
  }
363
374
  function isRegExpIdentifierPart(cp) {
364
375
  return (isIdContinue(cp) ||
365
- cp === DollarSign ||
366
- cp === LowLine ||
367
- cp === ZeroWidthNonJoiner ||
368
- cp === ZeroWidthJoiner);
376
+ cp === DOLLAR_SIGN ||
377
+ cp === LOW_LINE ||
378
+ cp === ZERO_WIDTH_NON_JOINER ||
379
+ cp === ZERO_WIDTH_JOINER);
369
380
  }
370
381
  function isUnicodePropertyNameCharacter(cp) {
371
- return isLatinLetter(cp) || cp === LowLine;
382
+ return isLatinLetter(cp) || cp === LOW_LINE;
372
383
  }
373
384
  function isUnicodePropertyValueCharacter(cp) {
374
385
  return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp);
@@ -394,7 +405,7 @@ class RegExpValidator {
394
405
  this._uFlag = this._nFlag = false;
395
406
  this.reset(source, start, end);
396
407
  this.onLiteralEnter(start);
397
- if (this.eat(Solidus) && this.eatRegExpBody() && this.eat(Solidus)) {
408
+ if (this.eat(SOLIDUS) && this.eatRegExpBody() && this.eat(SOLIDUS)) {
398
409
  const flagStart = this.index;
399
410
  const uFlag = source.includes("u", flagStart);
400
411
  this.validateFlags(source, flagStart, end);
@@ -424,32 +435,44 @@ class RegExpValidator {
424
435
  this.raise(`Duplicated flag '${source[i]}'`);
425
436
  }
426
437
  existingFlags.add(flag);
427
- if (flag === LatinSmallLetterG) {
438
+ if (flag === LATIN_SMALL_LETTER_G) {
428
439
  global = true;
429
440
  }
430
- else if (flag === LatinSmallLetterI) {
441
+ else if (flag === LATIN_SMALL_LETTER_I) {
431
442
  ignoreCase = true;
432
443
  }
433
- else if (flag === LatinSmallLetterM) {
444
+ else if (flag === LATIN_SMALL_LETTER_M) {
434
445
  multiline = true;
435
446
  }
436
- else if (flag === LatinSmallLetterU && this.ecmaVersion >= 2015) {
447
+ else if (flag === LATIN_SMALL_LETTER_U &&
448
+ this.ecmaVersion >= 2015) {
437
449
  unicode = true;
438
450
  }
439
- else if (flag === LatinSmallLetterY && this.ecmaVersion >= 2015) {
451
+ else if (flag === LATIN_SMALL_LETTER_Y &&
452
+ this.ecmaVersion >= 2015) {
440
453
  sticky = true;
441
454
  }
442
- else if (flag === LatinSmallLetterS && this.ecmaVersion >= 2018) {
455
+ else if (flag === LATIN_SMALL_LETTER_S &&
456
+ this.ecmaVersion >= 2018) {
443
457
  dotAll = true;
444
458
  }
445
- else if (flag === LatinSmallLetterD && this.ecmaVersion >= 2022) {
459
+ else if (flag === LATIN_SMALL_LETTER_D &&
460
+ this.ecmaVersion >= 2022) {
446
461
  hasIndices = true;
447
462
  }
448
463
  else {
449
464
  this.raise(`Invalid flag '${source[i]}'`);
450
465
  }
451
466
  }
452
- this.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices);
467
+ this.onRegExpFlags(start, end, {
468
+ global,
469
+ ignoreCase,
470
+ multiline,
471
+ unicode,
472
+ sticky,
473
+ dotAll,
474
+ hasIndices,
475
+ });
453
476
  }
454
477
  validatePattern(source, start = 0, end = source.length, uFlag = false) {
455
478
  this._uFlag = uFlag && this.ecmaVersion >= 2015;
@@ -481,9 +504,12 @@ class RegExpValidator {
481
504
  this._options.onLiteralLeave(start, end);
482
505
  }
483
506
  }
484
- onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) {
507
+ onRegExpFlags(start, end, flags) {
508
+ if (this._options.onRegExpFlags) {
509
+ this._options.onRegExpFlags(start, end, flags);
510
+ }
485
511
  if (this._options.onFlags) {
486
- this._options.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices);
512
+ this._options.onFlags(start, end, flags.global, flags.ignoreCase, flags.multiline, flags.unicode, flags.sticky, flags.dotAll, flags.hasIndices);
487
513
  }
488
514
  }
489
515
  onPatternEnter(start) {
@@ -653,17 +679,17 @@ class RegExpValidator {
653
679
  if (escaped) {
654
680
  escaped = false;
655
681
  }
656
- else if (cp === ReverseSolidus) {
682
+ else if (cp === REVERSE_SOLIDUS) {
657
683
  escaped = true;
658
684
  }
659
- else if (cp === LeftSquareBracket) {
685
+ else if (cp === LEFT_SQUARE_BRACKET) {
660
686
  inClass = true;
661
687
  }
662
- else if (cp === RightSquareBracket) {
688
+ else if (cp === RIGHT_SQUARE_BRACKET) {
663
689
  inClass = false;
664
690
  }
665
- else if ((cp === Solidus && !inClass) ||
666
- (cp === Asterisk && this.index === start)) {
691
+ else if ((cp === SOLIDUS && !inClass) ||
692
+ (cp === ASTERISK && this.index === start)) {
667
693
  break;
668
694
  }
669
695
  this.advance();
@@ -679,13 +705,13 @@ class RegExpValidator {
679
705
  this.consumeDisjunction();
680
706
  const cp = this.currentCodePoint;
681
707
  if (this.currentCodePoint !== -1) {
682
- if (cp === RightParenthesis) {
708
+ if (cp === RIGHT_PARENTHESIS) {
683
709
  this.raise("Unmatched ')'");
684
710
  }
685
- if (cp === ReverseSolidus) {
711
+ if (cp === REVERSE_SOLIDUS) {
686
712
  this.raise("\\ at end of pattern");
687
713
  }
688
- if (cp === RightSquareBracket || cp === RightCurlyBracket) {
714
+ if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) {
689
715
  this.raise("Lone quantifier brackets");
690
716
  }
691
717
  const c = String.fromCodePoint(cp);
@@ -708,21 +734,21 @@ class RegExpValidator {
708
734
  if (escaped) {
709
735
  escaped = false;
710
736
  }
711
- else if (cp === ReverseSolidus) {
737
+ else if (cp === REVERSE_SOLIDUS) {
712
738
  escaped = true;
713
739
  }
714
- else if (cp === LeftSquareBracket) {
740
+ else if (cp === LEFT_SQUARE_BRACKET) {
715
741
  inClass = true;
716
742
  }
717
- else if (cp === RightSquareBracket) {
743
+ else if (cp === RIGHT_SQUARE_BRACKET) {
718
744
  inClass = false;
719
745
  }
720
- else if (cp === LeftParenthesis &&
746
+ else if (cp === LEFT_PARENTHESIS &&
721
747
  !inClass &&
722
- (this.nextCodePoint !== QuestionMark ||
723
- (this.nextCodePoint2 === LessThanSign &&
724
- this.nextCodePoint3 !== EqualsSign &&
725
- this.nextCodePoint3 !== ExclamationMark))) {
748
+ (this.nextCodePoint !== QUESTION_MARK ||
749
+ (this.nextCodePoint2 === LESS_THAN_SIGN &&
750
+ this.nextCodePoint3 !== EQUALS_SIGN &&
751
+ this.nextCodePoint3 !== EXCLAMATION_MARK))) {
726
752
  count += 1;
727
753
  }
728
754
  this.advance();
@@ -736,11 +762,11 @@ class RegExpValidator {
736
762
  this.onDisjunctionEnter(start);
737
763
  do {
738
764
  this.consumeAlternative(i++);
739
- } while (this.eat(VerticalLine));
765
+ } while (this.eat(VERTICAL_LINE));
740
766
  if (this.consumeQuantifier(true)) {
741
767
  this.raise("Nothing to repeat");
742
768
  }
743
- if (this.eat(LeftCurlyBracket)) {
769
+ if (this.eat(LEFT_CURLY_BRACKET)) {
744
770
  this.raise("Lone quantifier brackets");
745
771
  }
746
772
  this.onDisjunctionLeave(start, this.index);
@@ -769,30 +795,31 @@ class RegExpValidator {
769
795
  consumeAssertion() {
770
796
  const start = this.index;
771
797
  this._lastAssertionIsQuantifiable = false;
772
- if (this.eat(CircumflexAccent)) {
798
+ if (this.eat(CIRCUMFLEX_ACCENT)) {
773
799
  this.onEdgeAssertion(start, this.index, "start");
774
800
  return true;
775
801
  }
776
- if (this.eat(DollarSign)) {
802
+ if (this.eat(DOLLAR_SIGN)) {
777
803
  this.onEdgeAssertion(start, this.index, "end");
778
804
  return true;
779
805
  }
780
- if (this.eat2(ReverseSolidus, LatinCapitalLetterB)) {
806
+ if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) {
781
807
  this.onWordBoundaryAssertion(start, this.index, "word", true);
782
808
  return true;
783
809
  }
784
- if (this.eat2(ReverseSolidus, LatinSmallLetterB)) {
810
+ if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) {
785
811
  this.onWordBoundaryAssertion(start, this.index, "word", false);
786
812
  return true;
787
813
  }
788
- if (this.eat2(LeftParenthesis, QuestionMark)) {
789
- const lookbehind = this.ecmaVersion >= 2018 && this.eat(LessThanSign);
814
+ if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) {
815
+ const lookbehind = this.ecmaVersion >= 2018 && this.eat(LESS_THAN_SIGN);
790
816
  let negate = false;
791
- if (this.eat(EqualsSign) || (negate = this.eat(ExclamationMark))) {
817
+ if (this.eat(EQUALS_SIGN) ||
818
+ (negate = this.eat(EXCLAMATION_MARK))) {
792
819
  const kind = lookbehind ? "lookbehind" : "lookahead";
793
820
  this.onLookaroundAssertionEnter(start, kind, negate);
794
821
  this.consumeDisjunction();
795
- if (!this.eat(RightParenthesis)) {
822
+ if (!this.eat(RIGHT_PARENTHESIS)) {
796
823
  this.raise("Unterminated group");
797
824
  }
798
825
  this._lastAssertionIsQuantifiable = !lookbehind && !this.strict;
@@ -808,15 +835,15 @@ class RegExpValidator {
808
835
  let min = 0;
809
836
  let max = 0;
810
837
  let greedy = false;
811
- if (this.eat(Asterisk)) {
838
+ if (this.eat(ASTERISK)) {
812
839
  min = 0;
813
840
  max = Number.POSITIVE_INFINITY;
814
841
  }
815
- else if (this.eat(PlusSign)) {
842
+ else if (this.eat(PLUS_SIGN)) {
816
843
  min = 1;
817
844
  max = Number.POSITIVE_INFINITY;
818
845
  }
819
- else if (this.eat(QuestionMark)) {
846
+ else if (this.eat(QUESTION_MARK)) {
820
847
  min = 0;
821
848
  max = 1;
822
849
  }
@@ -827,7 +854,7 @@ class RegExpValidator {
827
854
  else {
828
855
  return false;
829
856
  }
830
- greedy = !this.eat(QuestionMark);
857
+ greedy = !this.eat(QUESTION_MARK);
831
858
  if (!noConsume) {
832
859
  this.onQuantifier(start, this.index, min, max, greedy);
833
860
  }
@@ -835,17 +862,17 @@ class RegExpValidator {
835
862
  }
836
863
  eatBracedQuantifier(noError) {
837
864
  const start = this.index;
838
- if (this.eat(LeftCurlyBracket)) {
865
+ if (this.eat(LEFT_CURLY_BRACKET)) {
839
866
  this._lastMinValue = 0;
840
867
  this._lastMaxValue = Number.POSITIVE_INFINITY;
841
868
  if (this.eatDecimalDigits()) {
842
869
  this._lastMinValue = this._lastMaxValue = this._lastIntValue;
843
- if (this.eat(Comma)) {
870
+ if (this.eat(COMMA)) {
844
871
  this._lastMaxValue = this.eatDecimalDigits()
845
872
  ? this._lastIntValue
846
873
  : Number.POSITIVE_INFINITY;
847
874
  }
848
- if (this.eat(RightCurlyBracket)) {
875
+ if (this.eat(RIGHT_CURLY_BRACKET)) {
849
876
  if (!noError && this._lastMaxValue < this._lastMinValue) {
850
877
  this.raise("numbers out of order in {} quantifier");
851
878
  }
@@ -868,7 +895,7 @@ class RegExpValidator {
868
895
  this.consumeCapturingGroup());
869
896
  }
870
897
  consumeDot() {
871
- if (this.eat(FullStop)) {
898
+ if (this.eat(FULL_STOP)) {
872
899
  this.onAnyCharacterSet(this.index - 1, this.index, "any");
873
900
  return true;
874
901
  }
@@ -876,7 +903,7 @@ class RegExpValidator {
876
903
  }
877
904
  consumeReverseSolidusAtomEscape() {
878
905
  const start = this.index;
879
- if (this.eat(ReverseSolidus)) {
906
+ if (this.eat(REVERSE_SOLIDUS)) {
880
907
  if (this.consumeAtomEscape()) {
881
908
  return true;
882
909
  }
@@ -886,10 +913,10 @@ class RegExpValidator {
886
913
  }
887
914
  consumeUncapturingGroup() {
888
915
  const start = this.index;
889
- if (this.eat3(LeftParenthesis, QuestionMark, Colon)) {
916
+ if (this.eat3(LEFT_PARENTHESIS, QUESTION_MARK, COLON)) {
890
917
  this.onGroupEnter(start);
891
918
  this.consumeDisjunction();
892
- if (!this.eat(RightParenthesis)) {
919
+ if (!this.eat(RIGHT_PARENTHESIS)) {
893
920
  this.raise("Unterminated group");
894
921
  }
895
922
  this.onGroupLeave(start, this.index);
@@ -899,19 +926,19 @@ class RegExpValidator {
899
926
  }
900
927
  consumeCapturingGroup() {
901
928
  const start = this.index;
902
- if (this.eat(LeftParenthesis)) {
929
+ if (this.eat(LEFT_PARENTHESIS)) {
903
930
  let name = null;
904
931
  if (this.ecmaVersion >= 2018) {
905
932
  if (this.consumeGroupSpecifier()) {
906
933
  name = this._lastStrValue;
907
934
  }
908
935
  }
909
- else if (this.currentCodePoint === QuestionMark) {
936
+ else if (this.currentCodePoint === QUESTION_MARK) {
910
937
  this.raise("Invalid group");
911
938
  }
912
939
  this.onCapturingGroupEnter(start, name);
913
940
  this.consumeDisjunction();
914
- if (!this.eat(RightParenthesis)) {
941
+ if (!this.eat(RIGHT_PARENTHESIS)) {
915
942
  this.raise("Unterminated group");
916
943
  }
917
944
  this.onCapturingGroupLeave(start, this.index, name);
@@ -931,11 +958,11 @@ class RegExpValidator {
931
958
  }
932
959
  consumeReverseSolidusFollowedByC() {
933
960
  const start = this.index;
934
- if (this.currentCodePoint === ReverseSolidus &&
935
- this.nextCodePoint === LatinSmallLetterC) {
961
+ if (this.currentCodePoint === REVERSE_SOLIDUS &&
962
+ this.nextCodePoint === LATIN_SMALL_LETTER_C) {
936
963
  this._lastIntValue = this.currentCodePoint;
937
964
  this.advance();
938
- this.onCharacter(start, this.index, ReverseSolidus);
965
+ this.onCharacter(start, this.index, REVERSE_SOLIDUS);
939
966
  return true;
940
967
  }
941
968
  return false;
@@ -960,17 +987,17 @@ class RegExpValidator {
960
987
  const start = this.index;
961
988
  const cp = this.currentCodePoint;
962
989
  if (cp !== -1 &&
963
- cp !== CircumflexAccent &&
964
- cp !== DollarSign &&
965
- cp !== ReverseSolidus &&
966
- cp !== FullStop &&
967
- cp !== Asterisk &&
968
- cp !== PlusSign &&
969
- cp !== QuestionMark &&
970
- cp !== LeftParenthesis &&
971
- cp !== RightParenthesis &&
972
- cp !== LeftSquareBracket &&
973
- cp !== VerticalLine) {
990
+ cp !== CIRCUMFLEX_ACCENT &&
991
+ cp !== DOLLAR_SIGN &&
992
+ cp !== REVERSE_SOLIDUS &&
993
+ cp !== FULL_STOP &&
994
+ cp !== ASTERISK &&
995
+ cp !== PLUS_SIGN &&
996
+ cp !== QUESTION_MARK &&
997
+ cp !== LEFT_PARENTHESIS &&
998
+ cp !== RIGHT_PARENTHESIS &&
999
+ cp !== LEFT_SQUARE_BRACKET &&
1000
+ cp !== VERTICAL_LINE) {
974
1001
  this.advance();
975
1002
  this.onCharacter(start, this.index, cp);
976
1003
  return true;
@@ -978,7 +1005,7 @@ class RegExpValidator {
978
1005
  return false;
979
1006
  }
980
1007
  consumeGroupSpecifier() {
981
- if (this.eat(QuestionMark)) {
1008
+ if (this.eat(QUESTION_MARK)) {
982
1009
  if (this.eatGroupName()) {
983
1010
  if (!this._groupNames.has(this._lastStrValue)) {
984
1011
  this._groupNames.add(this._lastStrValue);
@@ -1019,32 +1046,32 @@ class RegExpValidator {
1019
1046
  }
1020
1047
  consumeCharacterClassEscape() {
1021
1048
  const start = this.index;
1022
- if (this.eat(LatinSmallLetterD)) {
1049
+ if (this.eat(LATIN_SMALL_LETTER_D)) {
1023
1050
  this._lastIntValue = -1;
1024
1051
  this.onEscapeCharacterSet(start - 1, this.index, "digit", false);
1025
1052
  return true;
1026
1053
  }
1027
- if (this.eat(LatinCapitalLetterD)) {
1054
+ if (this.eat(LATIN_CAPITAL_LETTER_D)) {
1028
1055
  this._lastIntValue = -1;
1029
1056
  this.onEscapeCharacterSet(start - 1, this.index, "digit", true);
1030
1057
  return true;
1031
1058
  }
1032
- if (this.eat(LatinSmallLetterS)) {
1059
+ if (this.eat(LATIN_SMALL_LETTER_S)) {
1033
1060
  this._lastIntValue = -1;
1034
1061
  this.onEscapeCharacterSet(start - 1, this.index, "space", false);
1035
1062
  return true;
1036
1063
  }
1037
- if (this.eat(LatinCapitalLetterS)) {
1064
+ if (this.eat(LATIN_CAPITAL_LETTER_S)) {
1038
1065
  this._lastIntValue = -1;
1039
1066
  this.onEscapeCharacterSet(start - 1, this.index, "space", true);
1040
1067
  return true;
1041
1068
  }
1042
- if (this.eat(LatinSmallLetterW)) {
1069
+ if (this.eat(LATIN_SMALL_LETTER_W)) {
1043
1070
  this._lastIntValue = -1;
1044
1071
  this.onEscapeCharacterSet(start - 1, this.index, "word", false);
1045
1072
  return true;
1046
1073
  }
1047
- if (this.eat(LatinCapitalLetterW)) {
1074
+ if (this.eat(LATIN_CAPITAL_LETTER_W)) {
1048
1075
  this._lastIntValue = -1;
1049
1076
  this.onEscapeCharacterSet(start - 1, this.index, "word", true);
1050
1077
  return true;
@@ -1052,12 +1079,12 @@ class RegExpValidator {
1052
1079
  let negate = false;
1053
1080
  if (this._uFlag &&
1054
1081
  this.ecmaVersion >= 2018 &&
1055
- (this.eat(LatinSmallLetterP) ||
1056
- (negate = this.eat(LatinCapitalLetterP)))) {
1082
+ (this.eat(LATIN_SMALL_LETTER_P) ||
1083
+ (negate = this.eat(LATIN_CAPITAL_LETTER_P)))) {
1057
1084
  this._lastIntValue = -1;
1058
- if (this.eat(LeftCurlyBracket) &&
1085
+ if (this.eat(LEFT_CURLY_BRACKET) &&
1059
1086
  this.eatUnicodePropertyValueExpression() &&
1060
- this.eat(RightCurlyBracket)) {
1087
+ this.eat(RIGHT_CURLY_BRACKET)) {
1061
1088
  this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", this._lastKeyValue, this._lastValValue || null, negate);
1062
1089
  return true;
1063
1090
  }
@@ -1083,7 +1110,7 @@ class RegExpValidator {
1083
1110
  }
1084
1111
  consumeKGroupName() {
1085
1112
  const start = this.index;
1086
- if (this.eat(LatinSmallLetterK)) {
1113
+ if (this.eat(LATIN_SMALL_LETTER_K)) {
1087
1114
  if (this.eatGroupName()) {
1088
1115
  const groupName = this._lastStrValue;
1089
1116
  this._backreferenceNames.add(groupName);
@@ -1096,11 +1123,11 @@ class RegExpValidator {
1096
1123
  }
1097
1124
  consumeCharacterClass() {
1098
1125
  const start = this.index;
1099
- if (this.eat(LeftSquareBracket)) {
1100
- const negate = this.eat(CircumflexAccent);
1126
+ if (this.eat(LEFT_SQUARE_BRACKET)) {
1127
+ const negate = this.eat(CIRCUMFLEX_ACCENT);
1101
1128
  this.onCharacterClassEnter(start, negate);
1102
1129
  this.consumeClassRanges();
1103
- if (!this.eat(RightSquareBracket)) {
1130
+ if (!this.eat(RIGHT_SQUARE_BRACKET)) {
1104
1131
  this.raise("Unterminated character class");
1105
1132
  }
1106
1133
  this.onCharacterClassLeave(start, this.index, negate);
@@ -1116,10 +1143,10 @@ class RegExpValidator {
1116
1143
  break;
1117
1144
  }
1118
1145
  const min = this._lastIntValue;
1119
- if (!this.eat(HyphenMinus)) {
1146
+ if (!this.eat(HYPHEN_MINUS)) {
1120
1147
  continue;
1121
1148
  }
1122
- this.onCharacter(this.index - 1, this.index, HyphenMinus);
1149
+ this.onCharacter(this.index - 1, this.index, HYPHEN_MINUS);
1123
1150
  if (!this.consumeClassAtom()) {
1124
1151
  break;
1125
1152
  }
@@ -1139,18 +1166,21 @@ class RegExpValidator {
1139
1166
  consumeClassAtom() {
1140
1167
  const start = this.index;
1141
1168
  const cp = this.currentCodePoint;
1142
- if (cp !== -1 && cp !== ReverseSolidus && cp !== RightSquareBracket) {
1169
+ if (cp !== -1 &&
1170
+ cp !== REVERSE_SOLIDUS &&
1171
+ cp !== RIGHT_SQUARE_BRACKET) {
1143
1172
  this.advance();
1144
1173
  this._lastIntValue = cp;
1145
1174
  this.onCharacter(start, this.index, this._lastIntValue);
1146
1175
  return true;
1147
1176
  }
1148
- if (this.eat(ReverseSolidus)) {
1177
+ if (this.eat(REVERSE_SOLIDUS)) {
1149
1178
  if (this.consumeClassEscape()) {
1150
1179
  return true;
1151
1180
  }
1152
- if (!this.strict && this.currentCodePoint === LatinSmallLetterC) {
1153
- this._lastIntValue = ReverseSolidus;
1181
+ if (!this.strict &&
1182
+ this.currentCodePoint === LATIN_SMALL_LETTER_C) {
1183
+ this._lastIntValue = REVERSE_SOLIDUS;
1154
1184
  this.onCharacter(start, this.index, this._lastIntValue);
1155
1185
  return true;
1156
1186
  }
@@ -1163,21 +1193,21 @@ class RegExpValidator {
1163
1193
  }
1164
1194
  consumeClassEscape() {
1165
1195
  const start = this.index;
1166
- if (this.eat(LatinSmallLetterB)) {
1167
- this._lastIntValue = Backspace;
1196
+ if (this.eat(LATIN_SMALL_LETTER_B)) {
1197
+ this._lastIntValue = BACKSPACE;
1168
1198
  this.onCharacter(start - 1, this.index, this._lastIntValue);
1169
1199
  return true;
1170
1200
  }
1171
- if (this._uFlag && this.eat(HyphenMinus)) {
1172
- this._lastIntValue = HyphenMinus;
1201
+ if (this._uFlag && this.eat(HYPHEN_MINUS)) {
1202
+ this._lastIntValue = HYPHEN_MINUS;
1173
1203
  this.onCharacter(start - 1, this.index, this._lastIntValue);
1174
1204
  return true;
1175
1205
  }
1176
1206
  let cp = 0;
1177
1207
  if (!this.strict &&
1178
1208
  !this._uFlag &&
1179
- this.currentCodePoint === LatinSmallLetterC &&
1180
- (isDecimalDigit((cp = this.nextCodePoint)) || cp === LowLine)) {
1209
+ this.currentCodePoint === LATIN_SMALL_LETTER_C &&
1210
+ (isDecimalDigit((cp = this.nextCodePoint)) || cp === LOW_LINE)) {
1181
1211
  this.advance();
1182
1212
  this.advance();
1183
1213
  this._lastIntValue = cp % 0x20;
@@ -1187,8 +1217,8 @@ class RegExpValidator {
1187
1217
  return (this.consumeCharacterClassEscape() || this.consumeCharacterEscape());
1188
1218
  }
1189
1219
  eatGroupName() {
1190
- if (this.eat(LessThanSign)) {
1191
- if (this.eatRegExpIdentifierName() && this.eat(GreaterThanSign)) {
1220
+ if (this.eat(LESS_THAN_SIGN)) {
1221
+ if (this.eatRegExpIdentifierName() && this.eat(GREATER_THAN_SIGN)) {
1192
1222
  return true;
1193
1223
  }
1194
1224
  this.raise("Invalid capture group name");
@@ -1210,7 +1240,7 @@ class RegExpValidator {
1210
1240
  const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020;
1211
1241
  let cp = this.currentCodePoint;
1212
1242
  this.advance();
1213
- if (cp === ReverseSolidus &&
1243
+ if (cp === REVERSE_SOLIDUS &&
1214
1244
  this.eatRegExpUnicodeEscapeSequence(forceUFlag)) {
1215
1245
  cp = this._lastIntValue;
1216
1246
  }
@@ -1234,7 +1264,7 @@ class RegExpValidator {
1234
1264
  const forceUFlag = !this._uFlag && this.ecmaVersion >= 2020;
1235
1265
  let cp = this.currentCodePoint;
1236
1266
  this.advance();
1237
- if (cp === ReverseSolidus &&
1267
+ if (cp === REVERSE_SOLIDUS &&
1238
1268
  this.eatRegExpUnicodeEscapeSequence(forceUFlag)) {
1239
1269
  cp = this._lastIntValue;
1240
1270
  }
@@ -1255,7 +1285,7 @@ class RegExpValidator {
1255
1285
  }
1256
1286
  eatCControlLetter() {
1257
1287
  const start = this.index;
1258
- if (this.eat(LatinSmallLetterC)) {
1288
+ if (this.eat(LATIN_SMALL_LETTER_C)) {
1259
1289
  if (this.eatControlLetter()) {
1260
1290
  return true;
1261
1291
  }
@@ -1264,7 +1294,7 @@ class RegExpValidator {
1264
1294
  return false;
1265
1295
  }
1266
1296
  eatZero() {
1267
- if (this.currentCodePoint === DigitZero &&
1297
+ if (this.currentCodePoint === DIGIT_ZERO &&
1268
1298
  !isDecimalDigit(this.nextCodePoint)) {
1269
1299
  this._lastIntValue = 0;
1270
1300
  this.advance();
@@ -1273,24 +1303,24 @@ class RegExpValidator {
1273
1303
  return false;
1274
1304
  }
1275
1305
  eatControlEscape() {
1276
- if (this.eat(LatinSmallLetterF)) {
1277
- this._lastIntValue = FormFeed;
1306
+ if (this.eat(LATIN_SMALL_LETTER_F)) {
1307
+ this._lastIntValue = FORM_FEED;
1278
1308
  return true;
1279
1309
  }
1280
- if (this.eat(LatinSmallLetterN)) {
1281
- this._lastIntValue = LineFeed;
1310
+ if (this.eat(LATIN_SMALL_LETTER_N)) {
1311
+ this._lastIntValue = LINE_FEED;
1282
1312
  return true;
1283
1313
  }
1284
- if (this.eat(LatinSmallLetterR)) {
1285
- this._lastIntValue = CarriageReturn;
1314
+ if (this.eat(LATIN_SMALL_LETTER_R)) {
1315
+ this._lastIntValue = CARRIAGE_RETURN;
1286
1316
  return true;
1287
1317
  }
1288
- if (this.eat(LatinSmallLetterT)) {
1289
- this._lastIntValue = CharacterTabulation;
1318
+ if (this.eat(LATIN_SMALL_LETTER_T)) {
1319
+ this._lastIntValue = CHARACTER_TABULATION;
1290
1320
  return true;
1291
1321
  }
1292
- if (this.eat(LatinSmallLetterV)) {
1293
- this._lastIntValue = LineTabulation;
1322
+ if (this.eat(LATIN_SMALL_LETTER_V)) {
1323
+ this._lastIntValue = LINE_TABULATION;
1294
1324
  return true;
1295
1325
  }
1296
1326
  return false;
@@ -1307,7 +1337,7 @@ class RegExpValidator {
1307
1337
  eatRegExpUnicodeEscapeSequence(forceUFlag = false) {
1308
1338
  const start = this.index;
1309
1339
  const uFlag = forceUFlag || this._uFlag;
1310
- if (this.eat(LatinSmallLetterU)) {
1340
+ if (this.eat(LATIN_SMALL_LETTER_U)) {
1311
1341
  if ((uFlag && this.eatRegExpUnicodeSurrogatePairEscape()) ||
1312
1342
  this.eatFixedHexDigits(4) ||
1313
1343
  (uFlag && this.eatRegExpUnicodeCodePointEscape())) {
@@ -1325,8 +1355,8 @@ class RegExpValidator {
1325
1355
  if (this.eatFixedHexDigits(4)) {
1326
1356
  const lead = this._lastIntValue;
1327
1357
  if (isLeadSurrogate(lead) &&
1328
- this.eat(ReverseSolidus) &&
1329
- this.eat(LatinSmallLetterU) &&
1358
+ this.eat(REVERSE_SOLIDUS) &&
1359
+ this.eat(LATIN_SMALL_LETTER_U) &&
1330
1360
  this.eatFixedHexDigits(4)) {
1331
1361
  const trail = this._lastIntValue;
1332
1362
  if (isTrailSurrogate(trail)) {
@@ -1340,9 +1370,9 @@ class RegExpValidator {
1340
1370
  }
1341
1371
  eatRegExpUnicodeCodePointEscape() {
1342
1372
  const start = this.index;
1343
- if (this.eat(LeftCurlyBracket) &&
1373
+ if (this.eat(LEFT_CURLY_BRACKET) &&
1344
1374
  this.eatHexDigits() &&
1345
- this.eat(RightCurlyBracket) &&
1375
+ this.eat(RIGHT_CURLY_BRACKET) &&
1346
1376
  isValidUnicode(this._lastIntValue)) {
1347
1377
  return true;
1348
1378
  }
@@ -1363,32 +1393,32 @@ class RegExpValidator {
1363
1393
  return false;
1364
1394
  }
1365
1395
  if (this._uFlag) {
1366
- return isSyntaxCharacter(cp) || cp === Solidus;
1396
+ return isSyntaxCharacter(cp) || cp === SOLIDUS;
1367
1397
  }
1368
1398
  if (this.strict) {
1369
1399
  return !isIdContinue(cp);
1370
1400
  }
1371
1401
  if (this._nFlag) {
1372
- return !(cp === LatinSmallLetterC || cp === LatinSmallLetterK);
1402
+ return !(cp === LATIN_SMALL_LETTER_C || cp === LATIN_SMALL_LETTER_K);
1373
1403
  }
1374
- return cp !== LatinSmallLetterC;
1404
+ return cp !== LATIN_SMALL_LETTER_C;
1375
1405
  }
1376
1406
  eatDecimalEscape() {
1377
1407
  this._lastIntValue = 0;
1378
1408
  let cp = this.currentCodePoint;
1379
- if (cp >= DigitOne && cp <= DigitNine) {
1409
+ if (cp >= DIGIT_ONE && cp <= DIGIT_NINE) {
1380
1410
  do {
1381
- this._lastIntValue = 10 * this._lastIntValue + (cp - DigitZero);
1411
+ this._lastIntValue = 10 * this._lastIntValue + (cp - DIGIT_ZERO);
1382
1412
  this.advance();
1383
- } while ((cp = this.currentCodePoint) >= DigitZero &&
1384
- cp <= DigitNine);
1413
+ } while ((cp = this.currentCodePoint) >= DIGIT_ZERO &&
1414
+ cp <= DIGIT_NINE);
1385
1415
  return true;
1386
1416
  }
1387
1417
  return false;
1388
1418
  }
1389
1419
  eatUnicodePropertyValueExpression() {
1390
1420
  const start = this.index;
1391
- if (this.eatUnicodePropertyName() && this.eat(EqualsSign)) {
1421
+ if (this.eatUnicodePropertyName() && this.eat(EQUALS_SIGN)) {
1392
1422
  this._lastKeyValue = this._lastStrValue;
1393
1423
  if (this.eatUnicodePropertyValue()) {
1394
1424
  this._lastValValue = this._lastStrValue;
@@ -1436,7 +1466,7 @@ class RegExpValidator {
1436
1466
  }
1437
1467
  eatHexEscapeSequence() {
1438
1468
  const start = this.index;
1439
- if (this.eat(LatinSmallLetterX)) {
1469
+ if (this.eat(LATIN_SMALL_LETTER_X)) {
1440
1470
  if (this.eatFixedHexDigits(2)) {
1441
1471
  return true;
1442
1472
  }
@@ -1490,7 +1520,7 @@ class RegExpValidator {
1490
1520
  const cp = this.currentCodePoint;
1491
1521
  if (isOctalDigit(cp)) {
1492
1522
  this.advance();
1493
- this._lastIntValue = cp - DigitZero;
1523
+ this._lastIntValue = cp - DIGIT_ZERO;
1494
1524
  return true;
1495
1525
  }
1496
1526
  this._lastIntValue = 0;
@@ -1512,14 +1542,14 @@ class RegExpValidator {
1512
1542
  }
1513
1543
  }
1514
1544
 
1515
- const DummyPattern = {};
1516
- const DummyFlags = {};
1517
- const DummyCapturingGroup = {};
1545
+ const DUMMY_PATTERN = {};
1546
+ const DUMMY_FLAGS = {};
1547
+ const DUMMY_CAPTURING_GROUP = {};
1518
1548
  class RegExpParserState {
1519
1549
  constructor(options) {
1520
1550
  var _a;
1521
- this._node = DummyPattern;
1522
- this._flags = DummyFlags;
1551
+ this._node = DUMMY_PATTERN;
1552
+ this._flags = DUMMY_FLAGS;
1523
1553
  this._backreferences = [];
1524
1554
  this._capturingGroups = [];
1525
1555
  this.source = "";
@@ -1538,7 +1568,7 @@ class RegExpParserState {
1538
1568
  }
1539
1569
  return this._flags;
1540
1570
  }
1541
- onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices) {
1571
+ onRegExpFlags(start, end, { global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices, }) {
1542
1572
  this._flags = {
1543
1573
  type: "Flags",
1544
1574
  parent: null,
@@ -1809,7 +1839,7 @@ class RegExpParserState {
1809
1839
  end,
1810
1840
  raw: this.source.slice(start, end),
1811
1841
  ref,
1812
- resolved: DummyCapturingGroup,
1842
+ resolved: DUMMY_CAPTURING_GROUP,
1813
1843
  };
1814
1844
  parent.elements.push(node);
1815
1845
  this._backreferences.push(node);
@@ -1855,7 +1885,7 @@ class RegExpParserState {
1855
1885
  min.type !== "Character" ||
1856
1886
  max.type !== "Character" ||
1857
1887
  hyphen.type !== "Character" ||
1858
- hyphen.value !== HyphenMinus) {
1888
+ hyphen.value !== HYPHEN_MINUS) {
1859
1889
  throw new Error("UnknownError");
1860
1890
  }
1861
1891
  const node = {