Source

semantic / make.bnf

# Simple BNF notation for Makefiles.
#
# Copyright (C) 1999, 2000 Eric M. Ludlam
#
# Author: Eric M. Ludlam <zappo@gnu.org>
# X-RCS: $Id$
#
# 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$
# 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
%parsetable    semantic-toplevel-make-bovine-table
%languagemode  make-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-case-fold t
       semantic-flex-syntax-modifications '((?. "_")
					    (?= ".")
					    (?/ "_")
					    (?\t ".")
					    (?( "_")
					    (?) "_")
					    (?{ "_")
					    (?} "_")
					    (?$ "_")
					    )
       semantic-flex-enable-newlines t
       imenu-create-index-function 'semantic-create-imenu-index
       )%


Makefile : variable
	 | rule
	 | conditional
	 ;

variable: symbol equals elements
	  (,$1 variable nil nil ,$3 nil nil)
	;

rule: symbol colons elements commands
      (,$1 function nil ,$3 nil nil)
    ;

conditional: symbol "if" symbol newline
	     ( nil )
	   | symbol "else" newline
	     ( nil )
	   | symbol "endif" newline
	     ( nil )
	   ;

equals: punctuation ":" punctuation "="	()
      | punctuation "+" punctuation "="	()
      | punctuation "="	()
      ;

colons: punctuation ":" punctuation ":" ()
      | punctuation ":" ()
      ;

elements: symbol elements
	  ( ,$1 ,@$2 )
	| symbol newline
	  ( ,$1 )
	| newline
	  (  )
	;
  
commands: shell-command newline commands
	  ( ,$1 ,@$2 )
	| EMPTY
	  ( )
	;

# End
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.