Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit c24bb4e

Browse files
committed
Avoid using the ambiguous \h shorthand character
Depending on the regular expression engine used, \h does not always mean the same. With a PCRE engine, it matches white spaces, whereas, with a Oniguruma engine, it matches hexademical digit characters. Atom uses an Oniguruma engine, but github.com relies on a PCRE engine.
1 parent 14e02bd commit c24bb4e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

grammars/javascript.cson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@
15241524
'name': 'punctuation.definition.unicode-escape.end.bracket.curly.js'
15251525
}
15261526
{
1527-
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
1527+
'match': '\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
15281528
'name': 'constant.character.escape.js'
15291529
}
15301530
]

grammars/regular expressions (javascript).cson

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'name': 'constant.character.character-class.regexp'
1515
}
1616
{
17-
'match': '\\\\([0-7]{3}|x\\h\\h|u\\h\\h\\h\\h)'
17+
'match': '\\\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})'
1818
'name': 'constant.character.numeric.regexp'
1919
}
2020
{
@@ -107,7 +107,7 @@
107107
'name': 'constant.character.control.regexp'
108108
'6':
109109
'name': 'constant.character.escape.backslash.regexp'
110-
'match': '(?:.|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))'
110+
'match': '(?:.|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))'
111111
'name': 'constant.other.character-class.range.regexp'
112112
}
113113
{

0 commit comments

Comments
 (0)