From f79fbbc795f85969a7fc84f1e46ec8162c04b91b Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 31 Jul 2011 20:11:37 -0400 Subject: [PATCH] Tweak grammar files to match up with variable names used in parser files. --- etc/grammars/README | 18 ++++++++++-------- etc/grammars/bovine-grammar.el | 9 ++++----- etc/grammars/c.by | 2 +- etc/grammars/java-tags.wy | 16 ++++++++-------- etc/grammars/{javascript-jv.wy => js.wy} | 16 ++++++++-------- etc/grammars/make.by | 2 +- etc/grammars/python.wy | 2 +- etc/grammars/scheme.by | 2 +- etc/grammars/wisent-grammar.el | 4 ++++ 9 files changed, 38 insertions(+), 33 deletions(-) rename etc/grammars/{javascript-jv.wy => js.wy} (97%) diff --git a/etc/grammars/README b/etc/grammars/README index 657f9c20ecb..c8328bbc885 100644 --- a/etc/grammars/README +++ b/etc/grammars/README @@ -3,15 +3,17 @@ generate the parser data in the lisp/semantic/bovine/ and lisp/semantic/wisent/ directories. You can run the parser generators with -emacs -batch --no-site-file \ - -l semantic/bovine -l semantic/wisent -l semantic/grammar \ - -l semantic/lex -l bovine-grammar.el \ - -f semantic-mode -f semantic-grammar-batch-build-packages *.by +emacs -batch --no-site-file -l bovine-grammar.el -f semantic-mode \ + -f semantic-grammar-batch-build-packages *.by -emacs -batch --no-site-file \ - -l semantic/bovine -l semantic/wisent -l semantic/grammar \ - -l semantic/lex -l wisent-grammar.el \ - -f semantic-mode -f semantic-grammar-batch-build-packages *.wy +emacs -batch --no-site-file -l wisent-grammar.el -f semantic-mode \ + -f semantic-grammar-batch-build-packages *.wy + +The output files were subsequently edited by hand to fix copyright +headers, variable names (to follow library name conventions), and +feature names. These changes do not alter the code logic, and can be +viewed by diffing to the files in lisp/semantic/bovine/ and +lisp/semantic/wisent/. Currently, the parser files in lisp/ are not generated directly from these grammar files when making Emacs. This state of affairs, and the diff --git a/etc/grammars/bovine-grammar.el b/etc/grammars/bovine-grammar.el index 99da6ea5599..5a948608671 100644 --- a/etc/grammars/bovine-grammar.el +++ b/etc/grammars/bovine-grammar.el @@ -32,6 +32,9 @@ (require 'semantic) (require 'semantic/grammar) (require 'semantic/find) +(require 'semantic/lex) +(require 'semantic/wisent) +(require 'semantic/bovine) (defun bovine-grammar-EXPAND (bounds nonterm) "Expand call to EXPAND grammar macro. @@ -112,7 +115,6 @@ FORM is a list in which we are substituting. Argument QUOTEMODE is non-nil if we are in backquote mode. When non-nil, optional argument INPLACE indicates that FORM is being expanded from elsewhere." - (when (listp form) (when (eq (car form) 'quote) (setq form (cdr form)) (cond @@ -218,7 +220,7 @@ expanded from elsewhere." )) (if inlist (insert ")")) (if inplace (insert ")"))) - ))) + )) (defun bovine-grammar-expand-action (textform quotemode) "Expand semantic action string TEXTFORM into Lisp code. @@ -226,7 +228,6 @@ QUOTEMODE is the mode in which quoted symbols are slurred." (if (string= "" textform) nil (let ((sexp (read textform))) - ;; We converted the lambda string into a list. Now write it ;; out as the bovine lambda expression, and do macro-like ;; conversion upon it. @@ -339,7 +340,6 @@ manual." (when (member nterm '("bovine-toplevel" "bovine-inner-scope")) (error "`%s' is a reserved internal name" nterm)) (insert "\n(" nterm) - ;; Process each rule (while rules (setq items (semantic-tag-get-attribute (car rules) :value) @@ -375,7 +375,6 @@ manual." (t (insert (semantic-grammar-item-text item))) )))) - (if prec (message "%%prec %S ignored" prec)) (if actn diff --git a/etc/grammars/c.by b/etc/grammars/c.by index cf8cb0c638e..1797827679b 100644 --- a/etc/grammars/c.by +++ b/etc/grammars/c.by @@ -38,7 +38,7 @@ ;; > * Can't parse signature element: "const RmcCmdMCDetailedStatus& status" ;; > * Can't parse signature element: "RmcBucStatus* rftBucStatus" -%package c-by +%package semantic-c-by %languagemode c-mode c++-mode %start declaration diff --git a/etc/grammars/java-tags.wy b/etc/grammars/java-tags.wy index aed39669c53..99d2b9df81d 100644 --- a/etc/grammars/java-tags.wy +++ b/etc/grammars/java-tags.wy @@ -22,7 +22,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . -%package java-tags-wy +%package wisent-java-tags-wy %languagemode java-mode @@ -733,17 +733,17 @@ It ignores whitespaces, newlines and comments." semantic-lex-ignore-newline semantic-lex-ignore-comments ;;;; Auto-generated analyzers. - semantic/wisent/java-tags-wy---regexp-analyzer - semantic/wisent/java-tags-wy---sexp-analyzer + wisent-java-tags-wy---regexp-analyzer + wisent-java-tags-wy---sexp-analyzer ;; Must detect keywords before other symbols - semantic/wisent/java-tags-wy---keyword-analyzer - semantic/wisent/java-tags-wy---regexp-analyzer - semantic/wisent/java-tags-wy---string-analyzer - semantic/wisent/java-tags-wy---block-analyzer + wisent-java-tags-wy---keyword-analyzer + wisent-java-tags-wy---regexp-analyzer + wisent-java-tags-wy---string-analyzer + wisent-java-tags-wy---block-analyzer ;; In theory, unicode chars should be turned into normal chars ;; and then combined into regular ascii keywords and text. This ;; analyzer just keeps these things from making the lexer go boom. - semantic/wisent/java-tags-wy---regexp-analyzer + wisent-java-tags-wy---regexp-analyzer ;;;; semantic-lex-default-action) diff --git a/etc/grammars/javascript-jv.wy b/etc/grammars/js.wy similarity index 97% rename from etc/grammars/javascript-jv.wy rename to etc/grammars/js.wy index ba518392ae2..a13abf56e6e 100644 --- a/etc/grammars/javascript-jv.wy +++ b/etc/grammars/js.wy @@ -1,7 +1,7 @@ ;;; javascript-jv.wy -- LALR grammar for Javascript ;; Copyright (C) 2005-2011 Free Software Foundation, Inc. -;; Copyright (C) Ecma International. +;; Copyright (C) 1998-2011 Ecma International. ;; Author: Joakim Verona @@ -57,7 +57,7 @@ ;; USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ;; DAMAGE. -%package javascript-jv-wy +%package wisent-javascript-jv-wy ;; JAVE I prefere ecmascript-mode %languagemode ecmascript-mode javascript-mode @@ -509,14 +509,14 @@ OptionalExpression : Expression semantic-lex-ignore-comments ;;stuff generated from the wy file(one for each "type" declaration) - semantic/wisent/javascript-jv-wy---regexp-analyzer - semantic/wisent/javascript-jv-wy---sexp-analyzer + wisent-javascript-jv-wy---regexp-analyzer + wisent-javascript-jv-wy---sexp-analyzer - semantic/wisent/javascript-jv-wy---keyword-analyzer + wisent-javascript-jv-wy---keyword-analyzer - semantic/wisent/javascript-jv-wy---regexp-analyzer - semantic/wisent/javascript-jv-wy---string-analyzer - semantic/wisent/javascript-jv-wy---block-analyzer + wisent-javascript-jv-wy---regexp-analyzer + wisent-javascript-jv-wy---string-analyzer + wisent-javascript-jv-wy---block-analyzer ;;;;more std stuff diff --git a/etc/grammars/make.by b/etc/grammars/make.by index 3eb56bf2b49..dab4472b737 100644 --- a/etc/grammars/make.by +++ b/etc/grammars/make.by @@ -21,7 +21,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . -%package make-by +%package semantic-make-by %languagemode makefile-mode %start Makefile diff --git a/etc/grammars/python.wy b/etc/grammars/python.wy index 8a7b7771d53..a0af813e5e8 100644 --- a/etc/grammars/python.wy +++ b/etc/grammars/python.wy @@ -86,7 +86,7 @@ ;; Settings ;; -------- -%package python-wy +%package wisent-python-wy %languagemode python-mode diff --git a/etc/grammars/scheme.by b/etc/grammars/scheme.by index 9e57afe7438..bc6612d4c70 100644 --- a/etc/grammars/scheme.by +++ b/etc/grammars/scheme.by @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . -%package scm-by +%package semantic-scm-by %languagemode scheme-mode %start scheme diff --git a/etc/grammars/wisent-grammar.el b/etc/grammars/wisent-grammar.el index 1bef2646645..d7de1ee6f7b 100644 --- a/etc/grammars/wisent-grammar.el +++ b/etc/grammars/wisent-grammar.el @@ -26,8 +26,12 @@ ;; Major mode for editing Wisent's input grammar (.wy) files. ;;; Code: +(require 'semantic) (require 'semantic/grammar) (require 'semantic/find) +(require 'semantic/lex) +(require 'semantic/wisent) +(require 'semantic/bovine) (defsubst wisent-grammar-region-placeholder (symb) "Given a $N placeholder symbol in SYMB, return a $regionN symbol. -- 2.39.5