Tweak grammar files to match up with variable names used in parser files.
This commit is contained in:
parent
93855df97b
commit
f79fbbc795
9 changed files with 38 additions and 33 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
%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--<number>-regexp-analyzer
|
||||
semantic/wisent/java-tags-wy--<string>-sexp-analyzer
|
||||
wisent-java-tags-wy--<number>-regexp-analyzer
|
||||
wisent-java-tags-wy--<string>-sexp-analyzer
|
||||
;; Must detect keywords before other symbols
|
||||
semantic/wisent/java-tags-wy--<keyword>-keyword-analyzer
|
||||
semantic/wisent/java-tags-wy--<symbol>-regexp-analyzer
|
||||
semantic/wisent/java-tags-wy--<punctuation>-string-analyzer
|
||||
semantic/wisent/java-tags-wy--<block>-block-analyzer
|
||||
wisent-java-tags-wy--<keyword>-keyword-analyzer
|
||||
wisent-java-tags-wy--<symbol>-regexp-analyzer
|
||||
wisent-java-tags-wy--<punctuation>-string-analyzer
|
||||
wisent-java-tags-wy--<block>-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--<unicode>-regexp-analyzer
|
||||
wisent-java-tags-wy--<unicode>-regexp-analyzer
|
||||
;;;;
|
||||
semantic-lex-default-action)
|
||||
|
||||
|
|
|
@ -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--<number>-regexp-analyzer
|
||||
semantic/wisent/javascript-jv-wy--<string>-sexp-analyzer
|
||||
wisent-javascript-jv-wy--<number>-regexp-analyzer
|
||||
wisent-javascript-jv-wy--<string>-sexp-analyzer
|
||||
|
||||
semantic/wisent/javascript-jv-wy--<keyword>-keyword-analyzer
|
||||
wisent-javascript-jv-wy--<keyword>-keyword-analyzer
|
||||
|
||||
semantic/wisent/javascript-jv-wy--<symbol>-regexp-analyzer
|
||||
semantic/wisent/javascript-jv-wy--<punctuation>-string-analyzer
|
||||
semantic/wisent/javascript-jv-wy--<block>-block-analyzer
|
||||
wisent-javascript-jv-wy--<symbol>-regexp-analyzer
|
||||
wisent-javascript-jv-wy--<punctuation>-string-analyzer
|
||||
wisent-javascript-jv-wy--<block>-block-analyzer
|
||||
|
||||
|
||||
;;;;more std stuff
|
|
@ -21,7 +21,7 @@
|
|||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
%package make-by
|
||||
%package semantic-make-by
|
||||
|
||||
%languagemode makefile-mode
|
||||
%start Makefile
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
;; Settings
|
||||
;; --------
|
||||
|
||||
%package python-wy
|
||||
%package wisent-python-wy
|
||||
|
||||
%languagemode python-mode
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
%package scm-by
|
||||
%package semantic-scm-by
|
||||
|
||||
%languagemode scheme-mode
|
||||
%start scheme
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue