summaryrefslogtreecommitdiff
path: root/lisp/cedet/semantic/wisent/comp.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-06-19 13:47:22 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-06-19 13:48:49 +0200
commit390b4bc1e25fe691548d7ec982eb2f7027fe26a3 (patch)
tree3355d4c19e87fbe9814339a7f82cb30bd458fadd /lisp/cedet/semantic/wisent/comp.el
parenteef48e124da251605ea05579aac196f2f8e2f534 (diff)
downloademacs-390b4bc1e25fe691548d7ec982eb2f7027fe26a3.tar.gz
Allow specifying the expected number of shift/reduce conflicts
* admin/grammars/grammar.wy: Add %expectedconflicts. * lisp/cedet/semantic/grammar-wy.el (semantic-grammar-wy--keyword-table): Ditto. * lisp/cedet/semantic/grammar.el (semantic-grammar-expected-conflicts): New function. (semantic-grammar-insert-defconst-with-eval): New function. (semantic-grammar-create-package): Output the number of expected shift/reduce conflicts. * lisp/cedet/semantic/wisent/comp.el (wisent-total-conflicts): Don't output the warning if the number of shift/reduce conflicts is expected. (wisent-expected-conflicts): Made obsolete.
Diffstat (limited to 'lisp/cedet/semantic/wisent/comp.el')
-rw-r--r--lisp/cedet/semantic/wisent/comp.el36
1 files changed, 22 insertions, 14 deletions
diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el
index 051b898ed78..4e222fa70eb 100644
--- a/lisp/cedet/semantic/wisent/comp.el
+++ b/lisp/cedet/semantic/wisent/comp.el
@@ -2263,26 +2263,34 @@ warning is given if there are either more or fewer conflicts, or if
there are any reduce/reduce conflicts."
:group 'wisent
:type '(choice (const nil) integer))
+(make-obsolete-variable 'wisent-expected-conflicts
+ "use %expectedconflicts in the .wy file instead"
+ "27.1")
(defun wisent-total-conflicts ()
"Report the total number of conflicts."
- (unless (and (zerop rrc-total)
- (or (zerop src-total)
- (= src-total (or wisent-expected-conflicts 0))))
- (let* ((src (wisent-source))
- (src (if src (concat " in " src) ""))
- (msg (format "Grammar%s contains" src)))
- (if (> src-total 0)
+ (let* ((src (wisent-source))
+ (symbol (intern (format "wisent-%s--expected-conflicts"
+ (replace-regexp-in-string "\\.el$" "" src))
+ obarray)))
+ (when (or (not (zerop rrc-total))
+ (and (not (zerop src-total))
+ (not (= src-total (or wisent-expected-conflicts 0)))
+ (or (not (boundp symbol))
+ (not (equal (symbol-value symbol) src-total)))))
+ (let* ((src (if src (concat " in " src) ""))
+ (msg (format "Grammar%s contains" src)))
+ (when (and (> src-total 0))
(setq msg (format "%s %d shift/reduce conflict%s"
msg src-total (if (> src-total 1)
"s" ""))))
- (if (and (> src-total 0) (> rrc-total 0))
- (setq msg (format "%s and" msg)))
- (if (> rrc-total 0)
- (setq msg (format "%s %d reduce/reduce conflict%s"
- msg rrc-total (if (> rrc-total 1)
- "s" ""))))
- (message msg))))
+ (if (and (> src-total 0) (> rrc-total 0))
+ (setq msg (format "%s and" msg)))
+ (if (> rrc-total 0)
+ (setq msg (format "%s %d reduce/reduce conflict%s"
+ msg rrc-total (if (> rrc-total 1)
+ "s" ""))))
+ (message msg)))))
(defun wisent-print-conflicts ()
"Report conflicts."