From: Glenn Morris Date: Sat, 30 Nov 2013 02:06:34 +0000 (-0800) Subject: Stop keeping (all but one) generated cedet grammar files in the repository X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~633 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f9b697ddaa60742d4a60b1fa4ab37efc2c3cb1e1;p=emacs.git 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. --- diff --git a/ChangeLog b/ChangeLog index 6a34a8f9cf0..28d67634c79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-11-30 Glenn Morris + + 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 * Makefile.in (epaths-force-w32): Fix 2013-11-20 typo. diff --git a/Makefile.in b/Makefile.in index 065168bbce5..aedb9acff0d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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} diff --git a/admin/ChangeLog b/admin/ChangeLog index c9930c7023a..d70056f001e 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,11 @@ +2013-11-30 Glenn Morris + + 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 * unidata/unidata-gen.el (unidata-gen-files): diff --git a/admin/grammars/Makefile.in b/admin/grammars/Makefile.in new file mode 100644 index 00000000000..94c2e9a6ee2 --- /dev/null +++ b/admin/grammars/Makefile.in @@ -0,0 +1,105 @@ +### @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 . + +### 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 diff --git a/admin/grammars/README b/admin/grammars/README deleted file mode 100644 index e38260952a5..00000000000 --- a/admin/grammars/README +++ /dev/null @@ -1,11 +0,0 @@ -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. diff --git a/admin/grammars/c.by b/admin/grammars/c.by index 5d2f407e8e3..55ec0fbaf01 100644 --- a/admin/grammars/c.by +++ b/admin/grammars/c.by @@ -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 diff --git a/admin/grammars/java-tags.wy b/admin/grammars/java-tags.wy index 71607f452a0..3f5c3ad04c6 100644 --- a/admin/grammars/java-tags.wy +++ b/admin/grammars/java-tags.wy @@ -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 diff --git a/admin/grammars/js.wy b/admin/grammars/js.wy index 3b602296552..a6a358a0ee7 100644 --- a/admin/grammars/js.wy +++ b/admin/grammars/js.wy @@ -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 diff --git a/admin/grammars/python.wy b/admin/grammars/python.wy index 02fb7390b01..b82125d2bc3 100644 --- a/admin/grammars/python.wy +++ b/admin/grammars/python.wy @@ -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 diff --git a/configure.ac b/configure.ac index 0d07d563946..a2e4cd9e159 100644 --- a/configure.ac +++ b/configure.ac @@ -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'` diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 26c0f502334..2455b9a10b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-11-30 Glenn Morris + + Stop keeping (most) generated cedet grammar files in the repository. + * Makefile.in (semantic): New. + (compile-main): Depend on semantic. + 2013-11-29 Stefan Monnier * net/newst-reader.el (newsticker-html-renderer): Default to SHR if diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 391e50c8b7d..9c9eacfd386 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -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. diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index ecdebe0363c..1a4a6580007 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,25 @@ +2013-11-30 Glenn Morris + + 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 * semantic/fw.el (semantic-exit-on-input) diff --git a/lisp/cedet/semantic/bovine/c-by.el b/lisp/cedet/semantic/bovine/c-by.el deleted file mode 100644 index af3724a32c8..00000000000 --- a/lisp/cedet/semantic/bovine/c-by.el +++ /dev/null @@ -1,2224 +0,0 @@ -;;; semantic/bovine/c-by.el --- Generated parser support file - -;; Copyright (C) 1999-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 . - -;;; Commentary: -;; -;; This file was generated from admin/grammars/c.by. - -;;; Code: - -(require 'semantic/lex) -(eval-when-compile (require 'semantic/bovine)) - -;;; Prologue -;; -(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)) - -;;; Declarations -;; -(defconst semantic-c-by--keyword-table - (semantic-lex-make-keyword-table - '(("extern" . EXTERN) - ("static" . STATIC) - ("const" . CONST) - ("volatile" . VOLATILE) - ("register" . REGISTER) - ("signed" . SIGNED) - ("unsigned" . UNSIGNED) - ("inline" . INLINE) - ("virtual" . VIRTUAL) - ("mutable" . MUTABLE) - ("explicit" . EXPLICIT) - ("struct" . STRUCT) - ("union" . UNION) - ("enum" . ENUM) - ("typedef" . TYPEDEF) - ("class" . CLASS) - ("typename" . TYPENAME) - ("namespace" . NAMESPACE) - ("using" . USING) - ("new" . NEW) - ("delete" . DELETE) - ("template" . TEMPLATE) - ("throw" . THROW) - ("reentrant" . REENTRANT) - ("try" . TRY) - ("catch" . CATCH) - ("operator" . OPERATOR) - ("public" . PUBLIC) - ("private" . PRIVATE) - ("protected" . PROTECTED) - ("friend" . FRIEND) - ("if" . IF) - ("else" . ELSE) - ("do" . DO) - ("while" . WHILE) - ("for" . FOR) - ("switch" . SWITCH) - ("case" . CASE) - ("default" . DEFAULT) - ("return" . RETURN) - ("break" . BREAK) - ("continue" . CONTINUE) - ("sizeof" . SIZEOF) - ("void" . VOID) - ("char" . CHAR) - ("wchar_t" . WCHAR) - ("short" . SHORT) - ("int" . INT) - ("long" . LONG) - ("float" . FLOAT) - ("double" . DOUBLE) - ("bool" . BOOL) - ("_P" . UNDERP) - ("__P" . UNDERUNDERP)) - '(("__P" summary "Common macro to eliminate prototype compatibility on some compilers") - ("_P" summary "Common macro to eliminate prototype compatibility on some compilers") - ("bool" summary "Primitive boolean type") - ("double" summary "Primitive floating-point type (double-precision 64-bit IEEE 754)") - ("float" summary "Primitive floating-point type (single-precision 32-bit IEEE 754)") - ("long" summary "Integral primitive type (-9223372036854775808 to 9223372036854775807)") - ("int" summary "Integral Primitive Type: (-2147483648 to 2147483647)") - ("short" summary "Integral Primitive Type: (-32768 to 32767)") - ("wchar_t" summary "Wide Character Type") - ("char" summary "Integral Character Type: (0 to 256)") - ("void" summary "Built in typeless type: void") - ("sizeof" summary "Compile time macro: sizeof() // size in bytes") - ("continue" summary "Non-local continue within a loop (for, do/while): continue;") - ("break" summary "Non-local exit within a loop or switch (for, do/while, switch): break;") - ("return" summary "return ;") - ("default" summary "switch () { case : code; ... default: code; }") - ("case" summary "switch () { case : code; ... default: code; }") - ("switch" summary "switch () { case : code; ... default: code; }") - ("for" summary "for(; ; ) { code }") - ("while" summary "do { code } while (); or while () { code };") - ("do" summary " do { code } while ();") - ("else" summary "if () { code } [ else { code } ]") - ("if" summary "if () { code } [ else { code } ]") - ("friend" summary "friend class ") - ("catch" summary "try { } catch { }") - ("try" summary "try { } catch { }") - ("reentrant" summary " () reentrant ...") - ("throw" summary " () throw () ...") - ("template" summary "template TYPE_OR_FUNCTION") - ("delete" summary "delete ;") - ("new" summary "new ();") - ("using" summary "using ;") - ("namespace" summary "Namespace Declaration: namespace { ... };") - ("typename" summary "typename is used to handle a qualified name as a typename;") - ("class" summary "Class Declaration: class [:parents] { ... };") - ("typedef" summary "Arbitrary Type Declaration: typedef ;") - ("enum" summary "Enumeration Type Declaration: enum [name] { ... };") - ("union" summary "Union Type Declaration: union [name] { ... };") - ("struct" summary "Structure Type Declaration: struct [name] { ... };") - ("explicit" summary "Forbids implicit type conversion: explicit ") - ("mutable" summary "Member Declaration Modifier: mutable ...") - ("virtual" summary "Method Modifier: virtual (...) ...") - ("inline" summary "Function Modifier: inline (...) {...};") - ("unsigned" summary "Numeric Type Modifier: unsigned ...") - ("signed" summary "Numeric Type Modifier: signed ...") - ("register" summary "Declaration Modifier: register ...") - ("volatile" summary "Declaration Modifier: volatile ...") - ("const" summary "Declaration Modifier: const ...") - ("static" summary "Declaration Modifier: static ...") - ("extern" summary "Declaration Modifier: extern ..."))) - "Table of language keywords.") - -(defconst semantic-c-by--token-table - (semantic-lex-make-type-table - '(("semantic-list" - (BRACKETS . "\\[\\]") - (PARENS . "()") - (VOID_BLCK . "^(void)$") - (BRACE_BLCK . "^{") - (PAREN_BLCK . "^(") - (BRACK_BLCK . "\\[.*\\]$")) - ("close-paren" - (RBRACE . "}") - (RPAREN . ")")) - ("open-paren" - (LBRACE . "{") - (LPAREN . "(")) - ("symbol" - (RESTRICT . "\\<\\(__\\)?restrict\\>")) - ("number" - (ZERO . "^0$")) - ("string" - (CPP . "\"C\\+\\+\"") - (C . "\"C\"")) - ("punctuation" - (OR . "\\`[|]\\'") - (HAT . "\\`\\^\\'") - (MOD . "\\`[%]\\'") - (TILDE . "\\`[~]\\'") - (COMA . "\\`[,]\\'") - (GREATER . "\\`[>]\\'") - (LESS . "\\`[<]\\'") - (EQUAL . "\\`[=]\\'") - (BANG . "\\`[!]\\'") - (MINUS . "\\`[-]\\'") - (PLUS . "\\`[+]\\'") - (DIVIDE . "\\`[/]\\'") - (AMPERSAND . "\\`[&]\\'") - (STAR . "\\`[*]\\'") - (SEMICOLON . "\\`[;]\\'") - (COLON . "\\`[:]\\'") - (PERIOD . "\\`[.]\\'") - (HASH . "\\`[#]\\'"))) - 'nil) - "Table of lexical tokens.") - -(defconst semantic-c-by--parse-table - `( - (bovine-toplevel - (declaration) - ) ;; end bovine-toplevel - - (bovine-inner-scope - (codeblock) - ) ;; end bovine-inner-scope - - (declaration - (macro) - (type) - (define) - (var-or-fun) - (extern-c) - (template) - (using) - ) ;; end declaration - - (codeblock - (define) - (codeblock-var-or-fun) - (type) - (using) - ) ;; end codeblock - - (extern-c-contents - (open-paren - ,(semantic-lambda - (list nil)) - ) - (declaration) - (close-paren - ,(semantic-lambda - (list nil)) - ) - ) ;; end extern-c-contents - - (extern-c - (EXTERN - string - "\"C\"" - semantic-list - ,(semantic-lambda - (semantic-tag - "C" - 'extern :members - (semantic-parse-region - (car - (nth 2 vals)) - (cdr - (nth 2 vals)) - 'extern-c-contents - 1))) - ) - (EXTERN - string - "\"C\\+\\+\"" - semantic-list - ,(semantic-lambda - (semantic-tag - "C" - 'extern :members - (semantic-parse-region - (car - (nth 2 vals)) - (cdr - (nth 2 vals)) - 'extern-c-contents - 1))) - ) - (EXTERN - string - "\"C\"" - ,(semantic-lambda - (list nil)) - ) - (EXTERN - string - "\"C\\+\\+\"" - ,(semantic-lambda - (list nil)) - ) - ) ;; end extern-c - - (macro - (spp-macro-def - ,(semantic-lambda - (semantic-tag-new-variable - (nth 0 vals) nil nil :constant-flag t)) - ) - (spp-system-include - ,(semantic-lambda - (semantic-tag-new-include - (nth 0 vals) t)) - ) - (spp-include - ,(semantic-lambda - (semantic-tag-new-include - (nth 0 vals) nil)) - ) - ) ;; end macro - - (define - (spp-macro-def - ,(semantic-lambda - (semantic-tag-new-variable - (nth 0 vals) nil nil :constant-flag t)) - ) - (spp-macro-undef - ,(semantic-lambda - (list nil)) - ) - ) ;; end define - - (unionparts - (semantic-list - ,(semantic-lambda - (semantic-parse-region - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'classsubparts - 1)) - ) - ) ;; end unionparts - - (opt-symbol - (symbol) - ( ;;EMPTY - ) - ) ;; end opt-symbol - - (classsubparts - (open-paren - "{" - ,(semantic-lambda - (list nil)) - ) - (close-paren - "}" - ,(semantic-lambda - (list nil)) - ) - (class-protection - opt-symbol - punctuation - "\\`[:]\\'" - ,(semantic-lambda - (semantic-tag - (car - (nth 0 vals)) - 'label)) - ) - (var-or-fun) - (FRIEND - func-decl - ,(semantic-lambda - (semantic-tag - (car - (nth 1 vals)) - 'friend)) - ) - (FRIEND - CLASS - symbol - ,(semantic-lambda - (semantic-tag - (nth 2 vals) - 'friend)) - ) - (type) - (define) - (template) - ( ;;EMPTY - ) - ) ;; end classsubparts - - (opt-class-parents - (punctuation - "\\`[:]\\'" - class-parents - opt-template-specifier - ,(semantic-lambda - (list - (nth 1 vals))) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end opt-class-parents - - (one-class-parent - (opt-class-protection - opt-class-declmods - namespace-symbol - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 2 vals)) - "class" nil nil :protection - (car - (nth 0 vals)))) - ) - (opt-class-declmods - opt-class-protection - namespace-symbol - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 2 vals)) - "class" nil nil :protection - (car - (nth 1 vals)))) - ) - ) ;; end one-class-parent - - (class-parents - (one-class-parent - punctuation - "\\`[,]\\'" - class-parents - ,(semantic-lambda - (cons - (nth 0 vals) - (nth 2 vals))) - ) - (one-class-parent - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end class-parents - - (opt-class-declmods - (class-declmods - opt-class-declmods - ,(semantic-lambda - (list nil)) - ) - ( ;;EMPTY - ) - ) ;; end opt-class-declmods - - (class-declmods - (VIRTUAL) - ) ;; end class-declmods - - (class-protection - (PUBLIC) - (PRIVATE) - (PROTECTED) - ) ;; end class-protection - - (opt-class-protection - (class-protection - ,(semantic-lambda - (nth 0 vals)) - ) - ( ;;EMPTY - ,(semantic-lambda - (list - "unspecified")) - ) - ) ;; end opt-class-protection - - (namespaceparts - (semantic-list - ,(semantic-lambda - (semantic-parse-region - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'namespacesubparts - 1)) - ) - ) ;; end namespaceparts - - (namespacesubparts - (open-paren - "{" - ,(semantic-lambda - (list nil)) - ) - (close-paren - "}" - ,(semantic-lambda - (list nil)) - ) - (type) - (var-or-fun) - (define) - (class-protection - punctuation - "\\`[:]\\'" - ,(semantic-lambda - (semantic-tag - (car - (nth 0 vals)) - 'label)) - ) - (template) - (using) - (spp-include - ,(semantic-lambda - (semantic-tag - (nth 0 vals) - 'include :inside-ns t)) - ) - ( ;;EMPTY - ) - ) ;; end namespacesubparts - - (enumparts - (semantic-list - ,(semantic-lambda - (semantic-parse-region - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'enumsubparts - 1)) - ) - ) ;; end enumparts - - (enumsubparts - (symbol - opt-assign - ,(semantic-lambda - (semantic-tag-new-variable - (nth 0 vals) - "int" - (car - (nth 1 vals)) :constant-flag t)) - ) - (open-paren - "{" - ,(semantic-lambda - (list nil)) - ) - (close-paren - "}" - ,(semantic-lambda - (list nil)) - ) - (punctuation - "\\`[,]\\'" - ,(semantic-lambda - (list nil)) - ) - ) ;; end enumsubparts - - (opt-name - (symbol) - ( ;;EMPTY - ,(semantic-lambda - (list - "")) - ) - ) ;; end opt-name - - (typesimple - (struct-or-class - opt-class - opt-name - opt-template-specifier - opt-class-parents - semantic-list - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 2 vals)) - (car - (nth 0 vals)) - (let - ( - (semantic-c-classname - (cons - (car - (nth 2 vals)) - (car - (nth 0 vals))))) - (semantic-parse-region - (car - (nth 5 vals)) - (cdr - (nth 5 vals)) - 'classsubparts - 1)) - (nth 4 vals) :template-specifier - (nth 3 vals) :parent - (car - (nth 1 vals)))) - ) - (struct-or-class - opt-class - opt-name - opt-template-specifier - opt-class-parents - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 2 vals)) - (car - (nth 0 vals)) nil - (nth 4 vals) :template-specifier - (nth 3 vals) :prototype t :parent - (car - (nth 1 vals)))) - ) - (UNION - opt-class - opt-name - unionparts - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 2 vals)) - (nth 0 vals) - (nth 3 vals) nil :parent - (car - (nth 1 vals)))) - ) - (ENUM - opt-class - opt-name - enumparts - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 2 vals)) - (nth 0 vals) - (nth 3 vals) nil :parent - (car - (nth 1 vals)))) - ) - (TYPEDEF - declmods - typeformbase - cv-declmods - typedef-symbol-list - ,(semantic-lambda - (semantic-tag-new-type - (nth 4 vals) - (nth 0 vals) nil - (list - (nth 2 vals)))) - ) - ) ;; end typesimple - - (typedef-symbol-list - (typedefname - punctuation - "\\`[,]\\'" - typedef-symbol-list - ,(semantic-lambda - (cons - (nth 0 vals) - (nth 2 vals))) - ) - (typedefname - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end typedef-symbol-list - - (typedefname - (opt-stars - symbol - opt-bits - opt-array - ,(semantic-lambda - (list - (nth 0 vals) - (nth 1 vals))) - ) - ) ;; end typedefname - - (struct-or-class - (STRUCT) - (CLASS) - ) ;; end struct-or-class - - (type - (typesimple - punctuation - "\\`[;]\\'" - ,(semantic-lambda - (nth 0 vals)) - ) - (NAMESPACE - symbol - namespaceparts - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - (nth 0 vals) - (nth 2 vals) nil)) - ) - (NAMESPACE - namespaceparts - ,(semantic-lambda - (semantic-tag-new-type - "unnamed" - (nth 0 vals) - (nth 1 vals) nil)) - ) - (NAMESPACE - symbol - punctuation - "\\`[=]\\'" - typeformbase - punctuation - "\\`[;]\\'" - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - (nth 0 vals) - (list - (semantic-tag-new-type - (car - (nth 3 vals)) - (nth 0 vals) nil nil)) nil :kind - 'alias)) - ) - ) ;; end type - - (using - (USING - usingname - punctuation - "\\`[;]\\'" - ,(semantic-lambda - (semantic-tag - (car - (nth 1 vals)) - 'using :type - (nth 1 vals))) - ) - ) ;; end using - - (usingname - (typeformbase - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 0 vals)) - "class" nil nil :prototype t)) - ) - (NAMESPACE - typeformbase - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 1 vals)) - "namespace" nil nil :prototype t)) - ) - ) ;; end usingname - - (template - (TEMPLATE - template-specifier - opt-friend - template-definition - ,(semantic-lambda - (semantic-c-reconstitute-template - (nth 3 vals) - (nth 1 vals))) - ) - ) ;; end template - - (opt-friend - (FRIEND) - ( ;;EMPTY - ) - ) ;; end opt-friend - - (opt-template-specifier - (template-specifier - ,(semantic-lambda - (nth 0 vals)) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end opt-template-specifier - - (template-specifier - (punctuation - "\\`[<]\\'" - template-specifier-types - punctuation - "\\`[>]\\'" - ,(semantic-lambda - (nth 1 vals)) - ) - ) ;; end template-specifier - - (template-specifier-types - (template-var - template-specifier-type-list - ,(semantic-lambda - (cons - (nth 0 vals) - (nth 1 vals))) - ) - ( ;;EMPTY - ) - ) ;; end template-specifier-types - - (template-specifier-type-list - (punctuation - "\\`[,]\\'" - template-specifier-types - ,(semantic-lambda - (nth 1 vals)) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end template-specifier-type-list - - (template-var - (template-type - opt-template-equal - ,(semantic-lambda - (cons - (car - (nth 0 vals)) - (cdr - (nth 0 vals)))) - ) - (string - ,(semantic-lambda - (list - (nth 0 vals))) - ) - (number - ,(semantic-lambda - (list - (nth 0 vals))) - ) - (opt-stars - opt-ref - namespace-symbol - ,(semantic-lambda - (nth 2 vals)) - ) - (semantic-list - ,(semantic-lambda - (list - (nth 0 vals))) - ) - (SIZEOF - semantic-list - ,(semantic-lambda - (list - (nth 1 vals))) - ) - ) ;; end template-var - - (opt-template-equal - (punctuation - "\\`[=]\\'" - symbol - punctuation - "\\`[<]\\'" - template-specifier-types - punctuation - "\\`[>]\\'" - ,(semantic-lambda - (list - (nth 1 vals))) - ) - (punctuation - "\\`[=]\\'" - symbol - ,(semantic-lambda - (list - (nth 1 vals))) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end opt-template-equal - - (template-type - (CLASS - symbol - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - "class" nil nil)) - ) - (STRUCT - symbol - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - "struct" nil nil)) - ) - (TYPENAME - symbol - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - "class" nil nil)) - ) - (declmods - typeformbase - cv-declmods - opt-stars - opt-ref - variablearg-opt-name - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 1 vals)) nil nil nil :constant-flag - (if - (member - "const" - (append - (nth 0 vals) - (nth 2 vals))) t nil) :typemodifiers - (delete - "const" - (append - (nth 0 vals) - (nth 2 vals))) :reference - (car - (nth 4 vals)) :pointer - (car - (nth 3 vals)))) - ) - ) ;; end template-type - - (template-definition - (type - ,(semantic-lambda - (nth 0 vals)) - ) - (var-or-fun - ,(semantic-lambda - (nth 0 vals)) - ) - ) ;; end template-definition - - (opt-stars - (punctuation - "\\`[*]\\'" - opt-starmod - opt-stars - ,(semantic-lambda - (list - (1+ - (car - (nth 2 vals))))) - ) - ( ;;EMPTY - ,(semantic-lambda - (list - 0)) - ) - ) ;; end opt-stars - - (opt-starmod - (STARMOD - opt-starmod - ,(semantic-lambda - (cons - (car - (nth 0 vals)) - (nth 1 vals))) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end opt-starmod - - (STARMOD - (CONST) - ) ;; end STARMOD - - (declmods - (DECLMOD - declmods - ,(semantic-lambda - (cons - (car - (nth 0 vals)) - (nth 1 vals))) - ) - (DECLMOD - ,(semantic-lambda - (nth 0 vals)) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end declmods - - (DECLMOD - (EXTERN) - (STATIC) - (CVDECLMOD) - (INLINE) - (REGISTER) - (FRIEND) - (TYPENAME) - (METADECLMOD) - (VIRTUAL) - ) ;; end DECLMOD - - (metadeclmod - (METADECLMOD - ,(semantic-lambda) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end metadeclmod - - (CVDECLMOD - (CONST) - (VOLATILE) - ) ;; end CVDECLMOD - - (cv-declmods - (CVDECLMOD - cv-declmods - ,(semantic-lambda - (cons - (car - (nth 0 vals)) - (nth 1 vals))) - ) - (CVDECLMOD - ,(semantic-lambda - (nth 0 vals)) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end cv-declmods - - (METADECLMOD - (VIRTUAL) - (MUTABLE) - ) ;; end METADECLMOD - - (opt-ref - (punctuation - "\\`[&]\\'" - ,(semantic-lambda - (list - 1)) - ) - ( ;;EMPTY - ,(semantic-lambda - (list - 0)) - ) - ) ;; end opt-ref - - (typeformbase - (typesimple - ,(semantic-lambda - (nth 0 vals)) - ) - (STRUCT - symbol - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - (nth 0 vals) nil nil)) - ) - (UNION - symbol - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - (nth 0 vals) nil nil)) - ) - (ENUM - symbol - ,(semantic-lambda - (semantic-tag-new-type - (nth 1 vals) - (nth 0 vals) nil nil)) - ) - (builtintype - ,(semantic-lambda - (nth 0 vals)) - ) - (symbol - template-specifier - ,(semantic-lambda - (semantic-tag-new-type - (nth 0 vals) - "class" nil nil :template-specifier - (nth 1 vals))) - ) - (namespace-symbol-for-typeformbase - opt-template-specifier - ,(semantic-lambda - (semantic-tag-new-type - (car - (nth 0 vals)) - "class" nil nil :template-specifier - (nth 1 vals))) - ) - (symbol - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end typeformbase - - (signedmod - (UNSIGNED) - (SIGNED) - ) ;; end signedmod - - (builtintype-types - (VOID) - (CHAR) - (WCHAR) - (SHORT - INT - ,(semantic-lambda - (list - (concat - (nth 0 vals) - " " - (nth 1 vals)))) - ) - (SHORT) - (INT) - (LONG - INT - ,(semantic-lambda - (list - (concat - (nth 0 vals) - " " - (nth 1 vals)))) - ) - (FLOAT) - (DOUBLE) - (BOOL) - (LONG - DOUBLE - ,(semantic-lambda - (list - (concat - (nth 0 vals) - " " - (nth 1 vals)))) - ) - (LONG - LONG - ,(semantic-lambda - (list - (concat - (nth 0 vals) - " " - (nth 1 vals)))) - ) - (LONG) - ) ;; end builtintype-types - - (builtintype - (signedmod - builtintype-types - ,(semantic-lambda - (list - (concat - (car - (nth 0 vals)) - " " - (car - (nth 1 vals))))) - ) - (builtintype-types - ,(semantic-lambda - (nth 0 vals)) - ) - (signedmod - ,(semantic-lambda - (list - (concat - (car - (nth 0 vals)) - " int"))) - ) - ) ;; end builtintype - - (codeblock-var-or-fun - (declmods - typeformbase - declmods - opt-ref - var-or-func-decl - ,(semantic-lambda - (semantic-c-reconstitute-token - (nth 4 vals) - (nth 0 vals) - (nth 1 vals))) - ) - ) ;; end codeblock-var-or-fun - - (var-or-fun - (codeblock-var-or-fun - ,(semantic-lambda - (nth 0 vals)) - ) - (declmods - var-or-func-decl - ,(semantic-lambda - (semantic-c-reconstitute-token - (nth 1 vals) - (nth 0 vals) nil)) - ) - ) ;; end var-or-fun - - (var-or-func-decl - (func-decl - ,(semantic-lambda - (nth 0 vals)) - ) - (var-decl - ,(semantic-lambda - (nth 0 vals)) - ) - ) ;; end var-or-func-decl - - (func-decl - (opt-stars - opt-class - opt-destructor - functionname - opt-template-specifier - opt-under-p - arg-list - opt-post-fcn-modifiers - opt-throw - opt-initializers - fun-or-proto-end - ,(semantic-lambda - (nth 3 vals) - (list - 'function - (nth 1 vals) - (nth 2 vals) - (nth 6 vals) - (nth 8 vals) - (nth 7 vals)) - (nth 0 vals) - (nth 10 vals) - (list - (nth 4 vals)) - (nth 9 vals)) - ) - (opt-stars - opt-class - opt-destructor - functionname - opt-template-specifier - opt-under-p - opt-post-fcn-modifiers - opt-throw - opt-initializers - fun-try-end - ,(semantic-lambda - (nth 3 vals) - (list - 'function - (nth 1 vals) - (nth 2 vals) nil - (nth 7 vals) - (nth 6 vals)) - (nth 0 vals) - (nth 9 vals) - (list - (nth 4 vals)) - (nth 8 vals)) - ) - ) ;; end func-decl - - (var-decl - (varnamelist - punctuation - "\\`[;]\\'" - ,(semantic-lambda - (list - (nth 0 vals) - 'variable)) - ) - ) ;; end var-decl - - (opt-under-p - (UNDERP - ,(semantic-lambda - (list nil)) - ) - (UNDERUNDERP - ,(semantic-lambda - (list nil)) - ) - ( ;;EMPTY - ) - ) ;; end opt-under-p - - (opt-initializers - (punctuation - "\\`[:]\\'" - namespace-symbol - semantic-list - opt-initializers) - (punctuation - "\\`[,]\\'" - namespace-symbol - semantic-list - opt-initializers) - ( ;;EMPTY - ) - ) ;; end opt-initializers - - (opt-post-fcn-modifiers - (post-fcn-modifiers - opt-post-fcn-modifiers - ,(semantic-lambda - (cons - (nth 0 vals) - (nth 1 vals))) - ) - ( ;;EMPTY - ,(semantic-lambda - (list nil)) - ) - ) ;; end opt-post-fcn-modifiers - - (post-fcn-modifiers - (REENTRANT) - (CONST) - ) ;; end post-fcn-modifiers - - (opt-throw - (THROW - semantic-list - ,(lambda (vals start end) - (semantic-bovinate-from-nonterminal - (car - (nth 1 vals)) - (cdr - (nth 1 vals)) - 'throw-exception-list)) - ) - ( ;;EMPTY - ) - ) ;; end opt-throw - - (throw-exception-list - (namespace-symbol - punctuation - "\\`[,]\\'" - throw-exception-list - ,(semantic-lambda - (cons - (car - (nth 0 vals)) - (nth 2 vals))) - ) - (namespace-symbol - close-paren - ")" - ,(semantic-lambda - (nth 0 vals)) - ) - (symbol - close-paren - ")" - ,(semantic-lambda - (list - (nth 0 vals))) - ) - (open-paren - "(" - throw-exception-list - ,(semantic-lambda - (nth 1 vals)) - ) - (close-paren - ")" - ,(semantic-lambda) - ) - ) ;; end throw-exception-list - - (opt-bits - (punctuation - "\\`[:]\\'" - number - ,(semantic-lambda - (list - (nth 1 vals))) - ) - ( ;;EMPTY - ,(semantic-lambda - (list nil)) - ) - ) ;; end opt-bits - - (opt-array - (semantic-list - "\\[.*\\]$" - opt-array - ,(semantic-lambda - (list - (cons - 1 - (car - (nth 1 vals))))) - ) - ( ;;EMPTY - ,(semantic-lambda - (list nil)) - ) - ) ;; end opt-array - - (opt-assign - (punctuation - "\\`[=]\\'" - expression - ,(semantic-lambda - (list - (nth 1 vals))) - ) - ( ;;EMPTY - ,(semantic-lambda - (list nil)) - ) - ) ;; end opt-assign - - (opt-restrict - (symbol - "\\<\\(__\\)?restrict\\>") - ( ;;EMPTY - ) - ) ;; end opt-restrict - - (varname - (opt-stars - opt-restrict - namespace-symbol - opt-bits - opt-array - ,(semantic-lambda - (nth 2 vals) - (nth 0 vals) - (nth 3 vals) - (nth 4 vals)) - ) - ) ;; end varname - - (variablearg - (declmods - typeformbase - cv-declmods - opt-ref - variablearg-opt-name - ,(semantic-lambda - (semantic-tag-new-variable - (list - (nth 4 vals)) - (nth 1 vals) nil :constant-flag - (if - (member - "const" - (append - (nth 0 vals) - (nth 2 vals))) t nil) :typemodifiers - (delete - "const" - (append - (nth 0 vals) - (nth 2 vals))) :reference - (car - (nth 3 vals)))) - ) - ) ;; end variablearg - - (variablearg-opt-name - (varname - ,(semantic-lambda - (nth 0 vals)) - ) - (opt-stars - ,(semantic-lambda - (list - "") - (nth 0 vals) - (list nil nil nil)) - ) - ) ;; end variablearg-opt-name - - (varname-opt-initializer - (semantic-list) - (opt-assign) - ( ;;EMPTY - ) - ) ;; end varname-opt-initializer - - (varnamelist - (opt-ref - varname - varname-opt-initializer - punctuation - "\\`[,]\\'" - varnamelist - ,(semantic-lambda - (cons - (nth 1 vals) - (nth 4 vals))) - ) - (opt-ref - varname - varname-opt-initializer - ,(semantic-lambda - (list - (nth 1 vals))) - ) - ) ;; end varnamelist - - (namespace-symbol - (symbol - opt-template-specifier - punctuation - "\\`[:]\\'" - punctuation - "\\`[:]\\'" - namespace-symbol - ,(semantic-lambda - (list - (concat - (nth 0 vals) - "::" - (car - (nth 4 vals))))) - ) - (symbol - opt-template-specifier - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end namespace-symbol - - (namespace-symbol-for-typeformbase - (symbol - opt-template-specifier - punctuation - "\\`[:]\\'" - punctuation - "\\`[:]\\'" - namespace-symbol-for-typeformbase - ,(semantic-lambda - (list - (concat - (nth 0 vals) - "::" - (car - (nth 4 vals))))) - ) - (symbol - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end namespace-symbol-for-typeformbase - - (namespace-opt-class - (symbol - punctuation - "\\`[:]\\'" - punctuation - "\\`[:]\\'" - namespace-opt-class - ,(semantic-lambda - (list - (concat - (nth 0 vals) - "::" - (car - (nth 3 vals))))) - ) - (symbol - opt-template-specifier - punctuation - "\\`[:]\\'" - punctuation - "\\`[:]\\'" - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end namespace-opt-class - - (opt-class - (namespace-opt-class - ,(semantic-lambda - (nth 0 vals)) - ) - ( ;;EMPTY - ,(semantic-lambda - (list nil)) - ) - ) ;; end opt-class - - (opt-destructor - (punctuation - "\\`[~]\\'" - ,(semantic-lambda - (list t)) - ) - ( ;;EMPTY - ,(semantic-lambda - (list nil)) - ) - ) ;; end opt-destructor - - (arg-list - (semantic-list - "^(" - knr-arguments - ,(semantic-lambda - (nth 1 vals)) - ) - (semantic-list - "^(" - ,(semantic-lambda - (semantic-parse-region - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'arg-sub-list - 1)) - ) - (semantic-list - "^(void)$" - ,(semantic-lambda) - ) - ) ;; end arg-list - - (knr-varnamelist - (varname - punctuation - "\\`[,]\\'" - knr-varnamelist - ,(semantic-lambda - (cons - (nth 0 vals) - (nth 2 vals))) - ) - (varname - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end knr-varnamelist - - (knr-one-variable-decl - (declmods - typeformbase - cv-declmods - knr-varnamelist - ,(semantic-lambda - (semantic-tag-new-variable - (nreverse - (nth 3 vals)) - (nth 1 vals) nil :constant-flag - (if - (member - "const" - (append - (nth 2 vals))) t nil) :typemodifiers - (delete - "const" - (nth 2 vals)))) - ) - ) ;; end knr-one-variable-decl - - (knr-arguments - (knr-one-variable-decl - punctuation - "\\`[;]\\'" - knr-arguments - ,(semantic-lambda - (append - (semantic-expand-c-tag - (nth 0 vals)) - (nth 2 vals))) - ) - (knr-one-variable-decl - punctuation - "\\`[;]\\'" - ,(semantic-lambda - (semantic-expand-c-tag - (nth 0 vals))) - ) - ) ;; end knr-arguments - - (arg-sub-list - (variablearg - ,(semantic-lambda - (nth 0 vals)) - ) - (punctuation - "\\`[.]\\'" - punctuation - "\\`[.]\\'" - punctuation - "\\`[.]\\'" - close-paren - ")" - ,(semantic-lambda - (semantic-tag-new-variable - "..." - "vararg" nil)) - ) - (punctuation - "\\`[,]\\'" - ,(semantic-lambda - (list nil)) - ) - (open-paren - "(" - ,(semantic-lambda - (list nil)) - ) - (close-paren - ")" - ,(semantic-lambda - (list nil)) - ) - ) ;; end arg-sub-list - - (operatorsym - (punctuation - "\\`[<]\\'" - punctuation - "\\`[<]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "<<=")) - ) - (punctuation - "\\`[>]\\'" - punctuation - "\\`[>]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - ">>=")) - ) - (punctuation - "\\`[<]\\'" - punctuation - "\\`[<]\\'" - ,(semantic-lambda - (list - "<<")) - ) - (punctuation - "\\`[>]\\'" - punctuation - "\\`[>]\\'" - ,(semantic-lambda - (list - ">>")) - ) - (punctuation - "\\`[=]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "==")) - ) - (punctuation - "\\`[<]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "<=")) - ) - (punctuation - "\\`[>]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - ">=")) - ) - (punctuation - "\\`[!]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "!=")) - ) - (punctuation - "\\`[+]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "+=")) - ) - (punctuation - "\\`[-]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "-=")) - ) - (punctuation - "\\`[*]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "*=")) - ) - (punctuation - "\\`[/]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "/=")) - ) - (punctuation - "\\`[%]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "%=")) - ) - (punctuation - "\\`[&]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "&=")) - ) - (punctuation - "\\`[|]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "|=")) - ) - (punctuation - "\\`[-]\\'" - punctuation - "\\`[>]\\'" - punctuation - "\\`[*]\\'" - ,(semantic-lambda - (list - "->*")) - ) - (punctuation - "\\`[-]\\'" - punctuation - "\\`[>]\\'" - ,(semantic-lambda - (list - "->")) - ) - (semantic-list - "()" - ,(semantic-lambda - (list - "()")) - ) - (semantic-list - "\\[\\]" - ,(semantic-lambda - (list - "[]")) - ) - (punctuation - "\\`[<]\\'") - (punctuation - "\\`[>]\\'") - (punctuation - "\\`[*]\\'") - (punctuation - "\\`[+]\\'" - punctuation - "\\`[+]\\'" - ,(semantic-lambda - (list - "++")) - ) - (punctuation - "\\`[+]\\'") - (punctuation - "\\`[-]\\'" - punctuation - "\\`[-]\\'" - ,(semantic-lambda - (list - "--")) - ) - (punctuation - "\\`[-]\\'") - (punctuation - "\\`[&]\\'" - punctuation - "\\`[&]\\'" - ,(semantic-lambda - (list - "&&")) - ) - (punctuation - "\\`[&]\\'") - (punctuation - "\\`[|]\\'" - punctuation - "\\`[|]\\'" - ,(semantic-lambda - (list - "||")) - ) - (punctuation - "\\`[|]\\'") - (punctuation - "\\`[/]\\'") - (punctuation - "\\`[=]\\'") - (punctuation - "\\`[!]\\'") - (punctuation - "\\`[~]\\'") - (punctuation - "\\`[%]\\'") - (punctuation - "\\`[,]\\'") - (punctuation - "\\`\\^\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda - (list - "^=")) - ) - (punctuation - "\\`\\^\\'") - ) ;; end operatorsym - - (functionname - (OPERATOR - operatorsym - ,(semantic-lambda - (nth 1 vals)) - ) - (semantic-list - ,(lambda (vals start end) - (semantic-bovinate-from-nonterminal - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'function-pointer)) - ) - (symbol - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end functionname - - (function-pointer - (open-paren - "(" - punctuation - "\\`[*]\\'" - symbol - close-paren - ")" - ,(semantic-lambda - (list - (concat - "*" - (nth 2 vals)))) - ) - (open-paren - "(" - symbol - close-paren - ")" - ,(semantic-lambda - (list - (nth 1 vals))) - ) - ) ;; end function-pointer - - (fun-or-proto-end - (punctuation - "\\`[;]\\'" - ,(semantic-lambda - (list t)) - ) - (semantic-list - ,(semantic-lambda - (list nil)) - ) - (punctuation - "\\`[=]\\'" - number - "^0$" - punctuation - "\\`[;]\\'" - ,(semantic-lambda - (list ':pure-virtual-flag)) - ) - (fun-try-end - ,(semantic-lambda - (list nil)) - ) - ) ;; end fun-or-proto-end - - (fun-try-end - (TRY - opt-initializers - semantic-list - "^{" - fun-try-several-catches - ,(semantic-lambda - (list nil)) - ) - ) ;; end fun-try-end - - (fun-try-several-catches - (CATCH - semantic-list - "^(" - semantic-list - "^{" - fun-try-several-catches - ,(semantic-lambda) - ) - (CATCH - semantic-list - "^{" - fun-try-several-catches - ,(semantic-lambda) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end fun-try-several-catches - - (type-cast - (semantic-list - ,(lambda (vals start end) - (semantic-bovinate-from-nonterminal - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'type-cast-list)) - ) - ) ;; end type-cast - - (type-cast-list - (open-paren - typeformbase - close-paren) - ) ;; end type-cast-list - - (opt-stuff-after-symbol - (semantic-list - "^(") - (semantic-list - "\\[.*\\]$") - ( ;;EMPTY - ) - ) ;; end opt-stuff-after-symbol - - (multi-stage-dereference - (namespace-symbol - opt-stuff-after-symbol - punctuation - "\\`[.]\\'" - multi-stage-dereference) - (namespace-symbol - opt-stuff-after-symbol - punctuation - "\\`[-]\\'" - punctuation - "\\`[>]\\'" - multi-stage-dereference) - (namespace-symbol - opt-stuff-after-symbol) - ) ;; end multi-stage-dereference - - (string-seq - (string - string-seq - ,(semantic-lambda - (list - (concat - (nth 0 vals) - (car - (nth 1 vals))))) - ) - (string - ,(semantic-lambda - (list - (nth 0 vals))) - ) - ) ;; end string-seq - - (expr-start - (punctuation - "\\`[-]\\'") - (punctuation - "\\`[+]\\'") - (punctuation - "\\`[*]\\'") - (punctuation - "\\`[&]\\'") - ) ;; end expr-start - - (expr-binop - (punctuation - "\\`[-]\\'") - (punctuation - "\\`[+]\\'") - (punctuation - "\\`[*]\\'") - (punctuation - "\\`[/]\\'") - (punctuation - "\\`[&]\\'" - punctuation - "\\`[&]\\'") - (punctuation - "\\`[&]\\'") - (punctuation - "\\`[|]\\'" - punctuation - "\\`[|]\\'") - (punctuation - "\\`[|]\\'") - ) ;; end expr-binop - - (expression - (unaryexpression - expr-binop - unaryexpression - ,(semantic-lambda - (list - (identity start) - (identity end))) - ) - (unaryexpression - ,(semantic-lambda - (list - (identity start) - (identity end))) - ) - ) ;; end expression - - (unaryexpression - (number) - (multi-stage-dereference) - (NEW - multi-stage-dereference) - (NEW - builtintype-types - semantic-list) - (namespace-symbol) - (string-seq) - (type-cast - expression) - (semantic-list - expression) - (semantic-list) - (expr-start - expression) - ) ;; end unaryexpression - ) - "Parser table.") - -(defun semantic-c-by--install-parser () - "Setup the Semantic Parser." - (setq semantic--parse-table semantic-c-by--parse-table - semantic-debug-parser-source "c.by" - semantic-debug-parser-class 'semantic-bovine-debug-parser - semantic-flex-keywords-obarray semantic-c-by--keyword-table - semantic-equivalent-major-modes '(c-mode c++-mode) - )) - - -;;; Analyzers -;; - -;;; Epilogue -;; - -(provide 'semantic/bovine/c-by) - -;;; semantic/bovine/c-by.el ends here diff --git a/lisp/cedet/semantic/bovine/grammar.el b/lisp/cedet/semantic/bovine/grammar.el index 0133ee72b18..8a87fa9170e 100644 --- a/lisp/cedet/semantic/bovine/grammar.el +++ b/lisp/cedet/semantic/bovine/grammar.el @@ -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) diff --git a/lisp/cedet/semantic/bovine/make-by.el b/lisp/cedet/semantic/bovine/make-by.el deleted file mode 100644 index b94cfa44aac..00000000000 --- a/lisp/cedet/semantic/bovine/make-by.el +++ /dev/null @@ -1,391 +0,0 @@ -;;; 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 . - -;;; 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 - ,(semantic-lambda - (list nil)) - ) - (IFNEQ - some-whitespace - expression - newline - ,(semantic-lambda - (list nil)) - ) - (ELSE - newline - ,(semantic-lambda - (list nil)) - ) - (ENDIF - newline - ,(semantic-lambda - (list nil)) - ) - ) ;; end conditional - - (expression - (semantic-list) - ) ;; end expression - - (include - (INCLUDE - some-whitespace - element-list - ,(semantic-lambda - (semantic-tag-new-include - (nth 2 vals) nil)) - ) - ) ;; end include - - (equals - (punctuation - "\\`[:]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda) - ) - (punctuation - "\\`[+]\\'" - punctuation - "\\`[=]\\'" - ,(semantic-lambda) - ) - (punctuation - "\\`[=]\\'" - ,(semantic-lambda) - ) - ) ;; end equals - - (colons - (punctuation - "\\`[:]\\'" - punctuation - "\\`[:]\\'" - ,(semantic-lambda) - ) - (punctuation - "\\`[:]\\'" - ,(semantic-lambda) - ) - ) ;; end colons - - (element-list - (elements - newline - ,(semantic-lambda - (nth 0 vals)) - ) - ) ;; end element-list - - (elements - (element - some-whitespace - elements - ,(semantic-lambda - (nth 0 vals) - (nth 2 vals)) - ) - (element - ,(semantic-lambda - (nth 0 vals)) - ) - ( ;;EMPTY - ) - ) ;; end elements - - (element - (sub-element - element - ,(semantic-lambda - (list - (concat - (car - (nth 0 vals)) - (car - (nth 1 vals))))) - ) - ( ;;EMPTY - ) - ) ;; end element - - (sub-element - (symbol) - (string) - (punctuation) - (semantic-list - ,(semantic-lambda - (list - (buffer-substring-no-properties - (identity start) - (identity end)))) - ) - ) ;; end sub-element - - (varref - (punctuation - "\\`[$]\\'" - semantic-list - ,(semantic-lambda - (list - (buffer-substring-no-properties - (identity start) - (identity end)))) - ) - ) ;; end varref - - (commands - (bol - shell-command - newline - commands - ,(semantic-lambda - (list - (nth 0 vals)) - (nth 1 vals)) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end commands - - (opt-whitespace - (some-whitespace - ,(semantic-lambda - (list nil)) - ) - ( ;;EMPTY - ) - ) ;; end opt-whitespace - - (some-whitespace - (whitespace - some-whitespace - ,(semantic-lambda - (list nil)) - ) - (whitespace - ,(semantic-lambda - (list nil)) - ) - ) ;; end some-whitespace - ) - "Parser table.") - -(defun semantic-make-by--install-parser () - "Setup the Semantic Parser." - (setq semantic--parse-table semantic-make-by--parse-table - semantic-debug-parser-source "make.by" - semantic-debug-parser-class 'semantic-bovine-debug-parser - semantic-flex-keywords-obarray semantic-make-by--keyword-table - )) - - -;;; Analyzers -;; - -;;; Epilogue -;; - -(provide 'semantic/bovine/make-by) - -;;; semantic/bovine/make-by.el ends here diff --git a/lisp/cedet/semantic/bovine/scm-by.el b/lisp/cedet/semantic/bovine/scm-by.el deleted file mode 100644 index 261607c84d1..00000000000 --- a/lisp/cedet/semantic/bovine/scm-by.el +++ /dev/null @@ -1,196 +0,0 @@ -;;; semantic/bovine/scm-by.el --- Generated parser support file - -;; Copyright (C) 2001, 2003, 2009-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 . - -;;; Commentary: -;; -;; This file was generated from admin/grammars/scm.by. - -;;; Code: - -(require 'semantic/lex) -(eval-when-compile (require 'semantic/bovine)) - -;;; Prologue -;; - -;;; Declarations -;; -(defconst semantic-scm-by--keyword-table - (semantic-lex-make-keyword-table - '(("define" . DEFINE) - ("define-module" . DEFINE-MODULE) - ("load" . LOAD)) - '(("load" summary "Function: (load \"filename\")") - ("define-module" summary "Function: (define-module (name arg1 ...)) ") - ("define" summary "Function: (define symbol expression)"))) - "Table of language keywords.") - -(defconst semantic-scm-by--token-table - (semantic-lex-make-type-table - '(("close-paren" - (CLOSEPAREN . ")")) - ("open-paren" - (OPENPAREN . "("))) - 'nil) - "Table of lexical tokens.") - -(defconst semantic-scm-by--parse-table - `( - (bovine-toplevel - (scheme) - ) ;; end bovine-toplevel - - (scheme - (semantic-list - ,(lambda (vals start end) - (semantic-bovinate-from-nonterminal - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'scheme-list)) - ) - ) ;; end scheme - - (scheme-list - (open-paren - "(" - scheme-in-list - close-paren - ")" - ,(semantic-lambda - (nth 1 vals)) - ) - ) ;; end scheme-list - - (scheme-in-list - (DEFINE - symbol - expression - ,(semantic-lambda - (semantic-tag-new-variable - (nth 1 vals) nil - (nth 2 vals))) - ) - (DEFINE - name-args - opt-doc - sequence - ,(semantic-lambda - (semantic-tag-new-function - (car - (nth 1 vals)) nil - (cdr - (nth 1 vals)))) - ) - (DEFINE-MODULE - name-args - ,(semantic-lambda - (semantic-tag-new-package - (nth - (length - (nth 1 vals)) - (nth 1 vals)) nil)) - ) - (LOAD - string - ,(semantic-lambda - (semantic-tag-new-include - (file-name-nondirectory - (read - (nth 1 vals))) - (read - (nth 1 vals)))) - ) - (symbol - ,(semantic-lambda - (semantic-tag-new-code - (nth 0 vals) nil)) - ) - ) ;; end scheme-in-list - - (name-args - (semantic-list - ,(lambda (vals start end) - (semantic-bovinate-from-nonterminal - (car - (nth 0 vals)) - (cdr - (nth 0 vals)) - 'name-arg-expand)) - ) - ) ;; end name-args - - (name-arg-expand - (open-paren - name-arg-expand - ,(semantic-lambda - (nth 1 vals)) - ) - (symbol - name-arg-expand - ,(semantic-lambda - (cons - (nth 0 vals) - (nth 1 vals))) - ) - ( ;;EMPTY - ,(semantic-lambda) - ) - ) ;; end name-arg-expand - - (opt-doc - (string) - ( ;;EMPTY - ) - ) ;; end opt-doc - - (sequence - (expression - sequence) - (expression) - ) ;; end sequence - - (expression - (symbol) - (semantic-list) - (string) - (number) - ) ;; end expression - ) - "Parser table.") - -(defun semantic-scm-by--install-parser () - "Setup the Semantic Parser." - (setq semantic--parse-table semantic-scm-by--parse-table - semantic-debug-parser-source "scheme.by" - semantic-debug-parser-class 'semantic-bovine-debug-parser - semantic-flex-keywords-obarray semantic-scm-by--keyword-table - )) - - -;;; Analyzers -;; - -;;; Epilogue -;; - -(provide 'semantic/bovine/scm-by) - -;;; semantic/bovine/scm-by.el ends here diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el index 8d9cfcccd7d..614ce706b0c 100644 --- a/lisp/cedet/semantic/db.el +++ b/lisp/cedet/semantic/db.el @@ -697,7 +697,7 @@ form." (interactive) (unless noninteractive (message "Saving tag summaries...")) - (let ((semanticdb--inhibit-make-directory nil)) + (let ((semanticdb--inhibit-make-directory noninteractive)) (mapc 'semanticdb-save-db semanticdb-database-list)) (unless noninteractive (message "Saving tag summaries...done"))) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index a545fcaee46..ca36829df82 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -33,6 +33,8 @@ (require 'semantic/wisent) (require 'semantic/ctxt) (require 'semantic/format) +;; FIXME this is a generated file, but we need to load this file to +;; generate it! (require 'semantic/grammar-wy) (require 'semantic/idle) (require 'help-fns) @@ -605,6 +607,11 @@ The symbols in the template are local variables in \(provide '" libr ") +;; Local Variables: +;; version-control: never +;; no-update-autoloads: t +;; End: + ;;; " file " ends here ") "Generated footer template. @@ -822,9 +829,10 @@ Block definitions are read from the current table of lexical types." (noninteractive) noninteractive)) -(defun semantic-grammar-create-package (&optional force) +(defun semantic-grammar-create-package (&optional force uptodate) "Create package Lisp code from grammar in current buffer. -Does nothing if the Lisp code seems up to date. +If the Lisp code seems up to date, do nothing (if UPTODATE +is non-nil, return nil in such cases). If optional argument FORCE is non-nil, unconditionally re-generate the Lisp code." (interactive "P") @@ -854,7 +862,12 @@ Lisp code." (file-newer-than-file-p (buffer-file-name semantic--grammar-output-buffer) (buffer-file-name semantic--grammar-input-buffer))) - (message "Package `%s' is up to date." semantic--grammar-package) + (progn + (message "Package `%s' is up to date." semantic--grammar-package) + ;; It would be better if this were always the case, IMO, + ;; but the (unspecified) return value of this function is + ;; assumed to be non-nil in some places, it seems. + (if uptodate (setq output nil))) ;; Create the package (set-buffer semantic--grammar-output-buffer) ;; Use Unix EOLs, so that the file is portable to all platforms. @@ -1914,6 +1927,7 @@ Optional argument COLOR determines if color is added to the text." (provide 'semantic/grammar) + ;; Local variables: ;; generated-autoload-load-name: "semantic/grammar" ;; End: diff --git a/lisp/cedet/semantic/wisent/grammar.el b/lisp/cedet/semantic/wisent/grammar.el index 109d5ae7dfb..f61b05fa2e6 100644 --- a/lisp/cedet/semantic/wisent/grammar.el +++ b/lisp/cedet/semantic/wisent/grammar.el @@ -473,6 +473,54 @@ Menu items are appended to the common grammar menu.") \;; 2009, 2010 Python Software Foundation; All Rights Reserved" ,wisent-make-parsers--python-license))) +;; Cf bovine--make-parser-1. +(defun wisent--make-parser-1 (infile &optional outdir) + (if outdir (setq outdir (file-name-directory (expand-file-name 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))) + output-data) + (when (setq output-data (assoc packagename wisent-make-parsers--parser-file-name)) + (let ((additional-copyright (nth 1 output-data)) + (additional-license (nth 2 output-data)) + (filename (expand-file-name + (progn (string-match ".*/\\(.*\\)" packagename) + (match-string 1 packagename)) + outdir)) + copyright-end) + ;; Touch up the generated parsers for Emacs integration. + (with-temp-file filename + (insert-file-contents filename) + ;; Fix copyright header: + (goto-char (point-min)) + (when additional-copyright + (re-search-forward "Copyright (C).*$") + (insert "\n;; " additional-copyright)) + (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 wisent-make-parsers--emacs-license) + (insert "\n\n;;; Commentary: +;; +;; This file was generated from admin/grammars/" + (file-name-nondirectory infile) ".") + (when additional-license + (insert "\n" additional-license)) + (insert "\n\n;;; Code:\n") + (goto-char (point-min)) + (delete-region (point-min) (line-end-position)) + (insert ";;; " packagename + " --- Generated parser support file") + (re-search-forward ";;; \\(.*\\) ends here") + (replace-match packagename nil nil nil 1) + (delete-trailing-whitespace)))))) + (defun wisent-make-parsers () "Generate Emacs' built-in Wisent-based parser files." (interactive) @@ -480,46 +528,32 @@ Menu items are appended to the common grammar menu.") ;; Loop through each .wy file in current directory, and run ;; `semantic-grammar-batch-build-one-package' to build the grammar. (dolist (f (directory-files default-directory nil "\\.wy\\'")) - (let ((packagename - (condition-case err - (with-current-buffer (find-file-noselect f) - (semantic-grammar-create-package)) - (error (message "%s" (error-message-string err)) nil))) - output-data) - (when (setq output-data (assoc packagename wisent-make-parsers--parser-file-name)) - (let ((additional-copyright (nth 1 output-data)) - (additional-license (nth 2 output-data)) - (filename (progn (string-match ".*/\\(.*\\)" packagename) (match-string 1 packagename))) - copyright-end) - ;; Touch up the generated parsers for Emacs integration. - (with-temp-buffer - (insert-file-contents filename) - ;; Fix copyright header: - (goto-char (point-min)) - (when additional-copyright - (re-search-forward "Copyright (C).*$") - (insert "\n;; " additional-copyright)) - (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 wisent-make-parsers--emacs-license) - (insert "\n\n;;; Commentary: -;; -;; This file was generated from admin/grammars/" - f ".") - (when additional-license - (insert "\n" additional-license)) - (insert "\n\n;;; Code:\n") - (goto-char (point-min)) - (delete-region (point-min) (line-end-position)) - (insert ";;; " packagename - " --- Generated parser support file") - (re-search-forward ";;; \\(.*\\) ends here") - (replace-match packagename nil nil nil 1) - (delete-trailing-whitespace) - (write-region nil nil (expand-file-name filename)))))))) + (wisent--make-parser-1 f))) + + +(defun wisent-batch-make-parser (&optional infile outdir) + "Generate a Wisent parser from input INFILE, writing to OUTDIR. +This is mainly intended for use in batch mode: + +emacs -batch -l semantic/wisent/grammar -f wisent-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)) + (wisent--make-parser-1 infile outdir)) + (provide 'semantic/wisent/grammar) diff --git a/lisp/cedet/semantic/wisent/javat-wy.el b/lisp/cedet/semantic/wisent/javat-wy.el deleted file mode 100644 index 1156cb5792c..00000000000 --- a/lisp/cedet/semantic/wisent/javat-wy.el +++ /dev/null @@ -1,688 +0,0 @@ -;;; semantic/wisent/javat-wy.el --- Generated parser support file - -;; Copyright (C) 2002-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 . - -;;; Commentary: -;; -;; This file was generated from admin/grammars/java-tags.wy. - -;;; Code: - -(require 'semantic/lex) -(eval-when-compile (require 'semantic/bovine)) - -;;; Prologue -;; -(declare-function semantic-parse-region "semantic" - (start end &optional nonterminal depth returnonerror)) - -;;; Declarations -;; -(defconst wisent-java-tags-wy--keyword-table - (semantic-lex-make-keyword-table - '(("abstract" . ABSTRACT) - ("boolean" . BOOLEAN) - ("break" . BREAK) - ("byte" . BYTE) - ("case" . CASE) - ("catch" . CATCH) - ("char" . CHAR) - ("class" . CLASS) - ("const" . CONST) - ("continue" . CONTINUE) - ("default" . DEFAULT) - ("do" . DO) - ("double" . DOUBLE) - ("else" . ELSE) - ("extends" . EXTENDS) - ("final" . FINAL) - ("finally" . FINALLY) - ("float" . FLOAT) - ("for" . FOR) - ("goto" . GOTO) - ("if" . IF) - ("implements" . IMPLEMENTS) - ("import" . IMPORT) - ("instanceof" . INSTANCEOF) - ("int" . INT) - ("interface" . INTERFACE) - ("long" . LONG) - ("native" . NATIVE) - ("new" . NEW) - ("package" . PACKAGE) - ("private" . PRIVATE) - ("protected" . PROTECTED) - ("public" . PUBLIC) - ("return" . RETURN) - ("short" . SHORT) - ("static" . STATIC) - ("strictfp" . STRICTFP) - ("super" . SUPER) - ("switch" . SWITCH) - ("synchronized" . SYNCHRONIZED) - ("this" . THIS) - ("throw" . THROW) - ("throws" . THROWS) - ("transient" . TRANSIENT) - ("try" . TRY) - ("void" . VOID) - ("volatile" . VOLATILE) - ("while" . WHILE) - ("@author" . _AUTHOR) - ("@version" . _VERSION) - ("@param" . _PARAM) - ("@return" . _RETURN) - ("@exception" . _EXCEPTION) - ("@throws" . _THROWS) - ("@see" . _SEE) - ("@since" . _SINCE) - ("@serial" . _SERIAL) - ("@serialData" . _SERIALDATA) - ("@serialField" . _SERIALFIELD) - ("@deprecated" . _DEPRECATED)) - '(("@deprecated" javadoc - (seq 12 usage - (type function variable) - opt t)) - ("@serialField" javadoc - (seq 11 usage - (variable) - opt t)) - ("@serialData" javadoc - (seq 10 usage - (function) - opt t)) - ("@serial" javadoc - (seq 9 usage - (variable) - opt t)) - ("@since" javadoc - (seq 8 usage - (type function variable) - opt t)) - ("@see" javadoc - (seq 7 usage - (type function variable) - opt t with-ref t)) - ("@throws" javadoc - (seq 6 usage - (function) - with-name t)) - ("@exception" javadoc - (seq 5 usage - (function) - with-name t)) - ("@return" javadoc - (seq 4 usage - (function))) - ("@param" javadoc - (seq 3 usage - (function) - with-name t)) - ("@version" javadoc - (seq 2 usage - (type))) - ("@author" javadoc - (seq 1 usage - (type))) - ("while" summary "while () | do while ();") - ("volatile" summary "Field declaration modifier: volatile ...") - ("void" summary "Method return type: void ...") - ("try" summary "try {} [catch() {} ...] [finally {}]") - ("transient" summary "Field declaration modifier: transient ...") - ("throws" summary "Method|Constructor declaration: throws , ...") - ("throw" summary "throw ;") - ("synchronized" summary "synchronized () ... | Method decl. modifier: synchronized ...") - ("switch" summary "switch() {[case : ...] [default: ]}") - ("strictfp" summary "Declaration modifier: strictfp {class|interface|} ...") - ("static" summary "Declaration modifier: static {class|interface|} ...") - ("short" summary "Integral primitive type (-32768 to 32767)") - ("return" summary "return [] ;") - ("public" summary "Access level modifier: public {class|interface|} ...") - ("protected" summary "Access level modifier: protected {class|interface|} ...") - ("private" summary "Access level modifier: private {class|interface|} ...") - ("package" summary "Package declaration: package ") - ("native" summary "Method declaration modifier: native ...") - ("long" summary "Integral primitive type (-9223372036854775808 to 9223372036854775807)") - ("interface" summary "Interface declaration: interface ") - ("int" summary "Integral primitive type (-2147483648 to 2147483647)") - ("import" summary "Import package declarations: import ") - ("implements" summary "Class SuperInterfaces declaration: implements [, ...]") - ("if" summary "if () [else ]") - ("goto" summary "Unused reserved word") - ("for" summary "for ([]; []; []) ") - ("float" summary "Primitive floating-point type (single-precision 32-bit IEEE 754)") - ("finally" summary "try {} ... finally {}") - ("final" summary "Class|Member declaration modifier: final {class|} ...") - ("extends" summary "SuperClass|SuperInterfaces declaration: extends [, ...]") - ("else" summary "if () else ") - ("double" summary "Primitive floating-point type (double-precision 64-bit IEEE 754)") - ("do" summary "do while ();") - ("default" summary "switch() { ... default: }") - ("continue" summary "continue [