aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-02-21 05:15:31 +0000
committerDan Nicolaescu2008-02-21 05:15:31 +0000
commit2a9eb3f5f867a87b1c2c1495715fa44e9f5b601b (patch)
treef0f9425349ed749b5df32438967ce7d5cdafd2f4
parentf8016ed60d08279edcbe91f9642a7d40bae89b28 (diff)
downloademacs-2a9eb3f5f867a87b1c2c1495715fa44e9f5b601b.tar.gz
emacs-2a9eb3f5f867a87b1c2c1495715fa44e9f5b601b.zip
* progmodes/verilog-mode.el (verilog-xemacs-menu): Remove XEmacs
conditional. (verilog-font-grouping-keywords-face): Make the begin..end keywords standout more than other verilog keywords. (verilog-type-font-keywords): Move the begin..end out of this list to facilitate making them to (potentially) stand out more. (verilog-backward-token): Fix indent of bare always{_*}?, initial, function & task blocks. (verilog-behavioral-block-beg-re): Fix indent of bare always{_*}?, initial, function & task blocks. (verilog-forward-sexp): Handle the new "disable fork" statement of IEEE-1800 Verilog. (verilog-beg-block-re-ordered): Handle the new "disable fork" statement of IEEE-1800 Verilog. (verilog-calc-1): Handle the new "disable fork" statement of IEEE-1800 Verilog. (verilog-disable-fork-re): Add const to help handle the new "disable fork" statement of IEEE-1800 Verilog. (verilog-declaration-core-re): Add port directions by themselves, with no qualification, as base item of a declaration. (verilog-pretty-declarations): Add new flag to ask it to refrain from printing to the message buffer. (verilog-pretty-expr): Add a QUIET flag to ask it to refrain from printing to the message buffer. Improve handling of the many types of expression line up. (verilog-just-one-space): Remove printing of an empty message. (verilog-get-lineup-indent): Rework to support the better handling of expression lineup for verilog-pretty-expr. (verilog-auto-wire): Pass the quiet flag to verilog-pretty-expr.
-rw-r--r--lisp/ChangeLog32
-rw-r--r--lisp/progmodes/verilog-mode.el134
2 files changed, 120 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 48194daec3d..2c5f0299b1c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,35 @@
12008-02-21 Michael McNamara <mac@mail.brushroad.com>
2
3 * progmodes/verilog-mode.el (verilog-xemacs-menu): Remove XEmacs
4 conditional.
5 (verilog-font-grouping-keywords-face): Make the begin..end
6 keywords standout more than other verilog keywords.
7 (verilog-type-font-keywords): Move the begin..end out of this list
8 to facilitate making them to (potentially) stand out more.
9 (verilog-backward-token): Fix indent of bare always{_*}?, initial,
10 function & task blocks.
11 (verilog-behavioral-block-beg-re): Fix indent of bare always{_*}?,
12 initial, function & task blocks.
13 (verilog-forward-sexp): Handle the new "disable fork" statement of
14 IEEE-1800 Verilog.
15 (verilog-beg-block-re-ordered): Handle the new "disable fork"
16 statement of IEEE-1800 Verilog.
17 (verilog-calc-1): Handle the new "disable fork" statement of
18 IEEE-1800 Verilog.
19 (verilog-disable-fork-re): Add const to help handle the new
20 "disable fork" statement of IEEE-1800 Verilog.
21 (verilog-declaration-core-re): Add port directions by themselves,
22 with no qualification, as base item of a declaration.
23 (verilog-pretty-declarations): Add new flag to ask it to refrain
24 from printing to the message buffer.
25 (verilog-pretty-expr): Add a QUIET flag to ask it to refrain from
26 printing to the message buffer. Improve handling of the many
27 types of expression line up.
28 (verilog-just-one-space): Remove printing of an empty message.
29 (verilog-get-lineup-indent): Rework to support the better handling
30 of expression lineup for verilog-pretty-expr.
31 (verilog-auto-wire): Pass the quiet flag to verilog-pretty-expr.
32
12008-02-20 Alan Mackenzie <acm@muc.de> 332008-02-20 Alan Mackenzie <acm@muc.de>
2 34
3 * progmodes/cc-mode.el (c-extend-region-for-CPP): Bug fix from 35 * progmodes/cc-mode.el (c-extend-region-for-CPP): Bug fix from
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 4e2b726625f..3d40e4ecfa2 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -115,9 +115,9 @@
115;;; Code: 115;;; Code:
116 116
117;; This variable will always hold the version number of the mode 117;; This variable will always hold the version number of the mode
118(defconst verilog-mode-version "389" 118(defconst verilog-mode-version "399"
119 "Version of this Verilog mode.") 119 "Version of this Verilog mode.")
120(defconst verilog-mode-release-date "2008-02-01-GNU" 120(defconst verilog-mode-release-date "2008-02-19-GNU"
121 "Release date of this Verilog mode.") 121 "Release date of this Verilog mode.")
122(defconst verilog-mode-release-emacs t 122(defconst verilog-mode-release-emacs t
123 "If non-nil, this version of Verilog mode was released with Emacs itself.") 123 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -992,15 +992,9 @@ If set will become buffer local.")
992 :selected (equal verilog-tool `verilog-compiler)] 992 :selected (equal verilog-tool `verilog-compiler)]
993 ) 993 )
994 ("Move" 994 ("Move"
995 ,(if (featurep 'xemacs) 995 ["Beginning of function" verilog-beg-of-defun t]
996 (progn 996 ["End of function" verilog-end-of-defun t]
997 ["Beginning of function" verilog-beg-of-defun t] 997 ["Mark function" verilog-mark-defun t]
998 ["End of function" verilog-end-of-defun t]
999 ["Mark function" verilog-mark-defun t])
1000 ["Beginning of function" beginning-of-defun t]
1001 ["End of function" end-of-defun t]
1002 ["Mark function" mark-defun t])
1003
1004 ["Goto function/module" verilog-goto-defun t] 998 ["Goto function/module" verilog-goto-defun t]
1005 ["Move to beginning of block" electric-verilog-backward-sexp t] 999 ["Move to beginning of block" electric-verilog-backward-sexp t]
1006 ["Move to end of block" electric-verilog-forward-sexp t] 1000 ["Move to end of block" electric-verilog-forward-sexp t]
@@ -1451,19 +1445,18 @@ find the errors."
1451(defconst verilog-beg-block-re-ordered 1445(defconst verilog-beg-block-re-ordered
1452 ( concat "\\<" 1446 ( concat "\\<"
1453 "\\(begin\\)" ;1 1447 "\\(begin\\)" ;1
1454 "\\|\\(randcase\\|\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?\\)" ; 2 1448 "\\|\\(randcase\\|\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?\\)" ; 2,3
1455;; "\\|\\(randcase\\|case[xz]?\\)" ; 2 1449 "\\|\\(\\(disable\\s-+\\)?fork\\)" ;4
1456 "\\|\\(fork\\)" ;3 1450 "\\|\\(class\\)" ;5
1457 "\\|\\(class\\)" ;4 1451 "\\|\\(table\\)" ;6
1458 "\\|\\(table\\)" ;5 1452 "\\|\\(specify\\)" ;7
1459 "\\|\\(specify\\)" ;6 1453 "\\|\\(function\\)" ;8
1460 "\\|\\(function\\)" ;7 1454 "\\|\\(task\\)" ;9
1461 "\\|\\(task\\)" ;8 1455 "\\|\\(generate\\)" ;10
1462 "\\|\\(generate\\)" ;9 1456 "\\|\\(covergroup\\)" ;11
1463 "\\|\\(covergroup\\)" ;10 1457 "\\|\\(property\\)" ;12
1464 "\\|\\(property\\)" ;11 1458 "\\|\\(\\(rand\\)?sequence\\)" ;13
1465 "\\|\\(\\(rand\\)?sequence\\)" ;12 1459 "\\|\\(clocking\\)" ;14
1466 "\\|\\(clocking\\)" ;13
1467 "\\>")) 1460 "\\>"))
1468 1461
1469(defconst verilog-end-block-ordered-rry 1462(defconst verilog-end-block-ordered-rry
@@ -1574,8 +1567,8 @@ find the errors."
1574 (concat verilog-defun-re "\\|" verilog-end-defun-re)) 1567 (concat verilog-defun-re "\\|" verilog-end-defun-re))
1575 1568
1576(defconst verilog-behavioral-block-beg-re 1569(defconst verilog-behavioral-block-beg-re
1577 (concat "\\(\\<initial\\>\\|\\<final\\>\\|\\<always\\>\\|\\<always_comb\\>\\|\\<always_ff\\>\\|" 1570 (eval-when-compile (verilog-regexp-words `("initial" "final" "always" "always_comb" "always_latch" "always_ff"
1578 "\\<always_latch\\>\\|\\<function\\>\\|\\<task\\>\\)")) 1571 "function" "task"))))
1579 1572
1580(defconst verilog-indent-re 1573(defconst verilog-indent-re
1581 (eval-when-compile 1574 (eval-when-compile
@@ -1640,6 +1633,7 @@ find the errors."
1640 `( 1633 `(
1641 "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass" 1634 "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass"
1642 )))) 1635 ))))
1636(defconst verilog-disable-fork-re "disable\\s-+fork")
1643(defconst verilog-extended-case-re "\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?") 1637(defconst verilog-extended-case-re "\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?")
1644(defconst verilog-extended-complete-re 1638(defconst verilog-extended-complete-re
1645 (concat "\\(\\<extern\\s-+\\|\\<virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)" 1639 (concat "\\(\\<extern\\s-+\\|\\<virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)"
@@ -1815,6 +1809,20 @@ See also `verilog-font-lock-extra-types'.")
1815 "Font lock mode face used to highlight AMS keywords." 1809 "Font lock mode face used to highlight AMS keywords."
1816 :group 'font-lock-highlighting-faces) 1810 :group 'font-lock-highlighting-faces)
1817 1811
1812(defvar verilog-font-grouping-keywords-face
1813 'verilog-font-lock-grouping-keywords-face
1814 "Font to use for Verilog Grouping Keywords (such as begin..end).")
1815(defface verilog-font-lock-grouping-keywords-face
1816 '((((class color)
1817 (background light))
1818 (:foreground "red4" :bold t ))
1819 (((class color)
1820 (background dark))
1821 (:foreground "red4" :bold t ))
1822 (t (:italic t)))
1823 "Font lock mode face used to highlight verilog grouping keywords."
1824 :group 'font-lock-highlighting-faces)
1825
1818(let* ((verilog-type-font-keywords 1826(let* ((verilog-type-font-keywords
1819 (eval-when-compile 1827 (eval-when-compile
1820 (verilog-regexp-opt 1828 (verilog-regexp-opt
@@ -1879,8 +1887,8 @@ See also `verilog-font-lock-extra-types'.")
1879 (eval-when-compile 1887 (eval-when-compile
1880 (verilog-regexp-opt 1888 (verilog-regexp-opt
1881 '( 1889 '(
1882 "assign" "begin" "case" "casex" "casez" "randcase" "deassign" 1890 "assign" "case" "casex" "casez" "randcase" "deassign"
1883 "default" "disable" "else" "end" "endcase" "endfunction" 1891 "default" "disable" "else" "endcase" "endfunction"
1884 "endgenerate" "endinterface" "endmodule" "endprimitive" 1892 "endgenerate" "endinterface" "endmodule" "endprimitive"
1885 "endspecify" "endtable" "endtask" "final" "for" "force" "return" "break" 1893 "endspecify" "endtable" "endtask" "final" "for" "force" "return" "break"
1886 "continue" "forever" "fork" "function" "generate" "if" "iff" "initial" 1894 "continue" "forever" "fork" "function" "generate" "if" "iff" "initial"
@@ -1889,7 +1897,12 @@ See also `verilog-font-lock-extra-types'.")
1889 "always_latch" "posedge" "primitive" "priority" "release" 1897 "always_latch" "posedge" "primitive" "priority" "release"
1890 "repeat" "specify" "table" "task" "unique" "wait" "while" 1898 "repeat" "specify" "table" "task" "unique" "wait" "while"
1891 "class" "program" "endclass" "endprogram" 1899 "class" "program" "endclass" "endprogram"
1892 ) nil )))) 1900 ) nil )))
1901
1902 (verilog-font-grouping-keywords
1903 (eval-when-compile
1904 (verilog-regexp-opt
1905 '( "begin" "end" ) nil ))))
1893 1906
1894 (setq verilog-font-lock-keywords 1907 (setq verilog-font-lock-keywords
1895 (list 1908 (list
@@ -1899,7 +1912,9 @@ See also `verilog-font-lock-extra-types'.")
1899 "\\$[a-zA-Z][a-zA-Z0-9_\\$]*" 1912 "\\$[a-zA-Z][a-zA-Z0-9_\\$]*"
1900 "\\)\\>") 1913 "\\)\\>")
1901 ;; Fontify all types 1914 ;; Fontify all types
1902 (cons (concat "\\<\\(" verilog-type-font-keywords "\\)\\>") 1915 (cons (concat "\\(\\<" verilog-font-grouping-keywords "\\)\\>")
1916 'verilog-font-lock-ams-face)
1917 (cons (concat "\\<\\(" verilog-type-font-keywords "\\)\\>")
1903 'font-lock-type-face) 1918 'font-lock-type-face)
1904 ;; Fontify IEEE-P1800 keywords appropriately 1919 ;; Fontify IEEE-P1800 keywords appropriately
1905 (if verilog-highlight-p1800-keywords 1920 (if verilog-highlight-p1800-keywords
@@ -2066,49 +2081,64 @@ Use filename, if current buffer being edited shorten to just buffer name."
2066 (cond 2081 (cond
2067 ((verilog-skip-forward-comment-or-string) 2082 ((verilog-skip-forward-comment-or-string)
2068 (verilog-forward-syntactic-ws)) 2083 (verilog-forward-syntactic-ws))
2069 ((looking-at verilog-beg-block-re-ordered);; begin|case|fork|class|table|specify|function|task|generate|covergroup|property|sequence|clocking 2084 ((looking-at verilog-beg-block-re-ordered) ;; begin|(case)|xx|(fork)|class|table|specify|function|task|generate|covergroup|property|sequence|clocking
2070 (cond 2085 (cond
2071 ((match-end 1) ; end 2086 ((match-end 1) ; end
2072 ;; Search forward for matching begin 2087 ;; Search forward for matching begin
2073 (setq reg "\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)" )) 2088 (setq reg "\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)" ))
2074 ((match-end 2) ; endcase 2089 ((match-end 2) ; endcase
2075 ;; Search forward for matching case 2090 ;; Search forward for matching case
2076 (setq reg "\\(\\<randcase\\>\\|\\(\\<unique\\>\\s-+\\|\\<priority\\>\\s-+\\)?\\<case[xz]?\\>[^:]\\)\\|\\(\\<endcase\\>\\)" )) 2091 (setq reg "\\(\\<randcase\\>\\|\\(\\<unique\\>\\s-+\\|\\<priority\\>\\s-+\\)?\\<case[xz]?\\>[^:]\\)\\|\\(\\<endcase\\>\\)" )
2077 ((match-end 3) ; join 2092 (setq md 3) ;; ender is third item in regexp
2078 ;; Search forward for matching fork 2093 )
2079 (setq reg "\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" )) 2094 ((match-end 4) ; join
2080 ((match-end 4) ; endclass 2095 ;; might be "disable fork"
2096 (if (or
2097 (looking-at verilog-disable-fork-re)
2098 (and (looking-at "fork")
2099 (progn
2100 (forward-word -1)
2101 (looking-at verilog-disable-fork-re))))
2102 (progn
2103 (goto-char (match-end 0))
2104 (forward-word)
2105 (setq reg nil))
2106 (progn
2107 ;; Search forward for matching fork
2108 (setq reg "\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" ))))
2109 ((match-end 5) ; endclass
2081 ;; Search forward for matching class 2110 ;; Search forward for matching class
2082 (setq reg "\\(\\<class\\>\\)\\|\\(\\<endclass\\>\\)" )) 2111 (setq reg "\\(\\<class\\>\\)\\|\\(\\<endclass\\>\\)" ))
2083 ((match-end 5) ; endtable 2112 ((match-end 6) ; endtable
2084 ;; Search forward for matching table 2113 ;; Search forward for matching table
2085 (setq reg "\\(\\<table\\>\\)\\|\\(\\<endtable\\>\\)" )) 2114 (setq reg "\\(\\<table\\>\\)\\|\\(\\<endtable\\>\\)" ))
2086 ((match-end 6) ; endspecify 2115 ((match-end 7) ; endspecify
2087 ;; Search forward for matching specify 2116 ;; Search forward for matching specify
2088 (setq reg "\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" )) 2117 (setq reg "\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" ))
2089 ((match-end 7) ; endfunction 2118 ((match-end 8) ; endfunction
2090 ;; Search forward for matching function 2119 ;; Search forward for matching function
2091 (setq reg "\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" )) 2120 (setq reg "\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" ))
2092 ((match-end 8) ; endtask 2121 ((match-end 9) ; endtask
2093 ;; Search forward for matching task 2122 ;; Search forward for matching task
2094 (setq reg "\\(\\<task\\>\\)\\|\\(\\<endtask\\>\\)" )) 2123 (setq reg "\\(\\<task\\>\\)\\|\\(\\<endtask\\>\\)" ))
2095 ((match-end 9) ; endgenerate 2124 ((match-end 10) ; endgenerate
2096 ;; Search forward for matching generate 2125 ;; Search forward for matching generate
2097 (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" )) 2126 (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" ))
2098 ((match-end 10) ; endgroup 2127 ((match-end 11) ; endgroup
2099 ;; Search forward for matching covergroup 2128 ;; Search forward for matching covergroup
2100 (setq reg "\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" )) 2129 (setq reg "\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" ))
2101 ((match-end 11) ; endproperty 2130 ((match-end 12) ; endproperty
2102 ;; Search forward for matching property 2131 ;; Search forward for matching property
2103 (setq reg "\\(\\<property\\>\\)\\|\\(\\<endproperty\\>\\)" )) 2132 (setq reg "\\(\\<property\\>\\)\\|\\(\\<endproperty\\>\\)" ))
2104 ((match-end 12) ; endsequence 2133 ((match-end 13) ; endsequence
2105 ;; Search forward for matching sequence 2134 ;; Search forward for matching sequence
2106 (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" ) 2135 (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" )
2107 (setq md 3)) ; 3 to get to endsequence in the reg above 2136 (setq md 3)) ; 3 to get to endsequence in the reg above
2108 ((match-end 13) ; endclocking 2137 ((match-end 14) ; endclocking
2109 ;; Search forward for matching clocking 2138 ;; Search forward for matching clocking
2110 (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" ))) 2139 (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" )))
2111 (if (forward-word 1) 2140 (if (and reg
2141 (forward-word 1))
2112 (catch 'skip 2142 (catch 'skip
2113 (let ((nest 1)) 2143 (let ((nest 1))
2114 (while (verilog-re-search-forward reg nil 'move) 2144 (while (verilog-re-search-forward reg nil 'move)
@@ -3934,6 +3964,16 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
3934 (throw 'nesting 'case) 3964 (throw 'nesting 'case)
3935 (goto-char here))) 3965 (goto-char here)))
3936 (throw 'nesting 'case)) 3966 (throw 'nesting 'case))
3967
3968 ((match-end 4) ; *sigh* could be "disable fork"
3969 (let ((here (point)))
3970 (verilog-beg-of-statement)
3971 (if (looking-at verilog-disable-fork-re)
3972 t ; is disable fork, this is a normal statement
3973 (progn ; or is fork, starts a new block
3974 (goto-char here)
3975 (throw 'nesting 'block)))))
3976
3937 3977
3938 ;; need to consider typedef struct here... 3978 ;; need to consider typedef struct here...
3939 ((looking-at "\\<class\\|struct\\|function\\|task\\|property\\>") 3979 ((looking-at "\\<class\\|struct\\|function\\|task\\|property\\>")
@@ -4169,6 +4209,8 @@ Set point to where line starts."
4169 (cond 4209 (cond
4170 ((looking-at "\\<else\\>") 4210 ((looking-at "\\<else\\>")
4171 t) 4211 t)
4212 ((looking-at verilog-behavioral-block-beg-re)
4213 t)
4172 ((looking-at verilog-indent-re) 4214 ((looking-at verilog-indent-re)
4173 nil) 4215 nil)
4174 (t 4216 (t