1 # Simple BNF notation for Makefiles.
3 # Copyright (C) 1999, 2000, 2001, 2002 Eric M. Ludlam
5 # Author: Eric M. Ludlam <zappo@gnu.org>
6 # X-RCS: $Id: make.bnf,v 1.13 2002/05/07 01:31:15 zappo Exp $
8 # make.bnf is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This software is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs; see the file COPYING. If not, write to the
20 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 # Boston, MA 02111-1307, USA.
24 # Revision 1.13 2002/05/07 01:31:15 zappo
25 # Merged from v1_4 branch.
27 # Revision 1.12.2.2 2002/02/19 21:35:09 zappo
28 # (setup): Enable whitespace
29 # (BACKSLASH): New token
30 # (variable rule conditional targets include): Use whitespace where needed.
31 # (targets): Enable subtarget groupings w/ mixed variables.
32 # (target sub-target): New rules
33 # (element-list, element, sub-element): New rules
34 # (elements): Enable mixed groupings.
35 # (opt-whitespace): New rule.
37 # Revision 1.12.2.1 2002/02/10 18:06:04 zappo
38 # (semantic-flex-syntax-modifications): Remove tab.
39 # (conditional): Return explicit nils.
41 # Revision 1.12 2001/12/18 02:19:48 zappo
42 # Removed parens and $ from symbol syntax types.
43 # Added IFEQ and IFNEQ tokens
44 # Added BACKSLASH and DOLLAR tokens
45 # Added IFEQ and IFNEQ rule matches
46 # Added $(VAR) types to expression.
47 # Support backslash terminated lines for variables.
49 # Revision 1.11 2001/12/07 01:36:32 zappo
50 # Added ifdef, and ifndef tokens. (Oy)
52 # Revision 1.10 2001/12/07 01:32:45 zappo
53 # Added ifdef, and ifndef commands.
55 # Revision 1.9 2001/11/08 19:40:21 zappo
56 # (Makefile): Handle blank lines
58 # Revision 1.8 2001/10/03 00:29:01 zappo
59 # Disable number matching.
61 # Revision 1.7 2001/04/13 02:01:59 zappo
62 # Added a keyword table, and several new tokens and summaries.
63 # Added support for the include macro.
65 # Revision 1.6 2001/01/24 21:09:21 zappo
66 # Added support for new token formats that use ASSOC.
68 # Revision 1.5 2000/11/13 21:06:42 zappo
71 # Revision 1.4 2000/09/09 02:09:35 zappo
72 # Use new bnf settings section.
74 # Revision 1.3 2000/07/01 18:19:01 zappo
75 # Updated for new elements in the tokens.
77 # Revision 1.2 2000/06/13 14:38:26 zappo
78 # Added special equals and colon NTs
80 # Revision 1.1 2000/06/11 02:18:47 zappo
85 %outputfile semantic-make.el
86 %keywordtable semantic-make-keyword-table
87 %parsetable semantic-toplevel-make-bovine-table
88 %languagemode makefile-mode
89 %setupfunction semantic-default-make-setup
92 %(setq semantic-symbol->name-assoc-list '((variable . "Variables")
94 (include . "Dependencies"))
95 semantic-number-expression nil
97 semantic-expand-nonterminal 'semantic-expand-make-nonterminal
98 semantic-flex-syntax-modifications '((?. "_")
103 semantic-flex-enable-newlines t
104 semantic-flex-enable-whitespace t
105 imenu-create-index-function 'semantic-create-imenu-index
110 %token IFNDEF "ifndef"
115 %put { IF ELSE ENDIF } summary "Conditional: if (expression) ... else ... endif"
116 %put IFDEF summary "Conditional: ifdef (expression) ... else ... endif"
117 %put IFNDEF summary "Conditional: ifndef (expression) ... else ... endif"
118 %put IFEQ summary "Conditional: ifeq (expression) ... else ... endif"
119 %put IFNEQ summary "Conditional: ifneq (expression) ... else ... endif"
120 %token INCLUDE "include"
121 %put INCLUDE summary "Macro: include filename1 filename2 ..."
123 %token COLON punctuation ":"
124 %token PLUS punctuation "+"
125 %token EQUAL punctuation "="
126 %token DOLLAR punctuation "$"
127 %token BACKSLASH punctuation "\\"
137 variable: symbol opt-whitespace equals opt-whitespace element-list
138 (,$1 variable nil ,$5 nil nil)
141 rule: targets opt-whitespace colons opt-whitespace element-list commands
142 (,$1 function nil ,$5 nil nil)
145 targets: target opt-whitespace targets
146 ( (car ,$1) (car ,@$3) )
151 target: sub-target target
152 ( (concat (car ,$1) (car ,@$3) ) )
162 conditional: IF whitespace symbol newline
164 | IFDEF whitespace symbol newline
166 | IFNDEF whitespace symbol newline
168 | IFEQ whitespace expression newline
170 | IFNEQ whitespace expression newline
178 expression : semantic-list
181 include: INCLUDE whitespace element-list
182 (,$3 include nil nil)
185 equals: COLON EQUAL ()
190 colons: COLON COLON ()
194 element-list: elements newline
198 elements: element whitespace elements
205 element: sub-element element
206 ( (concat (car ,$1) (car ,$2)) )
214 ( (buffer-substring-no-properties
215 (identity start) (identity end)) )
218 varref: DOLLAR semantic-list
219 ( (buffer-substring-no-properties (identity start) (identity end)) )
222 commands: shell-command newline commands
228 opt-whitespace : whitespace ( nil )