diff options
author | immerrr <immerrr@gmail.com> | 2014-03-07 12:40:51 +0400 |
---|---|---|
committer | immerrr <immerrr@gmail.com> | 2014-03-07 12:40:51 +0400 |
commit | 0a7e8d6047f3fdd5a733ed9ed3baa60dabf612be (patch) | |
tree | 8b6811c15b245179beddfa28c91ff05afe62c102 /Tools | |
parent | 3d6f0126b8381f9b4e790bab813f5681d75f6787 (diff) | |
download | cython-0a7e8d6047f3fdd5a733ed9ed3baa60dabf612be.tar.gz |
cython-mode.el: don't highlight builtins when they're part of varname
To avoid mismatches keywords should be checked at symbol, not word
boundaries, otherwise they'll ignore underscores (is_*float*).
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/cython-mode.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Tools/cython-mode.el b/Tools/cython-mode.el index 5ff6d4a82..4a5a90f5b 100644 --- a/Tools/cython-mode.el +++ b/Tools/cython-mode.el @@ -47,19 +47,23 @@ (defvar cython-font-lock-keywords `(;; new keywords in Cython language - (,(regexp-opt '("by" "cdef" "cimport" "cpdef" "ctypedef" "enum" "except?" - "extern" "gil" "include" "nogil" "property" "public" - "readonly" "struct" "union" "DEF" "IF" "ELIF" "ELSE") 'words) + (,(rx symbol-start + (or "by" "cdef" "cimport" "cpdef" "ctypedef" "enum" "except?" + "extern" "gil" "include" "nogil" "property" "public" + "readonly" "struct" "union" "DEF" "IF" "ELIF" "ELSE") + symbol-end) 1 font-lock-keyword-face) ;; C and Python types (highlight as builtins) - (,(regexp-opt '("NULL" "bint" "char" "dict" "double" "float" "int" "list" - "long" "object" "Py_ssize_t" "short" "size_t" "void") 'words) + (,(rx symbol-start + (or "NULL" "bint" "char" "dict" "double" "float" "int" "list" + "long" "object" "Py_ssize_t" "short" "size_t" "void") + symbol-end) 1 font-lock-builtin-face) ;; cdef is used for more than functions, so simply highlighting the next ;; word is problematic. struct, enum and property work though. - ("\\<\\(?:struct\\|enum\\)[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)" + ("\\_<\\(?:struct\\|enum\\)[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)" 1 py-class-name-face) - ("\\<property[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)" + ("\\_<property[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)" 1 font-lock-function-name-face)) "Additional font lock keywords for Cython mode.") |