From: Simen Heggestøyl Date: Tue, 17 Mar 2015 21:33:36 +0000 (+0100) Subject: Discriminate between pseudo-classes and -elements X-Git-Tag: emacs-25.0.90~2564^2~142 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=64db0c26faba21e7aedc0c5f57e04ed175b04f5b;p=emacs.git Discriminate between pseudo-classes and -elements * textmodes/css-mode.el (css--font-lock-keywords): Discriminate between pseudo-classes and pseudo-elements. (css-pseudo-ids): Remove. (css-pseudo-class-ids): New variable. (css-pseudo-element-ids): New variable. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 57d988b6887..898d9cbf361 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2015-03-17 Simen Heggestøyl + + * textmodes/css-mode.el (css--font-lock-keywords): Discriminate + between pseudo-classes and pseudo-elements. + (css-pseudo-ids): Remove. + (css-pseudo-class-ids): New variable. + (css-pseudo-element-ids): New variable. + 2015-03-17 Bozhidar Batsov * progmodes/ruby-mode.el (ruby-font-lock-keywords): Font-lock diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 44dc4dff3de..c88960373cb 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2006-2015 Free Software Foundation, Inc. ;; Author: Stefan Monnier +;; Maintainer: Simen Heggestøyl ;; Keywords: hypermedia ;; This file is part of GNU Emacs. @@ -120,10 +121,17 @@ ;; (media . "^ +\\* '\\([^ '\n]+\\)' media group") ;; (property . "^ +\\* '\\([^ '\n]+\\)',"))) -(defconst css-pseudo-ids - '("active" "after" "before" "first" "first-child" "first-letter" "first-line" - "focus" "hover" "lang" "left" "link" "right" "visited") - "Identifiers for pseudo-elements and pseudo-classes.") +(defconst css-pseudo-class-ids + '("active" "checked" "disabled" "empty" "enabled" "first" + "first-child" "first-of-type" "focus" "hover" "indeterminate" "lang" + "last-child" "last-of-type" "left" "link" "nth-child" + "nth-last-child" "nth-last-of-type" "nth-of-type" "only-child" + "only-of-type" "right" "root" "target" "visited") + "Identifiers for pseudo-classes.") + +(defconst css-pseudo-element-ids + '("after" "before" "first-letter" "first-line") + "Identifiers for pseudo-elements.") (defconst css-at-ids '("charset" "font-face" "import" "media" "page") @@ -258,7 +266,11 @@ (concat "\\(?:" scss--hash-re "\\|[^@/:{} \t\n#]\\)" "[^:{}#]*\\(?:" scss--hash-re "[^:{}#]*\\)*")) - "\\(?::" (regexp-opt css-pseudo-ids t) + ;; Even though pseudo-elements should be prefixed by ::, a + ;; single colon is accepted for backward compatibility. + "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids + css-pseudo-element-ids) t) + "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)" "\\(?:([^\)]+)\\)?" (if (not sassy) "[^:{}\n]*"