Mercurial > emacs
comparison lisp/progmodes/gud.el @ 75756:97721109e77f
(gdb-script-font-lock-syntactic-keywords): Improve comments.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 10 Feb 2007 20:21:28 +0000 |
parents | e3694f1cb928 |
children | 5b3f284c883e 52a7f3f50b89 |
comparison
equal
deleted
inserted
replaced
75755:2b38ddd3fe74 | 75756:97721109e77f |
---|---|
3175 (defvar gdb-script-font-lock-keywords | 3175 (defvar gdb-script-font-lock-keywords |
3176 '(("^define\\s-+\\(\\(\\w\\|\\s_\\)+\\)" (1 font-lock-function-name-face)) | 3176 '(("^define\\s-+\\(\\(\\w\\|\\s_\\)+\\)" (1 font-lock-function-name-face)) |
3177 ("\\$\\(\\w+\\)" (1 font-lock-variable-name-face)) | 3177 ("\\$\\(\\w+\\)" (1 font-lock-variable-name-face)) |
3178 ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face)))) | 3178 ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face)))) |
3179 | 3179 |
3180 ;; FIXME: The keyword "end" associated with "document" | |
3181 ;; should have font-lock-keyword-face (currently font-lock-doc-face). | |
3182 (defvar gdb-script-font-lock-syntactic-keywords | 3180 (defvar gdb-script-font-lock-syntactic-keywords |
3183 '(("^document\\s-.*\\(\n\\)" (1 "< b")) | 3181 '(("^document\\s-.*\\(\n\\)" (1 "< b")) |
3184 ;; It would be best to change the \n in front, but it's more difficult. | |
3185 ("^end\\>" | 3182 ("^end\\>" |
3186 (0 (progn | 3183 (0 (unless (eq (match-beginning 0) (point-min)) |
3187 (unless (eq (match-beginning 0) (point-min)) | 3184 ;; We change the \n in front, which is more difficult, but results |
3188 (put-text-property (1- (match-beginning 0)) (match-beginning 0) | 3185 ;; in better highlighting. If the doc is empty, the single \n is |
3189 'syntax-table (eval-when-compile | 3186 ;; both the beginning and the end of the docstring, which can't be |
3190 (string-to-syntax "> b"))) | 3187 ;; expressed in syntax-tables. Instead, we place the "> b" after |
3191 (put-text-property (1- (match-beginning 0)) (match-end 0) | 3188 ;; placing the "< b", so the start marker is overwritten by the |
3192 'font-lock-multiline t) | 3189 ;; termination marker and in the end Emacs simply considers that |
3193 nil)))))) | 3190 ;; there's no docstring at all, which is fine. |
3191 (put-text-property (1- (match-beginning 0)) (match-beginning 0) | |
3192 'syntax-table (eval-when-compile | |
3193 (string-to-syntax "> b"))) | |
3194 ;; Make sure that rehighlighting the previous line won't erase our | |
3195 ;; syntax-table property. | |
3196 (put-text-property (1- (match-beginning 0)) (match-end 0) | |
3197 'font-lock-multiline t) | |
3198 nil))))) | |
3194 | 3199 |
3195 (defun gdb-script-font-lock-syntactic-face (state) | 3200 (defun gdb-script-font-lock-syntactic-face (state) |
3196 (cond | 3201 (cond |
3197 ((nth 3 state) font-lock-string-face) | 3202 ((nth 3 state) font-lock-string-face) |
3198 ((nth 7 state) font-lock-doc-face) | 3203 ((nth 7 state) font-lock-doc-face) |