mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
Expand \c replacement range to include a-z ([A-Za-z])
This commit is contained in:
parent
8f9e999236
commit
45e8942866
|
@ -122,6 +122,7 @@ func execResultToArray(runtime *_runtime, target string, result []int) *_object
|
|||
//\x{0031}-\x{0039}
|
||||
|
||||
var transformRegExp_matchSlashU = regexp.MustCompile(`\\u([[:xdigit:]]{1,4})`)
|
||||
// ? Changing \\(c)([^A-Za-z]) to \\(c)([^A-Z]) causes ch15/15.10/15.10.2/15.10.2.10/S15.10.2.10_A2.1_T3.js to panic
|
||||
var transformRegExp_unescape = regexp.MustCompile(strings.NewReplacer("\n", "", "\t", "", " ", "").Replace(`
|
||||
|
||||
(?:
|
||||
|
@ -136,7 +137,7 @@ var transformRegExp_unescape = regexp.MustCompile(strings.NewReplacer("\n", "",
|
|||
)()
|
||||
) |
|
||||
(?:
|
||||
\\(c)([^A-Z])
|
||||
\\(c)([^A-Za-z])
|
||||
) |
|
||||
(?:
|
||||
\\(u)([^[:xdigit:]])
|
||||
|
@ -168,6 +169,7 @@ var transformRegExp_unescapeDollar = regexp.MustCompile(strings.NewReplacer("\n"
|
|||
// TODO Go "regexp" bug? Can't do: (?:)|(?:$)
|
||||
|
||||
func transformRegExp(ecmaRegExp string) (goRegExp string) {
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi/show_bug.cgi?id=334158
|
||||
tmp := []byte(ecmaRegExp)
|
||||
tmp = transformRegExp_unescape.ReplaceAll(tmp, []byte(`$1$2`))
|
||||
tmp = transformRegExp_unescapeDollar.ReplaceAll(tmp, []byte(`$1`))
|
||||
|
|
Loading…
Reference in New Issue
Block a user