annotate lisp/cedet/semantic/bovine/make.el @ 106840:5df8e547a422

Fix typos in docstrings.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 14 Jan 2010 19:59:31 +0100
parents 1d1d5d9bd884
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; semantic/bovine/make.el --- Makefile parsing rules.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106800
diff changeset
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010
105286
378a76e12c8e Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
4 ;; Free Software Foundation, Inc.
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; (at your option) any later version.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;; Commentary:
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;; Use the Semantic Bovinator to parse Makefiles.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; Concocted as an experiment for nonstandard languages.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 (require 'make-mode)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 (require 'semantic)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 (require 'semantic/bovine/make-by)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 (require 'semantic/analyze)
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104506
diff changeset
33 (require 'semantic/dep)
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104506
diff changeset
35 (declare-function semantic-analyze-possible-completions-default
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104506
diff changeset
36 "semantic/analyze/complete")
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 ;;; Code:
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (define-lex-analyzer semantic-lex-make-backslash-no-newline
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 "Detect and create a beginning of line token (BOL)."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (and (looking-at "\\(\\\\\n\\s-*\\)")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 ;; We have a \ at eol. Push it as whitespace, but pretend
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 ;; it never happened so we can skip the BOL tokenizer.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (semantic-lex-push-token (semantic-lex-token 'whitespace
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (match-beginning 1)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (match-end 1)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (goto-char (match-end 1))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 nil) ;; CONTINUE
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 ;; We want to skip BOL, so move to the next condition.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 nil)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 (define-lex-regex-analyzer semantic-lex-make-command
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 "A command in a Makefile consists of a line starting with TAB, and ending at the newline."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 "^\\(\t\\)"
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 (let ((start (match-end 0)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 (while (progn (end-of-line)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 (save-excursion (forward-char -1) (looking-at "\\\\")))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 (forward-char 1))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 (semantic-lex-push-token
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 (semantic-lex-token 'shell-command start (point)))))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 (define-lex-regex-analyzer semantic-lex-make-ignore-automake-conditional
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 "An automake conditional seems to really bog down the parser.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 Ignore them."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 "^@\\(\\w\\|\\s_\\)+@"
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 (setq semantic-lex-end-point (match-end 0)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 (define-lex semantic-make-lexer
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 "Lexical analyzer for Makefiles."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 semantic-lex-beginning-of-line
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 semantic-lex-make-ignore-automake-conditional
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 semantic-lex-make-command
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 semantic-lex-make-backslash-no-newline
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 semantic-lex-whitespace
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 semantic-lex-newline
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 semantic-lex-symbol-or-keyword
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 semantic-lex-charquote
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 semantic-lex-paren-or-list
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 semantic-lex-close-paren
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 semantic-lex-string
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 semantic-lex-ignore-comments
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 semantic-lex-punctuation
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 semantic-lex-default-action)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 (defun semantic-make-expand-tag (tag)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 "Expand TAG into a list of equivalent tags, or nil."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 (let ((name (semantic-tag-name tag))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 xpand)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 ;(message "Expanding %S" name)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 ;(goto-char (semantic-tag-start tag))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 ;(sit-for 0)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 (if (and (consp name)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 (memq (semantic-tag-class tag) '(function include))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 (> (length name) 1))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 (while name
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 (setq xpand (cons (semantic-tag-clone tag (car name)) xpand)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 name (cdr name)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 ;; Else, only a single name.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (when (consp name)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (setcar tag (car name)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (setq xpand (list tag)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 xpand))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 (define-mode-local-override semantic-get-local-variables
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 makefile-mode (&optional point)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 "Override `semantic-get-local-variables' so it does not throw an error.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 We never have local variables in Makefiles."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 nil)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 (define-mode-local-override semantic-ctxt-current-class-list
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 makefile-mode (&optional point)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 "List of classes that are valid to place at point."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (let ((tag (semantic-current-tag)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (when tag
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (cond ((condition-case nil
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (save-excursion
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (condition-case nil (forward-sexp -1)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 (error nil))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (forward-char -2)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (looking-at "\\$\\s("))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (error nil))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 ;; We are in a variable reference
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 '(variable))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 ((semantic-tag-of-class-p tag 'function)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 ;; Note: variables are handled above.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 '(function filename))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 ((semantic-tag-of-class-p tag 'variable)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 '(function filename))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 ))))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (define-mode-local-override semantic-format-tag-abbreviate
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 makefile-mode (tag &optional parent color)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 "Return an abbreviated string describing tag for Makefiles."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 (let ((class (semantic-tag-class tag))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (name (semantic-format-tag-name tag parent color))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 )
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (cond ((eq class 'function)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (concat name ":"))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 ((eq class 'filename)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (concat "./" name))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 (t
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (semantic-format-tag-abbreviate-default tag parent color)))))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (defvar-mode-local makefile-mode semantic-function-argument-separator
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 " "
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 "Separator used between dependencies to rules.")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (define-mode-local-override semantic-format-tag-prototype
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 makefile-mode (tag &optional parent color)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 "Return a prototype string describing tag for Makefiles."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (let* ((class (semantic-tag-class tag))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (name (semantic-format-tag-name tag parent color))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 )
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (cond ((eq class 'function)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (concat name ": "
104470
6ccad1511df1 Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 104452
diff changeset
156 (semantic--format-tag-arguments
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (semantic-tag-function-arguments tag)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 #'semantic-format-tag-prototype
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 color)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 ((eq class 'filename)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (concat "./" name))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (t
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (semantic-format-tag-prototype-default tag parent color)))))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (define-mode-local-override semantic-format-tag-concise-prototype
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 makefile-mode (tag &optional parent color)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 "Return a concise prototype string describing tag for Makefiles.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 This is the same as a regular prototype."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 (semantic-format-tag-prototype tag parent color))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 (define-mode-local-override semantic-format-tag-uml-prototype
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 makefile-mode (tag &optional parent color)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 "Return a UML prototype string describing tag for Makefiles.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 This is the same as a regular prototype."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (semantic-format-tag-prototype tag parent color))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (define-mode-local-override semantic-analyze-possible-completions
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 makefile-mode (context)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 "Return a list of possible completions in a Makefile.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 Uses default implementation, and also gets a list of filenames."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (save-excursion
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104506
diff changeset
182 (require 'semantic/analyze/complete)
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (set-buffer (oref context buffer))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (let* ((normal (semantic-analyze-possible-completions-default context))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 (classes (oref context :prefixclass))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (filetags nil))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (when (memq 'filename classes)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 (let* ((prefix (car (oref context :prefix)))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 (completetext (cond ((semantic-tag-p prefix)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (semantic-tag-name prefix))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 ((stringp prefix)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 prefix)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 ((stringp (car prefix))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 (car prefix))))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (files (directory-files default-directory nil
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (concat "^" completetext))))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (setq filetags (mapcar (lambda (f) (semantic-tag f 'filename))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 files))))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 ;; Return the normal completions found, plus any filenames
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 ;; that match.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (append normal filetags)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 )))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 (defcustom-mode-local-semantic-dependency-system-include-path
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 makefile-mode semantic-makefile-dependency-system-include-path
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 nil
106800
58365d44aeda Fix typos in CEDET docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 105842
diff changeset
207 "The system include path used by Makefiles language.")
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208
104470
6ccad1511df1 Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 104452
diff changeset
209 ;;;###autoload
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 (defun semantic-default-make-setup ()
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 "Set up a Makefile buffer for parsing with semantic."
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (semantic-make-by--install-parser)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 (setq semantic-symbol->name-assoc-list '((variable . "Variables")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 (function . "Rules")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (include . "Dependencies")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 ;; File is a meta-type created
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 ;; to represent completions
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 ;; but not actually parsed.
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 (file . "File"))
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 semantic-case-fold t
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 semantic-tag-expand-function 'semantic-make-expand-tag
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 semantic-lex-syntax-modifications '((?. "_")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 (?= ".")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (?/ "_")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (?$ ".")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (?+ ".")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (?\\ ".")
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 )
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 imenu-create-index-function 'semantic-create-imenu-index
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 )
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (setq semantic-lex-analyzer #'semantic-make-lexer)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 )
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (provide 'semantic/bovine/make)
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235
104470
6ccad1511df1 Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 104452
diff changeset
236 ;; Local variables:
6ccad1511df1 Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 104452
diff changeset
237 ;; generated-autoload-file: "../loaddefs.el"
6ccad1511df1 Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 104452
diff changeset
238 ;; generated-autoload-load-name: "semantic/bovine/make"
6ccad1511df1 Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 104452
diff changeset
239 ;; End:
6ccad1511df1 Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 104452
diff changeset
240
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105286
diff changeset
241 ;; arch-tag: 8122d1f5-d4b7-4f6e-b909-d61ac65ef118
104452
688cf3b99678 lisp/cedet/semantic/bovine/c-by.el
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 ;;; semantic/bovine/make.el ends here