diff options
| author | Simen Heggestøyl | 2016-01-14 19:24:03 +0100 |
|---|---|---|
| committer | Simen Heggestøyl | 2016-01-14 19:24:03 +0100 |
| commit | dadb841a06aa1ffd6d17c04ef83140dbd1ad7307 (patch) | |
| tree | 33868efd29567b592826a8fa7b037aa4c6a56b51 | |
| parent | d5f1db83ecfffbbb52b88b382cf5d480e8a0ef32 (diff) | |
| download | emacs-dadb841a06aa1ffd6d17c04ef83140dbd1ad7307.tar.gz emacs-dadb841a06aa1ffd6d17c04ef83140dbd1ad7307.zip | |
Disallow parenthesis in non-pseudo CSS selectors
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Disallow
parenthesis in selectors except for in the function notation that
might appear right after a pseudo-class.
* test/indent/scss-mode.scss: Add a test for it.
| -rw-r--r-- | lisp/textmodes/css-mode.el | 10 | ||||
| -rw-r--r-- | test/indent/scss-mode.scss | 10 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 48c24844a68..d402fb19955 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el | |||
| @@ -257,13 +257,13 @@ | |||
| 257 | (if (not sassy) | 257 | (if (not sassy) |
| 258 | ;; We don't allow / as first char, so as not to | 258 | ;; We don't allow / as first char, so as not to |
| 259 | ;; take a comment as the beginning of a selector. | 259 | ;; take a comment as the beginning of a selector. |
| 260 | "[^@/:{} \t\n][^:{}]+" | 260 | "[^@/:{}() \t\n][^:{}()]+" |
| 261 | ;; Same as for non-sassy except we do want to allow { and } | 261 | ;; Same as for non-sassy except we do want to allow { and } |
| 262 | ;; chars in selectors in the case of #{$foo} | 262 | ;; chars in selectors in the case of #{$foo} |
| 263 | ;; variable interpolation! | 263 | ;; variable interpolation! |
| 264 | (concat "\\(?:" scss--hash-re | 264 | (concat "\\(?:" scss--hash-re |
| 265 | "\\|[^@/:{} \t\n#]\\)" | 265 | "\\|[^@/:{}() \t\n#]\\)" |
| 266 | "[^:{}#]*\\(?:" scss--hash-re "[^:{}#]*\\)*")) | 266 | "[^:{}()#]*\\(?:" scss--hash-re "[^:{}()#]*\\)*")) |
| 267 | ;; Even though pseudo-elements should be prefixed by ::, a | 267 | ;; Even though pseudo-elements should be prefixed by ::, a |
| 268 | ;; single colon is accepted for backward compatibility. | 268 | ;; single colon is accepted for backward compatibility. |
| 269 | "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids | 269 | "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids |
| @@ -271,8 +271,8 @@ | |||
| 271 | "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)" | 271 | "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)" |
| 272 | "\\(?:([^)]+)\\)?" | 272 | "\\(?:([^)]+)\\)?" |
| 273 | (if (not sassy) | 273 | (if (not sassy) |
| 274 | "[^:{}\n]*" | 274 | "[^:{}()\n]*" |
| 275 | (concat "[^:{}\n#]*\\(?:" scss--hash-re "[^:{}\n#]*\\)*")) | 275 | (concat "[^:{}()\n#]*\\(?:" scss--hash-re "[^:{}()\n#]*\\)*")) |
| 276 | "\\)*" | 276 | "\\)*" |
| 277 | "\\)\\(?:\n[ \t]*\\)*{") | 277 | "\\)\\(?:\n[ \t]*\\)*{") |
| 278 | (1 'css-selector keep)) | 278 | (1 'css-selector keep)) |
diff --git a/test/indent/scss-mode.scss b/test/indent/scss-mode.scss index 7a29929efca..02a4a98a8c5 100644 --- a/test/indent/scss-mode.scss +++ b/test/indent/scss-mode.scss | |||
| @@ -55,3 +55,13 @@ article[role="main"] { | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | .box { @include border-radius(10px); } | 57 | .box { @include border-radius(10px); } |
| 58 | |||
| 59 | // bug:21230 | ||
| 60 | $list: ( | ||
| 61 | ('a', #000000, #fff) | ||
| 62 | ('b', #000000, #fff) | ||
| 63 | ('c', #000000, #fff) | ||
| 64 | ('d', #000000, #fff) | ||
| 65 | ('e', #000000, #fff) | ||
| 66 | ('f', #000000, #fff) | ||
| 67 | ); | ||