Add a mechanism to specify expected shift/reduce .wy conflicts
* admin/grammars/python.wy: Set the expected number of shift/reduce conflicts to four. * lisp/cedet/semantic/grammar.el (semantic-grammar-expected-conflicts): New function. * lisp/cedet/semantic/wisent/comp.el (wisent-total-conflicts): Use it to suppress warnings about the expected number of shift/reduce conflicts.
This commit is contained in:
parent
e09fcc1ff3
commit
d715ae8788
3 changed files with 18 additions and 8 deletions
|
@ -88,6 +88,7 @@
|
||||||
|
|
||||||
%package wisent-python-wy
|
%package wisent-python-wy
|
||||||
%provide semantic/wisent/python-wy
|
%provide semantic/wisent/python-wy
|
||||||
|
%expectedconflicts 4
|
||||||
|
|
||||||
%{
|
%{
|
||||||
(declare-function wisent-python-reconstitute-function-tag
|
(declare-function wisent-python-reconstitute-function-tag
|
||||||
|
|
|
@ -277,6 +277,13 @@ foo.by it is foo-by."
|
||||||
(i (string-match (format "\\([.]\\)%s\\'" ext) file)))
|
(i (string-match (format "\\([.]\\)%s\\'" ext) file)))
|
||||||
(concat (substring file 0 i) "-" ext))))
|
(concat (substring file 0 i) "-" ext))))
|
||||||
|
|
||||||
|
(defun semantic-grammar-expected-conflicts ()
|
||||||
|
"Return the number of expected shift/reduce conflicts in the package."
|
||||||
|
(let ((conflicts (semantic-grammar-tag-symbols 'expectedconflicts)))
|
||||||
|
(if conflicts
|
||||||
|
(string-to-number conflicts)
|
||||||
|
0)))
|
||||||
|
|
||||||
(defsubst semantic-grammar-languagemode ()
|
(defsubst semantic-grammar-languagemode ()
|
||||||
"Return the %languagemode value as a list of symbols or nil."
|
"Return the %languagemode value as a list of symbols or nil."
|
||||||
(semantic-grammar-tag-symbols 'languagemode))
|
(semantic-grammar-tag-symbols 'languagemode))
|
||||||
|
@ -987,7 +994,7 @@ Return non-nil if there were no errors, nil if errors."
|
||||||
(vc-handled-backends nil))
|
(vc-handled-backends nil))
|
||||||
(setq semanticdb-new-database-class 'semanticdb-project-database)
|
(setq semanticdb-new-database-class 'semanticdb-project-database)
|
||||||
(semantic-mode 1)
|
(semantic-mode 1)
|
||||||
(semantic-grammar-create-package)))
|
(semantic-grammar-create-package t)))
|
||||||
(error
|
(error
|
||||||
(message "%s" (error-message-string err))
|
(message "%s" (error-message-string err))
|
||||||
nil))))
|
nil))))
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'semantic/wisent)
|
(require 'semantic/wisent)
|
||||||
|
(require 'semantic/grammar)
|
||||||
(eval-when-compile (require 'cl-lib))
|
(eval-when-compile (require 'cl-lib))
|
||||||
|
|
||||||
;;;; -------------------
|
;;;; -------------------
|
||||||
|
@ -2272,16 +2273,17 @@ there are any reduce/reduce conflicts."
|
||||||
(let* ((src (wisent-source))
|
(let* ((src (wisent-source))
|
||||||
(src (if src (concat " in " src) ""))
|
(src (if src (concat " in " src) ""))
|
||||||
(msg (format "Grammar%s contains" src)))
|
(msg (format "Grammar%s contains" src)))
|
||||||
(if (> src-total 0)
|
(when (and (> src-total 0)
|
||||||
(setq msg (format "%s %d shift/reduce conflict%s"
|
(not (= rrc-total (semantic-grammar-expected-conflicts))))
|
||||||
msg src-total (if (> src-total 1)
|
(setq msg (format "%s %d shift/reduce conflict%s"
|
||||||
"s" ""))))
|
msg src-total (if (> src-total 1)
|
||||||
|
"s" ""))))
|
||||||
(if (and (> src-total 0) (> rrc-total 0))
|
(if (and (> src-total 0) (> rrc-total 0))
|
||||||
(setq msg (format "%s and" msg)))
|
(setq msg (format "%s and" msg)))
|
||||||
(if (> rrc-total 0)
|
(if (> rrc-total 0)
|
||||||
(setq msg (format "%s %d reduce/reduce conflict%s"
|
(setq msg (format "%s %d reduce/reduce conflict%s"
|
||||||
msg rrc-total (if (> rrc-total 1)
|
msg rrc-total (if (> rrc-total 1)
|
||||||
"s" ""))))
|
"s" ""))))
|
||||||
(message msg))))
|
(message msg))))
|
||||||
|
|
||||||
(defun wisent-print-conflicts ()
|
(defun wisent-print-conflicts ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue