@@ -902,6 +902,9 @@ export class RegExpValidator {
902902 if ( cp === RightParenthesis ) {
903903 this . raise ( "Unmatched ')'" )
904904 }
905+ if ( cp === ReverseSolidus ) {
906+ this . raise ( "\\ at end of pattern" )
907+ }
905908 if ( cp === RightSquareBracket || cp === RightCurlyBracket ) {
906909 this . raise ( "Lone quantifier brackets" )
907910 }
@@ -1176,6 +1179,7 @@ export class RegExpValidator {
11761179 return (
11771180 this . eatDot ( ) ||
11781181 this . eatReverseSolidusAtomEscape ( ) ||
1182+ this . eatReverseSolidusFollowedByC ( ) ||
11791183 this . eatCharacterClass ( ) ||
11801184 this . eatUncapturingGroup ( ) ||
11811185 this . eatCapturingGroup ( ) ||
@@ -1184,6 +1188,20 @@ export class RegExpValidator {
11841188 )
11851189 }
11861190
1191+ // \ [lookahead = c]
1192+ private eatReverseSolidusFollowedByC ( ) : boolean {
1193+ if (
1194+ this . currentCodePoint === ReverseSolidus &&
1195+ this . nextCodePoint === LatinSmallLetterC
1196+ ) {
1197+ this . _lastIntValue = this . currentCodePoint
1198+ this . advance ( )
1199+ this . onCharacter ( this . index - 1 , this . index , ReverseSolidus )
1200+ return true
1201+ }
1202+ return false
1203+ }
1204+
11871205 // https://www.ecma-international.org/ecma-262/8.0/#prod-strict-InvalidBracedQuantifier
11881206 private eatInvalidBracedQuantifier ( ) : boolean {
11891207 if ( this . eatBracedQuantifier ( true ) ) {
@@ -1222,6 +1240,7 @@ export class RegExpValidator {
12221240 cp !== - 1 &&
12231241 cp !== CircumflexAccent &&
12241242 cp !== DollarSign &&
1243+ cp !== ReverseSolidus &&
12251244 cp !== FullStop &&
12261245 cp !== Asterisk &&
12271246 cp !== PlusSign &&
@@ -1457,6 +1476,7 @@ export class RegExpValidator {
14571476 }
14581477
14591478 // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
1479+ //eslint-disable-next-line complexity
14601480 private eatRegExpUnicodeEscapeSequence ( ) : boolean {
14611481 const start = this . index
14621482
0 commit comments