-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed error when parsing slashes in RegExp literals.
Basically we weren't recognizing that a slash can occur in a character class, so we were bailing out too early on code like `/[/]/`. Fixes issue #318.
- Loading branch information
1 parent
853288b
commit 35803db
Showing
14 changed files
with
62 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// [parser596700.ts] | ||
var regex2 = /[a-z/]$/i; | ||
|
||
//// [parser596700.js] | ||
var regex2 = /[a-z/]$/i; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//// [parser630933.ts] | ||
var a = "Hello"; | ||
var b = a.match(/\/ver=([^/]+)/); | ||
|
||
|
||
//// [parser630933.js] | ||
var a = "Hello"; | ||
var b = a.match(/\/ver=([^/]+)/); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// [parser645086_3.ts] | ||
var v = /[\]/]/ | ||
|
||
//// [parser645086_3.js] | ||
var v = /[\]/]/; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// [parser645086_4.ts] | ||
var v = /[^\]/]/ | ||
|
||
//// [parser645086_4.js] | ||
var v = /[^\]/]/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,4 @@ | ||
==== tests/cases/conformance/parser/ecmascript5/RegularExpressions/parserRegularExpression2.ts (4 errors) ==== | ||
==== tests/cases/conformance/parser/ecmascript5/RegularExpressions/parserRegularExpression2.ts (1 errors) ==== | ||
href.match(/:\/\/(.[^/]+)/)[1]; | ||
~ | ||
!!! ',' expected. | ||
~ | ||
!!! Expression expected. | ||
~ | ||
!!! Expression expected. | ||
~~~~ | ||
!!! Cannot find name 'href'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// [parserRegularExpression2.ts] | ||
href.match(/:\/\/(.[^/]+)/)[1]; | ||
|
||
//// [parserRegularExpression2.js] | ||
href.match(/:\/\/(.[^/]+)/)[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//// [regExpWithSlashInCharClass.ts] | ||
var foo1 = "a/".replace(/.[/]/, ""); | ||
var foo2 = "a//".replace(/.[//]/g, ""); | ||
var foo3 = "a/".replace(/.[/no sleep /till/]/, "bugfix"); | ||
|
||
|
||
//// [regExpWithSlashInCharClass.js] | ||
var foo1 = "a/".replace(/.[/]/, ""); | ||
var foo2 = "a//".replace(/.[//]/g, ""); | ||
var foo3 = "a/".replace(/.[/no sleep /till/]/, "bugfix"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,6 @@ | ||
==== tests/cases/compiler/validRegexp.ts (9 errors) ==== | ||
==== tests/cases/compiler/validRegexp.ts (1 errors) ==== | ||
var x = / [a - z /]$ / i; | ||
~ | ||
!!! ',' expected. | ||
~ | ||
!!! '=' expected. | ||
~ | ||
!!! Cannot find name 'i'. | ||
var x1 = /[a-z/]$/i; | ||
~ | ||
!!! ',' expected. | ||
~ | ||
!!! '=' expected. | ||
~ | ||
!!! Cannot find name 'i'. | ||
var x2 = /[a-z/]$ /i; | ||
~ | ||
!!! ',' expected. | ||
~ | ||
!!! '=' expected. | ||
~ | ||
!!! Cannot find name 'i'. | ||
var x1 = /[a-z/]$/i; | ||
var x2 = /[a-z/]$ /i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var foo1 = "a/".replace(/.[/]/, ""); | ||
var foo2 = "a//".replace(/.[//]/g, ""); | ||
var foo3 = "a/".replace(/.[/no sleep /till/]/, "bugfix"); |