Commit f9b697dd authored by Glenn Morris's avatar Glenn Morris

Stop keeping (all but one) generated cedet grammar files in the repository

* configure.ac (SUBDIR_MAKEFILES, AC_CONFIG_FILES):
Add admin/grammars Makefile.

* Makefile.in (distclean, bootstrap-clean, maintainer-clean):
Also clean admin/grammars, if present.

* admin/grammars/README: Remove.

* admin/grammars/Makefile.in: New file.

* admin/grammars/c.by, admin/grammars/java-tags.wy, admin/grammars/js.wy:
* admin/grammars/python.wy: Update declarations to match generated outputs.

* lisp/Makefile.in (semantic): New.
(compile-main): Depend on semantic.

* lisp/cedet/semantic/bovine/grammar.el (bovine--make-parser-1):
New function, split from bovine-make-parsers.
(bovine-make-parsers): Use bovine--make-parser-1.
(bovine-batch-make-parser): New function.

* lisp/cedet/semantic/wisent/grammar.el (wisent--make-parser-1):
New function, split from wisent-make-parsers.
(wisent-make-parsers): Use wisent--make-parser-1.
(wisent-batch-make-parser): New function.

* lisp/cedet/semantic/db.el (semanticdb-save-all-db):
Avoid prompting in batch mode.

* lisp/cedet/semantic/grammar.el (semantic-grammar-footer-template):
Disable version-control and autoloads in the output.
(semantic-grammar-create-package):
Add option to return nil if output is up-to-date.

* lisp/cedet/semantic/bovine/c-by.el, lisp/cedet/semantic/bovine/make-by.el:
* lisp/cedet/semantic/bovine/scm-by.el, lisp/cedet/semantic/wisent/javat-wy.el:
* lisp/cedet/semantic/wisent/js-wy.el, lisp/cedet/semantic/wisent/python-wy.el:
* lisp/cedet/srecode/srt-wy.el: Remove generated files from repository.

