Remove non-free old and crusty clearcase pkg
[packages] / xemacs-packages / semantic / make.bnf
1 # Simple BNF notation for Makefiles.
2 #
3 # Copyright (C) 1999, 2000, 2001, 2002 Eric M. Ludlam
4 #
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 $
7 #
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)
11 # any later version.
12 #
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.
17 #
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.
22 #
23 # $Log: make.bnf,v $
24 # Revision 1.13  2002/05/07 01:31:15  zappo
25 # Merged from v1_4 branch.
26 #
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.
36 #
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.
40 #
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.
48 #
49 # Revision 1.11  2001/12/07 01:36:32  zappo
50 # Added ifdef, and ifndef tokens.  (Oy)
51 #
52 # Revision 1.10  2001/12/07 01:32:45  zappo
53 # Added ifdef, and ifndef commands.
54 #
55 # Revision 1.9  2001/11/08 19:40:21  zappo
56 # (Makefile): Handle blank lines
57 #
58 # Revision 1.8  2001/10/03 00:29:01  zappo
59 # Disable number matching.
60 #
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.
64 #
65 # Revision 1.6  2001/01/24 21:09:21  zappo
66 # Added support for new token formats that use ASSOC.
67 #
68 # Revision 1.5  2000/11/13 21:06:42  zappo
69 # Fixed comment.
70 #
71 # Revision 1.4  2000/09/09 02:09:35  zappo
72 # Use new bnf settings section.
73 #
74 # Revision 1.3  2000/07/01 18:19:01  zappo
75 # Updated for new elements in the tokens.
76 #
77 # Revision 1.2  2000/06/13 14:38:26  zappo
78 # Added special equals and colon NTs
79 #
80 # Revision 1.1  2000/06/11 02:18:47  zappo
81 # Initial revision
82 #
83
84 %start         Makefile
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
90 %quotemode     backquote
91
92 %(setq semantic-symbol->name-assoc-list '((variable . "Variables")
93                                           (function . "Rules")
94                                           (include . "Dependencies"))
95        semantic-number-expression nil
96        semantic-case-fold t
97        semantic-expand-nonterminal 'semantic-expand-make-nonterminal
98        semantic-flex-syntax-modifications '((?. "_")
99                                             (?= ".")
100                                             (?/ "_")
101                                             (?$ ".")
102                                             )
103        semantic-flex-enable-newlines t
104        semantic-flex-enable-whitespace t
105        imenu-create-index-function 'semantic-create-imenu-index
106        )%
107
108 %token IF "if"
109 %token IFDEF "ifdef"
110 %token IFNDEF "ifndef"
111 %token IFEQ "ifeq"
112 %token IFNEQ "ifneq"
113 %token ELSE "else"
114 %token ENDIF "endif"
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 ..."
122
123 %token COLON punctuation ":"
124 %token PLUS punctuation "+"
125 %token EQUAL punctuation "="
126 %token DOLLAR punctuation "$"
127 %token BACKSLASH punctuation "\\"
128
129 Makefile : variable
130          | rule
131          | conditional
132          | include
133          | whitespace ( nil )
134          | newline ( nil )
135          ;
136
137 variable: symbol opt-whitespace equals opt-whitespace element-list
138           (,$1 variable nil ,$5 nil nil)
139         ;
140
141 rule: targets opt-whitespace colons opt-whitespace element-list commands
142       (,$1 function nil ,$5 nil nil)
143     ;
144
145 targets: target opt-whitespace targets
146          ( (car ,$1) (car ,@$3) )
147        | target
148          ( (car ,$1) )
149        ;
150
151 target: sub-target target
152         ( (concat (car ,$1) (car ,@$3) ) )
153       | sub-target
154         ( (car ,$1) )
155       ;
156
157 sub-target: symbol
158           | string
159           | varref
160           ;
161
162 conditional: IF whitespace symbol newline
163              ( nil )
164            | IFDEF whitespace symbol newline
165              ( nil )
166            | IFNDEF whitespace symbol newline
167              ( nil )
168            | IFEQ whitespace expression newline
169              ( nil )
170            | IFNEQ whitespace expression newline
171              ( nil )
172            | ELSE newline
173              ( nil )
174            | ENDIF newline
175              ( nil )
176            ;
177
178 expression : semantic-list
179            ;
180
181 include: INCLUDE whitespace element-list
182          (,$3 include nil nil)
183        ;
184
185 equals: COLON EQUAL ()
186       | PLUS EQUAL ()
187       | EQUAL ()
188       ;
189
190 colons: COLON COLON ()
191       | COLON ()
192       ;
193
194 element-list: elements newline
195               ( ,@$1 )
196             ;
197
198 elements: element whitespace elements
199           ( ,$1 ,@$3 )
200         | element
201           ( ,$1 )
202         | EMPTY
203         ;
204   
205 element: sub-element element
206          ( (concat (car ,$1) (car ,$2)) )
207        | EMPTY
208        ;
209
210 sub-element: symbol
211            | string
212            | punctuation
213            | semantic-list
214              ( (buffer-substring-no-properties
215                  (identity start) (identity end)) )
216            ;
217
218 varref: DOLLAR semantic-list
219         ( (buffer-substring-no-properties (identity start) (identity end)) )
220       ;
221
222 commands: shell-command newline commands
223           ( ,$1 ,@$2 )
224         | EMPTY
225           ( )
226         ;
227
228 opt-whitespace : whitespace ( nil )
229                | EMPTY
230                ;
231 # End