comparison lisp/progmodes/make-mode.el @ 16511:f81633edcbf5

(makefile-font-lock-keywords): Handle dependencies first and variable references after. (makefile-dependency-regex, makefile-macroassign-regex): Accept spaces at the beginning of the line.
author Richard M. Stallman <rms@gnu.org>
date Sun, 03 Nov 1996 20:38:56 +0000
parents 5c354ae6e9ae
children 5b46703f3b30
comparison
equal deleted inserted replaced
16510:e619a826afdb 16511:f81633edcbf5
186 186
187 ;; Note that the first big subexpression is used by font lock. Note 187 ;; Note that the first big subexpression is used by font lock. Note
188 ;; that if you change this regexp you must fix the imenu index 188 ;; that if you change this regexp you must fix the imenu index
189 ;; function defined at the end of the file. 189 ;; function defined at the end of the file.
190 (defconst makefile-dependency-regex 190 (defconst makefile-dependency-regex
191 "^\\([^ \n\t#:]+\\([ \t]+[^ \t\n#:]+\\)*\\)[ \t]*:\\([ \t]*$\\|\\([^=\n].*$\\)\\)" 191 "^ *\\([^\n\t#:]+\\([ \t]+[^ \t\n#:]+\\)*\\)[ \t]*:\\([ \t]*$\\|\\([^=\n].*$\\)\\)"
192 "Regex used to find dependency lines in a makefile.") 192 "Regex used to find dependency lines in a makefile.")
193 193
194 ;; Note that the first subexpression is used by font lock. Note that 194 ;; Note that the first subexpression is used by font lock. Note that
195 ;; if you change this regexp you must fix the imenu index function 195 ;; if you change this regexp you must fix the imenu index function
196 ;; defined at the end of the file. 196 ;; defined at the end of the file.
197 (defconst makefile-macroassign-regex 197 (defconst makefile-macroassign-regex
198 "^\\([^ \n\t][^:#= \t\n]*\\)[ \t]*[*:+]?:?=" 198 "^ *\\([^\n\t][^:#= \t\n]*\\)[ \t]*[*:+]?:?="
199 "Regex used to find macro assignment lines in a makefile.") 199 "Regex used to find macro assignment lines in a makefile.")
200 200
201 (defconst makefile-ignored-files-in-pickup-regex 201 (defconst makefile-ignored-files-in-pickup-regex
202 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)" 202 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)"
203 "Regex for filenames that will NOT be included in the target list.") 203 "Regex for filenames that will NOT be included in the target list.")
211 (list 211 (list
212 ;; Do macro assignments. These get the "variable-name" face rather 212 ;; Do macro assignments. These get the "variable-name" face rather
213 ;; arbitrarily. 213 ;; arbitrarily.
214 (list makefile-macroassign-regex 1 'font-lock-variable-name-face) 214 (list makefile-macroassign-regex 1 'font-lock-variable-name-face)
215 ;; 215 ;;
216 ;; Do dependencies. These get the function name face.
217 (list makefile-dependency-regex 1 'font-lock-function-name-face)
218 ;;
216 ;; Variable references even in targets/strings/comments: 219 ;; Variable references even in targets/strings/comments:
217 '("\\$[({]\\([-a-zA-Z0-9_.]+\\)[}):]" 1 font-lock-reference-face prepend) 220 '("\\$[({]\\([-a-zA-Z0-9_.]+\\)[}):]" 1 font-lock-reference-face prepend)
218 ;;
219 ;; Do dependencies. These get the function name face.
220 (list makefile-dependency-regex 1 'font-lock-function-name-face 'prepend)
221 221
222 ;; Highlight lines that contain just whitespace. 222 ;; Highlight lines that contain just whitespace.
223 ;; They can cause trouble, especially if they start with a tab. 223 ;; They can cause trouble, especially if they start with a tab.
224 '("^[ \t]+$" . makefile-space-face) 224 '("^[ \t]+$" . makefile-space-face)
225 225