* .bzrignore: Update for this.
parent a64133bd
2013-11-30 Glenn Morris <rgm@gnu.org>
Stop keeping (most) generated cedet grammar files in the repository.
* configure.ac (SUBDIR_MAKEFILES, AC_CONFIG_FILES):
Add admin/grammars Makefile.
* Makefile.in (distclean, bootstrap-clean, maintainer-clean):
Also clean admin/grammars, if present.
2013-11-29 Dani Moncayo <dmoncayo@gmail.com>
* Makefile.in (epaths-force-w32): Fix 2013-11-20 typo.
......
......@@ -857,7 +857,7 @@ distclean: FRC
cd leim && $(MAKE) $(MFLAGS) distclean
cd lisp && $(MAKE) $(MFLAGS) distclean
cd nextstep && $(MAKE) $(MFLAGS) distclean
for dir in test/automated admin/unidata; do \
for dir in test/automated admin/grammars admin/unidata; do \
[ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) distclean); \
done
${top_distclean}
......@@ -879,7 +879,7 @@ bootstrap-clean: FRC
cd leim && $(MAKE) $(MFLAGS) bootstrap-clean
cd lisp && $(MAKE) $(MFLAGS) bootstrap-clean
cd nextstep && $(MAKE) $(MFLAGS) maintainer-clean
for dir in test/automated admin/unidata; do \
for dir in test/automated admin/grammars admin/unidata; do \
[ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) bootstrap-clean); \
done
[ ! -f config.log ] || mv -f config.log config.log~
......@@ -903,7 +903,7 @@ maintainer-clean: bootstrap-clean FRC
cd src && $(MAKE) $(MFLAGS) maintainer-clean
cd leim && $(MAKE) $(MFLAGS) maintainer-clean
cd lisp && $(MAKE) $(MFLAGS) maintainer-clean
for dir in test/automated admin/unidata; do \
for dir in test/automated admin/grammars admin/unidata; do \
[ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) maintainer-clean); \
done
${top_maintainer_clean}
......
2013-11-30 Glenn Morris <rgm@gnu.org>
Stop keeping (most) generated cedet grammar files in the repository.
* grammars/README: Remove.
* grammars/Makefile.in: New file.
* grammars/c.by, grammars/java-tags.wy, grammars/js.wy:
* grammars/python.wy: Update declarations to match generated outputs.
2013-11-28 Glenn Morris <rgm@gnu.org>
* unidata/unidata-gen.el (unidata-gen-files):
......
### @configure_input@
## Copyright (C) 2013 Free Software Foundation, Inc.
## This file is part of GNU Emacs.
## GNU Emacs 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 3 of the License, or
## (at your option) any later version.
## GNU Emacs 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. If not, see <http://www.gnu.org/licenses/>.
### Commentary:
## This directory contains grammar files in Bison and Wisent,
## used to generate the parser data in the lisp/cedet directory.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
EMACS = ${top_builddir}/src/emacs
emacs = EMACSLOADPATH= "${EMACS}" -batch --no-site-file --no-site-lisp
make_bovine = ${emacs} -l semantic/bovine/grammar -f bovine-batch-make-parser
make_wisent = ${emacs} -l semantic/wisent/grammar -f wisent-batch-make-parser
cedetdir = ${top_srcdir}/lisp/cedet
bovinedir = ${cedetdir}/semantic/bovine
wisentdir = ${cedetdir}/semantic/wisent
BOVINE = \
${bovinedir}/c-by.el \
${bovinedir}/make-by.el \
${bovinedir}/scm-by.el
## FIXME Should include this one too:
## ${cedetdir}/semantic/grammar-wy.el
## but semantic/grammar.el (which is what we use to generate grammar-wy.el)
## requires it!
WISENT = \
${wisentdir}/javat-wy.el \
${wisentdir}/js-wy.el \
${wisentdir}/python-wy.el \
${cedetdir}/srecode/srt-wy.el
ALL = ${BOVINE} ${WISENT}
.PHONY: all bovine wisent
all: ${ALL}
bovine: ${BOVINE}
wisent: ${WISENT}
${bovinedir}/c-by.el: ${srcdir}/c.by
${make_bovine} -o "$@" ${srcdir}/c.by
${bovinedir}/make-by.el: ${srcdir}/make.by
${make_bovine} -o "$@" ${srcdir}/make.by
${bovinedir}/scm-by.el: ${srcdir}/scheme.by
${make_bovine} -o "$@" ${srcdir}/scheme.by
${cedetdir}/semantic/grammar-wy.el: ${srcdir}/grammar.wy
${make_wisent} -o "$@" ${srcdir}/grammar.wy
${wisentdir}/javat-wy.el: ${srcdir}/java-tags.wy
${make_wisent} -o "$@" ${srcdir}/java-tags.wy
${wisentdir}/js-wy.el: ${srcdir}/js.wy
${make_wisent} -o "$@" ${srcdir}/js.wy
${wisentdir}/python-wy.el: ${srcdir}/python.wy
${make_wisent} -o "$@" ${srcdir}/python.wy
${cedetdir}/srecode/srt-wy.el: ${srcdir}/srecode-template.wy
${make_wisent} -o "$@" ${srcdir}/srecode-template.wy
.PHONY: distclean bootstrap-clean maintainer-clean extraclean
distclean:
rm -f Makefile
bootstrap-clean maintainer-clean: distclean
## We do not normally delete the generated files, even in bootstrap.
## Creating them does not take long, so we could easily change this.
extraclean:
rm -f ${ALL}
# Makefile.in ends here
This directory contains grammar files in Bison and Wisent, used to
generate the parser data in the lisp/semantic/bovine/ and
lisp/semantic/wisent/ directories. You can run the parser generators
with
emacs -batch -Q -l semantic/bovine/grammar -f bovine-make-parsers
emacs -batch -Q -l semantic/wisent/grammar -f wisent-make-parsers
Currently, the parser files in lisp/ are not generated directly from
these grammar files when making Emacs. This state of affairs, and the
contents of this directory, will change in a future version of Emacs.
......@@ -41,9 +41,13 @@
%provide semantic/bovine/c-by
%{
(declare-function semantic-c-reconstitute-token "semantic/bovine/c")
(declare-function semantic-c-reconstitute-template "semantic/bovine/c")
(declare-function semantic-expand-c-tag "semantic/bovine/c")
(declare-function semantic-c-reconstitute-token "semantic/bovine/c"
(tokenpart declmods typedecl))
(declare-function semantic-c-reconstitute-template "semantic/bovine/c"
(tag specifier))
(declare-function semantic-expand-c-tag "semantic/bovine/c" (tag))
(declare-function semantic-parse-region "semantic"
(start end &optional nonterminal depth returnonerror))
}
%languagemode c-mode c++-mode
......
......@@ -25,6 +25,11 @@
%package wisent-java-tags-wy
%provide semantic/wisent/javat-wy
%{
(declare-function semantic-parse-region "semantic"
(start end &optional nonterminal depth returnonerror))
}
%languagemode java-mode
;; The default start symbol
......
......@@ -59,6 +59,12 @@
%package wisent-javascript-jv-wy
%provide semantic/wisent/js-wy
%{
(declare-function semantic-parse-region "semantic"
(start end &optional nonterminal depth returnonerror))
}
;; JAVE I prefere ecmascript-mode
%languagemode ecmascript-mode javascript-mode
......
......@@ -91,8 +91,12 @@
%provide semantic/wisent/python-wy
%{
(declare-function wisent-python-reconstitute-function-tag "semantic/wisent/python")
(declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python")
(declare-function wisent-python-reconstitute-function-tag
"semantic/wisent/python" (tag suite))
(declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python"
(tag))
(declare-function semantic-parse-region "semantic"
(start end &optional nonterminal depth returnonerror))
}
%languagemode python-mode
......
......@@ -4971,13 +4971,12 @@ if test -f "$srcdir/$opt_makefile.in"; then
fi
dnl admin/ may or may not be present.
opt_makefile=admin/unidata/Makefile
if test -f "$srcdir/$opt_makefile.in"; then
SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
dnl The admin/ directory used to be excluded from tarfiles.
if test -d $srcdir/admin; then
SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES admin/unidata/Makefile admin/grammars/Makefile"
AC_CONFIG_FILES([admin/unidata/Makefile])
fi
AC_CONFIG_FILES([admin/grammars/Makefile])
fi dnl -d admin
SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
......
2013-11-30 Glenn Morris <rgm@gnu.org>
Stop keeping (most) generated cedet grammar files in the repository.
* Makefile.in (semantic): New.
(compile-main): Depend on semantic.
2013-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
* net/newst-reader.el (newsticker-html-renderer): Default to SHR if
......
......@@ -296,7 +296,7 @@ compile-targets: $(TARGETS)
# Compile all the Elisp files that need it. Beware: it approximates
# `no-byte-compile', so watch out for false-positives!
compile-main: leim compile-clean
compile-main: leim semantic compile-clean
@(cd $(lisp) && $(setwins); \
els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
for el in $$els; do \
......@@ -320,10 +320,18 @@ compile-clean:
fi \
done
.PHONY: leim
.PHONY: leim semantic
leim:
cd ../leim && $(MAKE) $(MFLAGS) all EMACS="$(EMACS)"
# FIXME. Yuck.
semantic:
case ${EMACS} in \
.*) EMACS="../${EMACS}" ;; \
*) EMACS="${EMACS}" ;; \
esac; \
cd ../admin/grammars && $(MAKE) $(MFLAGS) all EMACS="$${EMACS}"
# Compile all Lisp files, but don't recompile those that are up to
# date. Some .el files don't get compiled because they set the
# local variable no-byte-compile.
......
2013-11-30 Glenn Morris <rgm@gnu.org>
Stop keeping (most) generated cedet grammar files in the repository.
* semantic/bovine/grammar.el (bovine--make-parser-1):
New function, split from bovine-make-parsers.
(bovine-make-parsers): Use bovine--make-parser-1.
(bovine-batch-make-parser): New function.
* semantic/wisent/grammar.el (wisent--make-parser-1):
New function, split from wisent-make-parsers.
(wisent-make-parsers): Use wisent--make-parser-1.
(wisent-batch-make-parser): New function.
* semantic/db.el (semanticdb-save-all-db):
Avoid prompting in batch mode.
* semantic/grammar.el (semantic-grammar-footer-template):
Disable version-control and autoloads in the output.
(semantic-grammar-create-package):
Add option to return nil if output is up-to-date.
* semantic/bovine/c-by.el, semantic/bovine/make-by.el:
* semantic/bovine/scm-by.el, semantic/wisent/javat-wy.el:
* semantic/wisent/js-wy.el, semantic/wisent/python-wy.el:
* srecode/srt-wy.el: Remove generated files from repository.
2013-11-16 Barry O'Reilly <gundaetiapo@gmail.com>
* semantic/fw.el (semantic-exit-on-input)
......
This diff is collapsed.
......@@ -443,34 +443,39 @@ Menu items are appended to the common grammar menu.")
)
"Semantic grammar macros used in bovine grammars.")
(defun bovine-make-parsers ()
"Generate Emacs' built-in Bovine-based parser files."
(interactive)
(semantic-mode 1)
;; Loop through each .by file in current directory, and run
;; `semantic-grammar-batch-build-one-package' to build the grammar.
(dolist (f (directory-files default-directory nil "\\.by\\'"))
(let ((packagename
(condition-case err
(with-current-buffer (find-file-noselect f)
(semantic-grammar-create-package))
(error (message "%s" (error-message-string err)) nil)))
lang filename copyright-end)
(when (and packagename
(string-match "^.*/\\(.*\\)-by\\.el\\'" packagename))
(setq lang (match-string 1 packagename))
(setq filename (concat lang "-by.el"))
(with-temp-buffer
(insert-file-contents filename)
(setq buffer-file-name (expand-file-name filename))
;; Fix copyright header:
(goto-char (point-min))
(re-search-forward "^;; Author:")
(setq copyright-end (match-beginning 0))
(re-search-forward "^;;; Code:\n")
(delete-region copyright-end (match-end 0))
(goto-char copyright-end)
(insert ";; This file is part of GNU Emacs.
(defun bovine--make-parser-1 (infile &optional outdir)
(if outdir (setq outdir (file-name-directory (expand-file-name outdir))))
;; It would be nicer to use a temp-buffer rather than find-file-noselect.
;; The only thing stopping us is bovine-grammar-setupcode-builder's
;; use of (buffer-name). Perhaps that could be changed to
;; (file-name-nondirectory (buffer-file-name)) ?
;; (with-temp-buffer
;; (insert-file-contents infile)
;; (bovine-grammar-mode)
;; (setq buffer-file-name (expand-file-name infile))
;; (if outdir (setq default-directory outdir))
(let ((packagename
;; This is with-demoted-errors.
(condition-case err
(with-current-buffer (find-file-noselect infile)
(if outdir (setq default-directory outdir))
(semantic-grammar-create-package nil t))
(error (message "%s" (error-message-string err)) nil)))
lang filename copyright-end)
(when (and packagename
(string-match "^.*/\\(.*\\)-by\\.el\\'" packagename))
(setq lang (match-string 1 packagename))
(setq filename (expand-file-name (concat lang "-by.el") outdir))
(with-temp-file filename
(insert-file-contents filename)
;; Fix copyright header:
(goto-char (point-min))
(re-search-forward "^;; Author:")
(setq copyright-end (match-beginning 0))
(re-search-forward "^;;; Code:\n")
(delete-region copyright-end (match-end 0))
(goto-char copyright-end)
(insert ";; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
......@@ -488,18 +493,50 @@ Menu items are appended to the common grammar menu.")
;;; Commentary:
;;
;; This file was generated from admin/grammars/"
lang ".by.
lang ".by.
;;; Code:
")
(goto-char (point-min))
(delete-region (point-min) (line-end-position))
(insert ";;; " packagename
" --- Generated parser support file")
(delete-trailing-whitespace)
(re-search-forward ";;; \\(.*\\) ends here")
(replace-match packagename nil nil nil 1)
(save-buffer))))))
(goto-char (point-min))
(delete-region (point-min) (line-end-position))
(insert ";;; " packagename
" --- Generated parser support file")
(delete-trailing-whitespace)
(re-search-forward ";;; \\(.*\\) ends here")
(replace-match packagename nil nil nil 1)))))
(defun bovine-make-parsers ()
"Generate Emacs's built-in Bovine-based parser files."
(interactive)
(semantic-mode 1)
;; Loop through each .by file in current directory, and run
;; `semantic-grammar-batch-build-one-package' to build the grammar.
(dolist (f (directory-files default-directory nil "\\.by\\'"))
(bovine--make-parser-1 f)))
(defun bovine-batch-make-parser (&optional infile outdir)
"Generate a Bovine parser from input INFILE, writing to OUTDIR.
This is mainly intended for use in batch mode:
emacs -batch -l semantic/bovine/grammar -f bovine-make-parser-batch \\
[-dir output-dir | -o output-file] file.by
If -o is supplied, only the directory part is used."
(semantic-mode 1)
(when (and noninteractive (not infile))
(let (arg)
(while command-line-args-left
(setq arg (pop command-line-args-left))
(cond ((string-equal arg "-dir")
(setq outdir (pop command-line-args-left)))
((string-equal arg "-o")
(setq outdir (file-name-directory (pop command-line-args-left))))
(t (setq infile arg))))))
(or infile (error "No input file specified"))
(or (file-readable-p infile)
(error "Input file `%s' not readable" infile))
(bovine--make-parser-1 infile outdir))
(provide 'semantic/bovine/grammar)
......
;;; semantic/bovine/make-by.el --- Generated parser support file
;; Copyright (C) 1999-2004, 2008-2013 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs 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 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs 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. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; This file was generated from admin/grammars/make.by.
;;; Code:
(require 'semantic/lex)
(eval-when-compile (require 'semantic/bovine))
;;; Prologue
;;
;;; Declarations
;;
(defconst semantic-make-by--keyword-table
(semantic-lex-make-keyword-table
'(("if" . IF)
("ifdef" . IFDEF)
("ifndef" . IFNDEF)
("ifeq" . IFEQ)
("ifneq" . IFNEQ)
("else" . ELSE)
("endif" . ENDIF)
("include" . INCLUDE))
'(("include" summary "Macro: include filename1 filename2 ...")
("ifneq" summary "Conditional: ifneq (expression) ... else ... endif")
("ifeq" summary "Conditional: ifeq (expression) ... else ... endif")
("ifndef" summary "Conditional: ifndef (expression) ... else ... endif")
("ifdef" summary "Conditional: ifdef (expression) ... else ... endif")
("endif" summary "Conditional: if (expression) ... else ... endif")
("else" summary "Conditional: if (expression) ... else ... endif")
("if" summary "Conditional: if (expression) ... else ... endif")))
"Table of language keywords.")
(defconst semantic-make-by--token-table
(semantic-lex-make-type-table
'(("punctuation"
(BACKSLASH . "\\`[\\]\\'")
(DOLLAR . "\\`[$]\\'")
(EQUAL . "\\`[=]\\'")
(PLUS . "\\`[+]\\'")
(COLON . "\\`[:]\\'")))
'nil)
"Table of lexical tokens.")
(defconst semantic-make-by--parse-table
`(
(bovine-toplevel
(Makefile)
) ;; end bovine-toplevel
(Makefile
(bol
newline
,(semantic-lambda
(list nil))
)
(bol
variable
,(semantic-lambda
(nth 1 vals))
)
(bol
rule
,(semantic-lambda
(nth 1 vals))
)
(bol
conditional
,(semantic-lambda
(nth 1 vals))
)
(bol
include
,(semantic-lambda
(nth 1 vals))
)
(whitespace
,(semantic-lambda
(list nil))
)
(newline
,(semantic-lambda
(list nil))
)
) ;; end Makefile
(variable
(symbol
opt-whitespace
equals
opt-whitespace
element-list
,(semantic-lambda
(semantic-tag-new-variable
(nth 0 vals) nil
(nth 4 vals)))
)
) ;; end variable
(rule
(targets
opt-whitespace
colons
opt-whitespace
element-list
commands
,(semantic-lambda
(semantic-tag-new-function
(nth 0 vals) nil
(nth 4 vals)))
)
) ;; end rule
(targets
(target
opt-whitespace
targets
,(semantic-lambda
(list
(car
(nth 0 vals))
(car
(nth 2 vals))))
)
(target
,(semantic-lambda
(list
(car
(nth 0 vals))))
)
) ;; end targets
(target
(sub-target
target
,(semantic-lambda
(list
(concat
(car
(nth 0 vals))
(car
(nth 2 vals)))))
)
(sub-target
,(semantic-lambda
(list
(car
(nth 0 vals))))
)
) ;; end target
(sub-target
(symbol)
(string)
(varref)
) ;; end sub-target
(conditional
(IF
some-whitespace
symbol
newline
,(semantic-lambda
(list nil))
)
(IFDEF
some-whitespace
symbol
newline
,(semantic-lambda
(list nil))
)
(IFNDEF
some-whitespace
symbol
newline
,(semantic-lambda
(list nil))
)
(IFEQ
some-whitespace
expression
newline