emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 dadb841: Disallow parenthesis in non-pseudo CSS s


From: Simen Heggestøyl
Subject: [Emacs-diffs] emacs-25 dadb841: Disallow parenthesis in non-pseudo CSS selectors
Date: Thu, 14 Jan 2016 18:35:08 +0000

branch: emacs-25
commit dadb841a06aa1ffd6d17c04ef83140dbd1ad7307
Author: Simen Heggestøyl <address@hidden>
Commit: Simen Heggestøyl <address@hidden>

    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.
---
 lisp/textmodes/css-mode.el |   10 +++++-----
 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 48c2484..d402fb1 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -257,13 +257,13 @@
        (if (not sassy)
            ;; We don't allow / as first char, so as not to
            ;; take a comment as the beginning of a selector.
-           "[^@/:{} \t\n][^:{}]+"
+           "[^@/:{}() \t\n][^:{}()]+"
          ;; Same as for non-sassy except we do want to allow { and }
          ;; chars in selectors in the case of #{$foo}
          ;; variable interpolation!
          (concat "\\(?:" scss--hash-re
-                 "\\|[^@/:{} \t\n#]\\)"
-                 "[^:{}#]*\\(?:" scss--hash-re "[^:{}#]*\\)*"))
+                 "\\|[^@/:{}() \t\n#]\\)"
+                 "[^:{}()#]*\\(?:" scss--hash-re "[^:{}()#]*\\)*"))
        ;; Even though pseudo-elements should be prefixed by ::, a
        ;; single colon is accepted for backward compatibility.
        "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids
@@ -271,8 +271,8 @@
        "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)"
        "\\(?:([^)]+)\\)?"
        (if (not sassy)
-           "[^:{}\n]*"
-         (concat "[^:{}\n#]*\\(?:" scss--hash-re "[^:{}\n#]*\\)*"))
+           "[^:{}()\n]*"
+         (concat "[^:{}()\n#]*\\(?:" scss--hash-re "[^:{}()\n#]*\\)*"))
        "\\)*"
        "\\)\\(?:\n[ \t]*\\)*{")
      (1 'css-selector keep))
diff --git a/test/indent/scss-mode.scss b/test/indent/scss-mode.scss
index 7a29929..02a4a98 100644
--- a/test/indent/scss-mode.scss
+++ b/test/indent/scss-mode.scss
@@ -55,3 +55,13 @@ article[role="main"] {
 }
 
 .box { @include border-radius(10px); }
+
+// bug:21230
+$list: (
+   ('a', #000000, #fff)
+   ('b', #000000, #fff)
+   ('c', #000000, #fff)
+   ('d', #000000, #fff)
+   ('e', #000000, #fff)
+   ('f', #000000, #fff)
+);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]