A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mysticatea/regexpp/commit/0dc0b654b54054bef039a84f2e18cc53eb0b3821 below:

follow tc39/ecma262#910 (refs eslint/eslint#10861) · mysticatea/regexpp@0dc0b65 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+31

-0

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+31

-0

lines changed Original file line number Diff line number Diff line change

@@ -902,6 +902,9 @@ export class RegExpValidator {

902 902

if (cp === RightParenthesis) {

903 903

this.raise("Unmatched ')'")

904 904

}

905 +

if (cp === ReverseSolidus) {

906 +

this.raise("\\ at end of pattern")

907 +

}

905 908

if (cp === RightSquareBracket || cp === RightCurlyBracket) {

906 909

this.raise("Lone quantifier brackets")

907 910

}

@@ -1176,6 +1179,7 @@ export class RegExpValidator {

1176 1179

return (

1177 1180

this.eatDot() ||

1178 1181

this.eatReverseSolidusAtomEscape() ||

1182 +

this.eatReverseSolidusFollowedByC() ||

1179 1183

this.eatCharacterClass() ||

1180 1184

this.eatUncapturingGroup() ||

1181 1185

this.eatCapturingGroup() ||

@@ -1184,6 +1188,20 @@ export class RegExpValidator {

1184 1188

)

1185 1189

}

1186 1190 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 + 1187 1205

// https://www.ecma-international.org/ecma-262/8.0/#prod-strict-InvalidBracedQuantifier

1188 1206

private eatInvalidBracedQuantifier(): boolean {

1189 1207

if (this.eatBracedQuantifier(true)) {

@@ -1222,6 +1240,7 @@ export class RegExpValidator {

1222 1240

cp !== -1 &&

1223 1241

cp !== CircumflexAccent &&

1224 1242

cp !== DollarSign &&

1243 +

cp !== ReverseSolidus &&

1225 1244

cp !== FullStop &&

1226 1245

cp !== Asterisk &&

1227 1246

cp !== PlusSign &&

@@ -1457,6 +1476,7 @@ export class RegExpValidator {

1457 1476

}

1458 1477 1459 1478

// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence

1479 +

//eslint-disable-next-line complexity

1460 1480

private eatRegExpUnicodeEscapeSequence(): boolean {

1461 1481

const start = this.index

1462 1482 Original file line number Diff line number Diff line change

@@ -74,3 +74,14 @@ describe("parseRegExpLiteral function:", () => {

74 74

assert.deepStrictEqual(actual, expected)

75 75

})

76 76

})

77 + 78 +

describe("RegExpParser:", () => {

79 +

describe("parsePattern function", () => {

80 +

it("should throw syntax error on '\\'.", () => {

81 +

assert.throws(

82 +

() => new RegExpParser().parsePattern("\\"),

83 +

/\\ at end of pattern/,

84 +

)

85 +

})

86 +

})

87 +

})

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4