diff options
| author | Dan Nicolaescu | 2009-07-06 08:32:48 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2009-07-06 08:32:48 +0000 |
| commit | d88782c37fc6b91eadb53b51d7a698037beee5e5 (patch) | |
| tree | 9b4758c2fb698903f4bca46d96004c8017fda0ce | |
| parent | 25c6f63e3afd2328f629b6e0bcbfd1b88afe45ac (diff) | |
| download | emacs-d88782c37fc6b91eadb53b51d7a698037beee5e5.tar.gz emacs-d88782c37fc6b91eadb53b51d7a698037beee5e5.zip | |
(verilog-error-regexp-emacs-alist): Coded custom
representation of verilog error regular expressions to work with
Emacs-22's new format.
(verilog-error-regexp-xemacs-alist): Coded custom representation
of verilog error regular expressions to work with XEmacs format
(verilog-error-regexp-add-xemacs): Hook routine to install verilog
error recognition into XEmacs.
(verilog-error-regexp-add-emacs): Hook routine to install verilog
error recognition into Emacs-22.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/progmodes/verilog-mode.el | 152 |
2 files changed, 105 insertions, 59 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 03a92ebf75f..526eb69a20b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2009-07-07 Michael McNamara <mac@mail.brushroad.com> | ||
| 2 | |||
| 3 | * verilog-mode.el (verilog-error-regexp-emacs-alist): Coded custom | ||
| 4 | representation of verilog error regular expressions to work with | ||
| 5 | Emacs-22's new format. | ||
| 6 | (verilog-error-regexp-xemacs-alist): Coded custom representation | ||
| 7 | of verilog error regular expressions to work with XEmacs format | ||
| 8 | (verilog-error-regexp-add-xemacs): Hook routine to install verilog | ||
| 9 | error recognition into XEmacs. | ||
| 10 | (verilog-error-regexp-add-emacs): Hook routine to install verilog | ||
| 11 | error recognition into Emacs-22. | ||
| 12 | |||
| 1 | 2009-07-06 Chong Yidong <cyd@stupidchicken.com> | 13 | 2009-07-06 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 14 | ||
| 3 | * woman.el: Remove stand-alone closing parentheses. | 15 | * woman.el: Remove stand-alone closing parentheses. |
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 6e0c046976f..1a885fe6b73 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el | |||
| @@ -118,9 +118,9 @@ | |||
| 118 | ;;; Code: | 118 | ;;; Code: |
| 119 | 119 | ||
| 120 | ;; This variable will always hold the version number of the mode | 120 | ;; This variable will always hold the version number of the mode |
| 121 | (defconst verilog-mode-version "520" | 121 | (defconst verilog-mode-version "525" |
| 122 | "Version of this Verilog mode.") | 122 | "Version of this Verilog mode.") |
| 123 | (defconst verilog-mode-release-date "2009-06-12-GNU" | 123 | (defconst verilog-mode-release-date "2009-07-02-GNU" |
| 124 | "Release date of this Verilog mode.") | 124 | "Release date of this Verilog mode.") |
| 125 | (defconst verilog-mode-release-emacs t | 125 | (defconst verilog-mode-release-emacs t |
| 126 | "If non-nil, this version of Verilog mode was released with Emacs itself.") | 126 | "If non-nil, this version of Verilog mode was released with Emacs itself.") |
| @@ -627,50 +627,81 @@ always be saved." | |||
| 627 | (defvar verilog-auto-last-file-locals nil | 627 | (defvar verilog-auto-last-file-locals nil |
| 628 | "Text from file-local-variables during last evaluation.") | 628 | "Text from file-local-variables during last evaluation.") |
| 629 | 629 | ||
| 630 | (defvar verilog-error-regexp-add-didit nil) | ||
| 631 | (defvar verilog-error-regexp nil) | ||
| 632 | ;;; Compile support | 630 | ;;; Compile support |
| 633 | (require 'compile) | 631 | (require 'compile) |
| 634 | (make-variable-buffer-local 'compilation-error-regexp-systems-list) | 632 | (defvar verilog-error-regexp-added nil) |
| 635 | (defvar compilation-error-regexp-alist) ; in case not | ||
| 636 | (make-variable-buffer-local 'compilation-error-regexp-alist) | ||
| 637 | |||
| 638 | ; List of regexps for Verilog compilers, like verilint. See compilation-error-regexp-alist | 633 | ; List of regexps for Verilog compilers, like verilint. See compilation-error-regexp-alist |
| 639 | ; for the formatting. | 634 | ; for the formatting. |
| 640 | (defvar verilog-error-regexp-alist | 635 | ; Here is the version for Emacs 22: |
| 641 | '(verilog | 636 | (defvar verilog-error-regexp-emacs-alist |
| 642 | ; SureLint | 637 | '( |
| 643 | ("[^\n]*\\[\\([^:]+\\):\\([0-9]+\\)\\]" 1 2) | 638 | (verilog-xl-1 |
| 644 | ("\\(WARNING\\|ERROR\\|INFO\\)[^:]*: \\([^,]+\\), \\(line \\|\\)\\([0-9]+\\):" 2 4 ) | 639 | "\\(Error\\|Warning\\)!.*\n?.*\"\\([^\"]+\\)\", \\([0-9]+\\)" 2 3) |
| 645 | ("\ | 640 | (verilog-xl-2 |
| 641 | "([WE][0-9A-Z]+)[ \t]+\\([^ \t\n,]+\\)[, \t]+\\(line[ \t]+\\)?\\([0-9]+\\):.*$" 1 3) | ||
| 642 | (verilog-IES | ||
| 643 | ".*\\*[WE],[0-9A-Z]+ (\\([^ \t,]+\\),\\([0-9]+\\)" 1 2) | ||
| 644 | (verilog-surefire-1 | ||
| 645 | "[^\n]*\\[\\([^:]+\\):\\([0-9]+\\)\\]" 1 2) | ||
| 646 | (verilog-surefire-2 | ||
| 647 | "\\(WARNING\\|ERROR\\|INFO\\)[^:]*: \\([^,]+\\),\\s-+\\(line \\)?\\([0-9]+\\):" 2 4 ) | ||
| 648 | (verilog-verbose | ||
| 649 | "\ | ||
| 650 | \\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\)\\([) \t]\\|\ | ||
| 651 | :\\([^0-9\n]\\|\\([0-9]+:\\)\\)\\)" 1 2 5) | ||
| 652 | (verilog-xsim | ||
| 653 | "\\(Error\\|Warning\\).*in file (\\([^ \t]+\\) at line *\\([0-9]+\\))" 2 3) | ||
| 654 | (verilog-vcs-1 | ||
| 655 | "\\(Error\\|Warning\\):[^(]*(\\([^ \t]+\\) line *\\([0-9]+\\))" 2 3) | ||
| 656 | (verilog-vcs-2 | ||
| 657 | "Warning:.*(port.*(\\([^ \t]+\\) line \\([0-9]+\\))" 1 2) | ||
| 658 | (verilog-vcs-3 | ||
| 659 | "\\(Error\\|Warning\\):[\n.]*\\([^ \t]+\\) *\\([0-9]+\\):" 2 3) | ||
| 660 | (verilog-vcs-4 | ||
| 661 | "syntax error:.*\n\\([^ \t]+\\) *\\([0-9]+\\):" 1 2) | ||
| 662 | (verilog-verilator | ||
| 663 | "%?\\(Error\\|Warning\\)\\(-[^:]+\\|\\):[\n ]*\\([^ \t:]+\\):\\([0-9]+\\):" 3 4) | ||
| 664 | (verilog-leda | ||
| 665 | "In file \\([^ \t]+\\)[ \t]+line[ \t]+\\([0-9]+\\): | ||
| 666 | .* | ||
| 667 | .* | ||
| 668 | .* | ||
| 669 | \\(Warning\\|Error\\|Failure\\)" 1 2) | ||
| 670 | )) | ||
| 671 | ;; And the version for XEmacs: | ||
| 672 | (defvar verilog-error-regexp-xemacs-alist | ||
| 673 | '(verilog | ||
| 674 | ("[^\n]*\\[\\([^:]+\\):\\([0-9]+\\)\\]" 1 2) | ||
| 675 | ("\\(WARNING\\|ERROR\\|INFO\\)[^:]*: \\([^,]+\\),\\s-+\\(line \\)?\\([0-9]+\\):" 2 4 ) | ||
| 676 | ("\ | ||
| 646 | \\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\)\\([) \t]\\|\ | 677 | \\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\)\\([) \t]\\|\ |
| 647 | :\\([^0-9\n]\\|\\([0-9]+:\\)\\)\\)" 1 2 5) | 678 | :\\([^0-9\n]\\|\\([0-9]+:\\)\\)\\)" 1 2 5) |
| 648 | ; xsim | 679 | ; xsim |
| 649 | ; Error! in file /homes/mac/Axis/Xsim/test.v at line 13 [OBJ_NOT_DECLARED] | 680 | ; Error! in file /homes/mac/Axis/Xsim/test.v at line 13 [OBJ_NOT_DECLARED] |
| 650 | ("\\(Error\\|Warning\\).*in file (\\([^ \t]+\\) at line *\\([0-9]+\\))" 2 3) | 681 | ("\\(Error\\|Warning\\).*in file (\\([^ \t]+\\) at line *\\([0-9]+\\))" 2 3) |
| 651 | ; vcs | 682 | ; vcs |
| 652 | ("\\(Error\\|Warning\\):[^(]*(\\([^ \t]+\\) line *\\([0-9]+\\))" 2 3) | 683 | ("\\(Error\\|Warning\\):[^(]*(\\([^ \t]+\\) line *\\([0-9]+\\))" 2 3) |
| 653 | ("Warning:.*(port.*(\\([^ \t]+\\) line \\([0-9]+\\))" 1 2) | 684 | ("Warning:.*(port.*(\\([^ \t]+\\) line \\([0-9]+\\))" 1 2) |
| 654 | ("\\(Error\\|Warning\\):[\n.]*\\([^ \t]+\\) *\\([0-9]+\\):" 2 3) | 685 | ("\\(Error\\|Warning\\):[\n.]*\\([^ \t]+\\) *\\([0-9]+\\):" 2 3) |
| 655 | ("syntax error:.*\n\\([^ \t]+\\) *\\([0-9]+\\):" 1 2) | 686 | ("syntax error:.*\n\\([^ \t]+\\) *\\([0-9]+\\):" 1 2) |
| 656 | ; Verilator | 687 | ; Verilator |
| 657 | ("%?\\(Error\\|Warning\\)\\(-[^:]+\\|\\):[\n ]*\\([^ \t:]+\\):\\([0-9]+\\):" 3 4) | 688 | ("%?\\(Error\\|Warning\\)\\(-[^:]+\\|\\):[\n ]*\\([^ \t:]+\\):\\([0-9]+\\):" 3 4) |
| 658 | ("%?\\(Error\\|Warning\\)\\(-[^:]+\\|\\):[\n ]*\\([^ \t:]+\\):\\([0-9]+\\):" 3 4) | ||
| 659 | ; verilog-xl | 689 | ; verilog-xl |
| 660 | ("\\(Error\\|Warning\\)!.*\n?.*\"\\([^\"]+\\)\", \\([0-9]+\\)" 2 3) | 690 | ("\\(Error\\|Warning\\)!.*\n?.*\"\\([^\"]+\\)\", \\([0-9]+\\)" 2 3) |
| 661 | ("([WE][0-9A-Z]+)[ \t]+\\([^ \t\n,]+\\)[, \t]+\\([0-9]+\\):.*$" 1 2) ; vxl | 691 | ("([WE][0-9A-Z]+)[ \t]+\\([^ \t\n,]+\\)[, \t]+\\([0-9]+\\):.*$" 1 2) ; vxl |
| 662 | ("([WE][0-9A-Z]+)[ \t]+\\([^ \t\n,]+\\)[, \t]+line[ \t]+\\([0-9]+\\):.*$" 1 2) | 692 | ("([WE][0-9A-Z]+)[ \t]+\\([^ \t\n,]+\\)[, \t]+line[ \t]+\\([0-9]+\\):.*$" 1 2) |
| 663 | ; nc-verilog | 693 | ; nc-verilog |
| 664 | (".*\\*[WE],[0-9A-Z]+ (\\([^ \t,]+\\),\\([0-9]+\\)|" 1 2) | 694 | (".*\\*[WE],[0-9A-Z]+ (\\([^ \t,]+\\),\\([0-9]+\\)|" 1 2) |
| 665 | ; Leda | 695 | ; Leda |
| 666 | ("In file \\([^ \t]+\\)[ \t]+line[ \t]+\\([0-9]+\\):\n[^\n]*\n[^\n]*\n\\[\\(Warning\\|Error\\|Failure\\)\\][^\n]*" 1 2) | 696 | ("In file \\([^ \t]+\\)[ \t]+line[ \t]+\\([0-9]+\\):\n[^\n]*\n[^\n]*\n\\[\\(Warning\\|Error\\|Failure\\)\\][^\n]*" 1 2) |
| 667 | )) | 697 | ) |
| 698 | ) | ||
| 668 | 699 | ||
| 669 | (defvar verilog-error-font-lock-keywords | 700 | (defvar verilog-error-font-lock-keywords |
| 670 | '( | 701 | '( |
| 671 | ("[^\n]*\\[\\([^:]+\\):\\([0-9]+\\)\\]" 1 bold t) | 702 | ("[^\n]*\\[\\([^:]+\\):\\([0-9]+\\)\\]" 1 bold t) |
| 672 | ("[^\n]*\\[\\([^:]+\\):\\([0-9]+\\)\\]" 2 bold t) | 703 | ("[^\n]*\\[\\([^:]+\\):\\([0-9]+\\)\\]" 2 bold t) |
| 673 | 704 | ||
| 674 | ("\\(WARNING\\|ERROR\\|INFO\\): \\([^,]+\\), line \\([0-9]+\\):" 2 bold t) | 705 | ("\\(WARNING\\|ERROR\\|INFO\\): \\([^,]+\\), line \\([0-9]+\\):" 2 bold t) |
| 675 | ("\\(WARNING\\|ERROR\\|INFO\\): \\([^,]+\\), line \\([0-9]+\\):" 3 bold t) | 706 | ("\\(WARNING\\|ERROR\\|INFO\\): \\([^,]+\\), line \\([0-9]+\\):" 3 bold t) |
| 676 | 707 | ||
| @@ -1424,46 +1455,49 @@ without the directory portion, will be substituted." | |||
| 1424 | t t compile-command)))) | 1455 | t t compile-command)))) |
| 1425 | 1456 | ||
| 1426 | ;; Following code only gets called from compilation-mode-hook on XEmacs to add error handling. | 1457 | ;; Following code only gets called from compilation-mode-hook on XEmacs to add error handling. |
| 1427 | ;; There is no way to add this on the fly to Emacs; instead we must update compile.el | 1458 | (defun verilog-error-regexp-add-xemacs () |
| 1428 | (if (featurep 'xemacs) | 1459 | "Teach XEmacs about verilog errors. |
| 1429 | (defun verilog-error-regexp-add-xemacs () | ||
| 1430 | "Teach XEmacs about verilog errors. | ||
| 1431 | Called by `compilation-mode-hook'. This allows \\[next-error] to | 1460 | Called by `compilation-mode-hook'. This allows \\[next-error] to |
| 1432 | find the errors." | 1461 | find the errors." |
| 1433 | (interactive) | 1462 | (interactive) |
| 1434 | (if 't ; (not verilog-error-regexp-add-didit) | 1463 | (if (boundp 'compilation-error-regexp-systems-alist) |
| 1435 | (progn | 1464 | (if (and |
| 1436 | (if (or (equal compilation-error-regexp-systems-list 'all) | 1465 | (not (equal compilation-error-regexp-systems-list 'all)) |
| 1437 | (not (member 'verilog compilation-error-regexp-systems-list))) | 1466 | (not (member compilation-error-regexp-systems-list 'verilog))) |
| 1438 | (setq compilation-error-regexp-systems-list | 1467 | (push 'verilog compilation-error-regexp-systems-list))) |
| 1439 | (if (listp compilation-error-regexp-systems-list) | 1468 | (if (boundp 'compilation-error-regexp-alist-alist) |
| 1440 | (nconc compilation-error-regexp-systems-list 'verilog) | 1469 | (if (not (assoc 'verilog compilation-error-regexp-alist-alist)) |
| 1441 | 'verilog))) | 1470 | (setcdr compilation-error-regexp-alist-alist |
| 1442 | (if (not (assoc 'verilog compilation-error-regexp-alist-alist)) | 1471 | (cons verilog-error-regexp-xemacs-alist |
| 1443 | (setcdr compilation-error-regexp-alist-alist | 1472 | (cdr compilation-error-regexp-alist-alist))))) |
| 1444 | (cons verilog-error-regexp-alist | 1473 | (if (boundp 'compilation-font-lock-keywords) |
| 1445 | (cdr compilation-error-regexp-alist-alist)))) | 1474 | (progn |
| 1446 | ;; Need to re-run compilation-error-regexp builder | 1475 | (make-variable-buffer-local 'compilation-font-lock-keywords) |
| 1447 | (compilation-build-compilation-error-regexp-alist)))) | 1476 | (setq compilation-font-lock-keywords verilog-error-font-lock-keywords) |
| 1477 | (font-lock-set-defaults))) | ||
| 1478 | ;; Need to re-run compilation-error-regexp builder | ||
| 1479 | (if (fboundp 'compilation-build-compilation-error-regexp-alist) | ||
| 1480 | (compilation-build-compilation-error-regexp-alist)) | ||
| 1448 | ) | 1481 | ) |
| 1482 | |||
| 1483 | ;; Following code only gets called from compilation-mode-hook on Emacs to add error handling. | ||
| 1449 | (defun verilog-error-regexp-add-emacs () | 1484 | (defun verilog-error-regexp-add-emacs () |
| 1450 | "Tell Emacs compile that we are Verilog. | 1485 | "Tell Emacs compile that we are Verilog. |
| 1451 | Called by `compilation-mode-hook'. This allows \\[next-error] to | 1486 | Called by `compilation-mode-hook'. This allows \\[next-error] to |
| 1452 | find the errors." | 1487 | find the errors." |
| 1453 | (interactive) | 1488 | (interactive) |
| 1454 | ;; Turned off because there seems no way to do this outside of compile.el | 1489 | (if (boundp 'compilation-error-regexp-alist-alist) |
| 1455 | ;; | 1490 | (progn |
| 1456 | ;; (if (or (equal compilation-error-regexp-alist 'all) | 1491 | (if (not (assoc 'verilog-xl-1 compilation-error-regexp-alist-alist)) |
| 1457 | ;; (not (member 'verilog compilation-error-regexp-alist))) | 1492 | (mapcar |
| 1458 | ;; (setq compilation-error-regexp-alist | 1493 | (lambda (item) |
| 1459 | ;; (if (listp compilation-error-regexp-alist) | 1494 | (push (car item) compilation-error-regexp-alist) |
| 1460 | ;; (append '(verilog) compilation-error-regexp-alist) | 1495 | (push item compilation-error-regexp-alist-alist) |
| 1461 | ;; '(verilog) ))) | 1496 | ) |
| 1462 | ) | 1497 | verilog-error-regexp-emacs-alist))))) |
| 1463 | 1498 | ||
| 1464 | (if (featurep 'xemacs) | 1499 | (if (featurep 'xemacs) (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-xemacs)) |
| 1465 | (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-xemacs) | 1500 | (if (featurep 'emacs) (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-emacs)) |
| 1466 | (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-emacs)) | ||
| 1467 | 1501 | ||
| 1468 | (defconst verilog-directive-re | 1502 | (defconst verilog-directive-re |
| 1469 | ;; "`case" "`default" "`define" "`define" "`else" "`endfor" "`endif" | 1503 | ;; "`case" "`default" "`define" "`define" "`else" "`endfor" "`endif" |