-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Information
- Language: CSP
- Plugins: none
Does the problem still occur in the latest version of Prism?
Yes.
Description
Directive names with adjacent hyphens are highlighted. For example, Prism highlights default-src inside the following sequences:
fake-default-src 'none'
default-src-is-a-fake 'none'
The error is caused by \b. The first \b has been there from the beginning. Then I added the last \b. Both of them are erroneous, because \b uses [0-9A-Z_a-z] (see ECMA-262, sections 21.2.1, 21.2.2.12, 21.2.2.6.1), whereas directive names consist of [-0-9A-Za-z] (see CSP 1.0, CSP 1.1, CSP2, and CSP3).
Code snippet
The code being highlighted incorrectly.
fake-default-src 'none'
default-src-is-a-fake 'none'
The default-src part should not be highlighted.