Skip to content

Commit

Permalink
Grammar: Use non-ambiguous syntax for xdigit class
Browse files Browse the repository at this point in the history
While `\p{XDigit}` works, alternate regex engines might interpret it
according to UTS #18, which contains more than just the ASCII
characters, or not even implement it at all.

The YAML spec only contains the ASCII characters, see here:

http://yaml.org/spec/1.2/spec.html#id2775468
  • Loading branch information
robinst authored and infininight committed May 4, 2018
1 parent 6f6cd3c commit 9234d38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Syntaxes/YAML.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@
(?:[ \t]+
((?:!(?:[0-9A-Za-z\-]*!)?))
(?:[ \t]+ (
! (?x: %\p{XDigit}{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]] )*
| (?![,!\[\]{}]) (?x: %\p{XDigit}{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]] )+
! (?x: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]] )*
| (?![,!\[\]{}]) (?x: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]] )+
)
)?
)?
Expand Down Expand Up @@ -1124,8 +1124,8 @@
<string>(?x)
\G
(?:
! &lt; (?: %\p{XDigit}{2} | [0-9A-Za-z\-#;/?:@&amp;=+$,_.!~*'()\[\]] )+ &gt;
| (?:!(?:[0-9A-Za-z\-]*!)?) (?: %\p{XDigit}{2} | [0-9A-Za-z\-#;/?:@&amp;=+$_.~*'()] )+
! &lt; (?: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&amp;=+$,_.!~*'()\[\]] )+ &gt;
| (?:!(?:[0-9A-Za-z\-]*!)?) (?: %[0-9A-Fa-f]{2} | [0-9A-Za-z\-#;/?:@&amp;=+$_.~*'()] )+
| !
)
(?=\ |\t|$)
Expand Down

0 comments on commit 9234d38

Please sign in to comment.