# Simple BNF notation for Makefiles. # # Copyright (C) 1999, 2000, 2001 Eric M. Ludlam # # Author: Eric M. Ludlam # X-RCS: $Id: make.bnf,v 1.12 2001/12/18 02:19:48 zappo Exp $ # # make.bnf is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Emacs; see the file COPYING. If not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # $Log: make.bnf,v $ # Revision 1.12 2001/12/18 02:19:48 zappo # Removed parens and $ from symbol syntax types. # Added IFEQ and IFNEQ tokens # Added BACKSLASH and DOLLAR tokens # Added IFEQ and IFNEQ rule matches # Added $(VAR) types to expression. # Support backslash terminated lines for variables. # # Revision 1.11 2001/12/07 01:36:32 zappo # Added ifdef, and ifndef tokens. (Oy) # # Revision 1.10 2001/12/07 01:32:45 zappo # Added ifdef, and ifndef commands. # # Revision 1.9 2001/11/08 19:40:21 zappo # (Makefile): Handle blank lines # # Revision 1.8 2001/10/03 00:29:01 zappo # Disable number matching. # # Revision 1.7 2001/04/13 02:01:59 zappo # Added a keyword table, and several new tokens and summaries. # Added support for the include macro. # # Revision 1.6 2001/01/24 21:09:21 zappo # Added support for new token formats that use ASSOC. # # Revision 1.5 2000/11/13 21:06:42 zappo # Fixed comment. # # Revision 1.4 2000/09/09 02:09:35 zappo # Use new bnf settings section. # # Revision 1.3 2000/07/01 18:19:01 zappo # Updated for new elements in the tokens. # # Revision 1.2 2000/06/13 14:38:26 zappo # Added special equals and colon NTs # # Revision 1.1 2000/06/11 02:18:47 zappo # Initial revision # %start Makefile %outputfile semantic-make.el %keywordtable semantic-make-keyword-table %parsetable semantic-toplevel-make-bovine-table %languagemode makefile-mode %setupfunction semantic-default-make-setup %quotemode backquote %(setq semantic-flex-enable-newlines t semantic-symbol->name-assoc-list '((variable . "Variables") (function . "Rules") (include . "Dependencies")) semantic-number-expression nil semantic-case-fold t semantic-flex-syntax-modifications '((?. "_") (?= ".") (?/ "_") (?\t ".") (?$ ".") ) semantic-flex-enable-newlines t imenu-create-index-function 'semantic-create-imenu-index )% %token IF "if" %token IFDEF "ifdef" %token IFNDEF "ifndef" %token IFEQ "ifeq" %token IFNEQ "ifneq" %token ELSE "else" %token ENDIF "endif" %put { IF ELSE ENDIF } summary "Conditional: if (expression) ... else ... endif" %put IFDEF summary "Conditional: ifdef (expression) ... else ... endif" %put IFNDEF summary "Conditional: ifndef (expression) ... else ... endif" %put IFEQ summary "Conditional: ifeq (expression) ... else ... endif" %put IFNEQ summary "Conditional: ifneq (expression) ... else ... endif" %token INCLUDE "include" %put INCLUDE summary "Macro: include filename1 filename2 ..." %token COLON punctuation ":" %token PLUS punctuation "+" %token EQUAL punctuation "=" %token BACKSLASH punctuation "\\" %token DOLLAR punctuation "$" Makefile : variable | rule | conditional | include | newline ( nil ) ; variable: symbol equals elements (,$1 variable nil ,$3 nil nil) ; rule: symbol colons elements commands (,$1 function nil ,$3 nil nil) ; conditional: IF symbol newline ( ) | IFDEF symbol newline ( ) | IFNDEF symbol newline ( ) | IFEQ expression newline ( ) | IFNEQ expression newline ( ) | ELSE newline ( ) | ENDIF newline ( ) ; expression : semantic-list ; include: INCLUDE symbol elements (,$2 include nil) ; equals: COLON EQUAL () | PLUS EQUAL () | EQUAL () ; colons: COLON COLON () | COLON () ; elements: element elements ( ,$1 ,@$2 ) | element BACKSLASH newline elements ( ,$1 ,@$2 ) | element newline ( ,$1 ) | newline ( ) ; element: symbol | varref ; varref: DOLLAR semantic-list ( (buffer-substring-no-properties (identity start) (identity end)) ) ; commands: shell-command newline commands ( ,$1 ,@$2 ) | EMPTY ( ) ; # End