diff options
| author | Chong Yidong | 2010-07-10 15:01:01 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-07-10 15:01:01 -0400 |
| commit | 7ac1c664547ca88fd6c0ff65ef5e780b1c5efcb0 (patch) | |
| tree | 301c219611060db34a983f5b7dba58cf1fa93b69 /lisp/progmodes/python.el | |
| parent | 481044622937b001ee07a6f8c3f81c1e73ef9eaf (diff) | |
| parent | 2ec1b5ee3464999a18b8197101e8bf08a3c564a8 (diff) | |
| download | emacs-7ac1c664547ca88fd6c0ff65ef5e780b1c5efcb0.tar.gz emacs-7ac1c664547ca88fd6c0ff65ef5e780b1c5efcb0.zip | |
Merge changes from emacs-23 branch.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4e0f326e2d4..2b09e346331 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -93,7 +93,7 @@ | |||
| 93 | 93 | ||
| 94 | (defvar python-font-lock-keywords | 94 | (defvar python-font-lock-keywords |
| 95 | `(,(rx symbol-start | 95 | `(,(rx symbol-start |
| 96 | ;; From v 2.5 reference, § keywords. | 96 | ;; From v 2.7 reference, § keywords. |
| 97 | ;; def and class dealt with separately below | 97 | ;; def and class dealt with separately below |
| 98 | (or "and" "as" "assert" "break" "continue" "del" "elif" "else" | 98 | (or "and" "as" "assert" "break" "continue" "del" "elif" "else" |
| 99 | "except" "exec" "finally" "for" "from" "global" "if" | 99 | "except" "exec" "finally" "for" "from" "global" "if" |
| @@ -102,7 +102,7 @@ | |||
| 102 | ;; Not real keywords, but close enough to be fontified as such | 102 | ;; Not real keywords, but close enough to be fontified as such |
| 103 | "self" "True" "False") | 103 | "self" "True" "False") |
| 104 | symbol-end) | 104 | symbol-end) |
| 105 | (,(rx symbol-start "None" symbol-end) ; see § Keywords in 2.5 manual | 105 | (,(rx symbol-start "None" symbol-end) ; see § Keywords in 2.7 manual |
| 106 | . font-lock-constant-face) | 106 | . font-lock-constant-face) |
| 107 | ;; Definitions | 107 | ;; Definitions |
| 108 | (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_)))) | 108 | (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_)))) |
| @@ -117,7 +117,7 @@ | |||
| 117 | (0+ "." (1+ (or word ?_))))) | 117 | (0+ "." (1+ (or word ?_))))) |
| 118 | (1 font-lock-type-face)) | 118 | (1 font-lock-type-face)) |
| 119 | ;; Built-ins. (The next three blocks are from | 119 | ;; Built-ins. (The next three blocks are from |
| 120 | ;; `__builtin__.__dict__.keys()' in Python 2.5.1.) These patterns | 120 | ;; `__builtin__.__dict__.keys()' in Python 2.7) These patterns |
| 121 | ;; are debateable, but they at least help to spot possible | 121 | ;; are debateable, but they at least help to spot possible |
| 122 | ;; shadowing of builtins. | 122 | ;; shadowing of builtins. |
| 123 | (,(rx symbol-start (or | 123 | (,(rx symbol-start (or |
| @@ -135,7 +135,9 @@ | |||
| 135 | "SystemExit" "TabError" "TypeError" "UnboundLocalError" | 135 | "SystemExit" "TabError" "TypeError" "UnboundLocalError" |
| 136 | "UnicodeDecodeError" "UnicodeEncodeError" "UnicodeError" | 136 | "UnicodeDecodeError" "UnicodeEncodeError" "UnicodeError" |
| 137 | "UnicodeTranslateError" "UnicodeWarning" "UserWarning" | 137 | "UnicodeTranslateError" "UnicodeWarning" "UserWarning" |
| 138 | "ValueError" "Warning" "ZeroDivisionError") symbol-end) | 138 | "ValueError" "Warning" "ZeroDivisionError" |
| 139 | ;; Python 2.7 | ||
| 140 | "BufferError" "BytesWarning" "WindowsError") symbol-end) | ||
| 139 | . font-lock-type-face) | 141 | . font-lock-type-face) |
| 140 | (,(rx (or line-start (not (any ". \t"))) (* (any " \t")) symbol-start | 142 | (,(rx (or line-start (not (any ". \t"))) (* (any " \t")) symbol-start |
| 141 | (group (or | 143 | (group (or |
| @@ -152,12 +154,16 @@ | |||
| 152 | "range" "raw_input" "reduce" "reload" "repr" "reversed" | 154 | "range" "raw_input" "reduce" "reload" "repr" "reversed" |
| 153 | "round" "set" "setattr" "slice" "sorted" "staticmethod" | 155 | "round" "set" "setattr" "slice" "sorted" "staticmethod" |
| 154 | "str" "sum" "super" "tuple" "type" "unichr" "unicode" "vars" | 156 | "str" "sum" "super" "tuple" "type" "unichr" "unicode" "vars" |
| 155 | "xrange" "zip")) symbol-end) | 157 | "xrange" "zip" |
| 158 | ;; Python 2.7. | ||
| 159 | "bin" "bytearray" "bytes" "format" "memoryview" "next" "print" | ||
| 160 | )) symbol-end) | ||
| 156 | (1 font-lock-builtin-face)) | 161 | (1 font-lock-builtin-face)) |
| 157 | (,(rx symbol-start (or | 162 | (,(rx symbol-start (or |
| 158 | ;; other built-ins | 163 | ;; other built-ins |
| 159 | "True" "False" "None" "Ellipsis" | 164 | "True" "False" "None" "Ellipsis" |
| 160 | "_" "__debug__" "__doc__" "__import__" "__name__") symbol-end) | 165 | "_" "__debug__" "__doc__" "__import__" "__name__" "__package__") |
| 166 | symbol-end) | ||
| 161 | . font-lock-builtin-face))) | 167 | . font-lock-builtin-face))) |
| 162 | 168 | ||
| 163 | (defconst python-font-lock-syntactic-keywords | 169 | (defconst python-font-lock-syntactic-keywords |