Mercurial > emacs
comparison lisp/progmodes/verilog-mode.el @ 80355:35dfb85c0e6b
(verilog-easy-menu-filter): New function.
(verilog-stmt-menu, verilog-menu): Add :help.
(verilog-customize, verilog-font-customize)
(electric-verilog-backward-sexp, electric-verilog-forward-sexp)
(verilog-mode): Update documentation strings to match tool tips.
(verilog-auto-search-do, verilog-auto-re-search-do)
(verilog-skip-forward-comment-or-string): Fix verilog-auto
expansion when a .* appears inside a string.
(verilog-re-search-forward, verilog-re-search-backward): Add
comment to recall how this works.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Thu, 20 Mar 2008 06:15:05 +0000 |
parents | b7bed0a77336 |
children |
comparison
equal
deleted
inserted
replaced
80354:64fbdb238eb1 | 80355:35dfb85c0e6b |
---|---|
255 (eval-when-compile | 255 (eval-when-compile |
256 (defun verilog-regexp-words (a) | 256 (defun verilog-regexp-words (a) |
257 "Call 'regexp-opt' with word delimiters for the words A." | 257 "Call 'regexp-opt' with word delimiters for the words A." |
258 (concat "\\<" (verilog-regexp-opt a t) "\\>"))) | 258 (concat "\\<" (verilog-regexp-opt a t) "\\>"))) |
259 | 259 |
260 (defun verilog-easy-menu-filter (menu) | |
261 "Filter a easy-menu-define to support new features." | |
262 (cond ((not (featurep 'xemacs)) | |
263 menu) ;; GNU Emacs - passthru | |
264 ;; Xemacs doesn't support :help. Strip it. | |
265 ;; Recursively filter the a submenu | |
266 ((listp menu) | |
267 (mapcar 'verilog-easy-menu-filter menu)) | |
268 ;; Look for [:help "blah"] and remove | |
269 ((vectorp menu) | |
270 (let ((i 0) (out [])) | |
271 (while (< i (length menu)) | |
272 (if (equal `:help (aref menu i)) | |
273 (setq i (+ 2 i)) | |
274 (setq out (vconcat out (vector (aref menu i))) | |
275 i (1+ i)))) | |
276 out)) | |
277 (t menu))) ;; Default - ok | |
278 ;;(verilog-easy-menu-filter | |
279 ;; `("Verilog" ("MA" ["SAA" nil :help "Help SAA"] ["SAB" nil :help "Help SAA"]) | |
280 ;; "----" ["MB" nil :help "Help MB"])) | |
281 | |
260 (defun verilog-customize () | 282 (defun verilog-customize () |
261 "Link to customize screen for Verilog." | 283 "Customize variables and other settings used by Verilog-Mode." |
262 (interactive) | 284 (interactive) |
263 (customize-group 'verilog-mode)) | 285 (customize-group 'verilog-mode)) |
264 | 286 |
265 (defun verilog-font-customize () | 287 (defun verilog-font-customize () |
266 "Link to customize fonts used for Verilog." | 288 "Customize fonts used by Verilog-Mode." |
267 (interactive) | 289 (interactive) |
268 (if (fboundp 'customize-apropos) | 290 (if (fboundp 'customize-apropos) |
269 (customize-apropos "font-lock-*" 'faces))) | 291 (customize-apropos "font-lock-*" 'faces))) |
270 | 292 |
271 (defun verilog-booleanp (value) | 293 (defun verilog-booleanp (value) |
960 "Keymap used in Verilog mode.") | 982 "Keymap used in Verilog mode.") |
961 | 983 |
962 ;; menus | 984 ;; menus |
963 (easy-menu-define | 985 (easy-menu-define |
964 verilog-menu verilog-mode-map "Menu for Verilog mode" | 986 verilog-menu verilog-mode-map "Menu for Verilog mode" |
965 `("Verilog" | 987 '("Verilog" |
966 ("Choose Compilation Action" | 988 ("Choose Compilation Action" |
967 ["None" | 989 ["None" |
968 (progn | 990 (progn |
969 (setq verilog-tool nil) | 991 (setq verilog-tool nil) |
970 (verilog-set-compile-command)) | 992 (verilog-set-compile-command)) |
971 :style radio | 993 :style radio |
972 :selected (equal verilog-tool nil)] | 994 :selected (equal verilog-tool nil) |
973 ["Lint" | 995 :help "When invoking compilation, use compile-command"] |
974 (progn | 996 ["Lint" |
975 (setq verilog-tool 'verilog-linter) | 997 (progn |
976 (verilog-set-compile-command)) | 998 (setq verilog-tool 'verilog-linter) |
977 :style radio | 999 (verilog-set-compile-command)) |
978 :selected (equal verilog-tool `verilog-linter)] | 1000 :style radio |
979 ["Coverage" | 1001 :selected (equal verilog-tool `verilog-linter) |
980 (progn | 1002 :help "When invoking compilation, use lint checker"] |
981 (setq verilog-tool 'verilog-coverage) | 1003 ["Coverage" |
982 (verilog-set-compile-command)) | 1004 (progn |
983 :style radio | 1005 (setq verilog-tool 'verilog-coverage) |
984 :selected (equal verilog-tool `verilog-coverage)] | 1006 (verilog-set-compile-command)) |
985 ["Simulator" | 1007 :style radio |
986 (progn | 1008 :selected (equal verilog-tool `verilog-coverage) |
987 (setq verilog-tool 'verilog-simulator) | 1009 :help "When invoking compilation, annotate for coverage"] |
988 (verilog-set-compile-command)) | 1010 ["Simulator" |
989 :style radio | 1011 (progn |
990 :selected (equal verilog-tool `verilog-simulator)] | 1012 (setq verilog-tool 'verilog-simulator) |
991 ["Compiler" | 1013 (verilog-set-compile-command)) |
992 (progn | 1014 :style radio |
993 (setq verilog-tool 'verilog-compiler) | 1015 :selected (equal verilog-tool `verilog-simulator) |
994 (verilog-set-compile-command)) | 1016 :help "When invoking compilation, interpret Verilog source"] |
995 :style radio | 1017 ["Compiler" |
996 :selected (equal verilog-tool `verilog-compiler)] | 1018 (progn |
997 ) | 1019 (setq verilog-tool 'verilog-compiler) |
998 ("Move" | 1020 (verilog-set-compile-command)) |
999 ["Beginning of function" verilog-beg-of-defun | 1021 :style radio |
1000 :keys "C-M-a"] | 1022 :selected (equal verilog-tool `verilog-compiler) |
1001 ["End of function" verilog-end-of-defun | 1023 :help "When invoking compilation, compile Verilog source"] |
1002 :keys "C-M-e"] | 1024 ) |
1003 ["Mark function" verilog-mark-defun | 1025 ("Move" |
1004 :keys "C-M-h"] | 1026 ["Beginning of function" verilog-beg-of-defun |
1005 ["Goto function/module" verilog-goto-defun t] | 1027 :keys "C-M-a" |
1006 ["Move to beginning of block" electric-verilog-backward-sexp t] | 1028 :help "Move backward to the beginning of the current function or procedure"] |
1007 ["Move to end of block" electric-verilog-forward-sexp t] | 1029 ["End of function" verilog-end-of-defun |
1008 ) | 1030 :keys "C-M-e" |
1009 ("Comments" | 1031 :help "Move forward to the end of the current function or procedure"] |
1010 ["Comment Region" verilog-comment-region t] | 1032 ["Mark function" verilog-mark-defun |
1011 ["UnComment Region" verilog-uncomment-region t] | 1033 :keys "C-M-h" |
1012 ["Multi-line comment insert" verilog-star-comment t] | 1034 :help "Mark the current Verilog function or procedure"] |
1013 ["Lint error to comment" verilog-lint-off t] | 1035 ["Goto function/module" verilog-goto-defun |
1014 ) | 1036 :help "Move to specified Verilog module/task/function"] |
1015 "----" | 1037 ["Move to beginning of block" electric-verilog-backward-sexp |
1016 ["Compile" compile t] | 1038 :help "Move backward over one balanced expression"] |
1017 ["AUTO, Save, Compile" verilog-auto-save-compile t] | 1039 ["Move to end of block" electric-verilog-forward-sexp |
1018 ["Next Compile Error" next-error t] | 1040 :help "Move forward over one balanced expression"] |
1019 ["Ignore Lint Warning at point" verilog-lint-off t] | 1041 ) |
1020 "----" | 1042 ("Comments" |
1021 ["Line up declarations around point" verilog-pretty-declarations t] | 1043 ["Comment Region" verilog-comment-region |
1022 ["Line up equations around point" verilog-pretty-expr t] | 1044 :help "Put marked area into a comment"] |
1023 ["Redo/insert comments on every end" verilog-label-be t] | 1045 ["UnComment Region" verilog-uncomment-region |
1024 ["Expand [x:y] vector line" verilog-expand-vector t] | 1046 :help "Uncomment an area commented with Comment Region"] |
1025 ["Insert begin-end block" verilog-insert-block t] | 1047 ["Multi-line comment insert" verilog-star-comment |
1026 ["Complete word" verilog-complete-word t] | 1048 :help "Insert Verilog /* */ comment at point"] |
1027 "----" | 1049 ["Lint error to comment" verilog-lint-off |
1028 ["Recompute AUTOs" verilog-auto t] | 1050 :help "Convert a Verilog linter warning line into a disable statement"] |
1029 ["Kill AUTOs" verilog-delete-auto t] | 1051 ) |
1030 ["Inject AUTOs" verilog-inject-auto t] | 1052 "----" |
1031 ("AUTO Help..." | 1053 ["Compile" compile |
1032 ["AUTO General" (describe-function 'verilog-auto) t] | 1054 :help "Perform compilation-action (above) on the current buffer"] |
1033 ["AUTO Library Flags" (describe-variable 'verilog-library-flags) t] | 1055 ["AUTO, Save, Compile" verilog-auto-save-compile |
1034 ["AUTO Library Path" (describe-variable 'verilog-library-directories) t] | 1056 :help "Recompute AUTOs, save buffer, and compile"] |
1035 ["AUTO Library Files" (describe-variable 'verilog-library-files) t] | 1057 ["Next Compile Error" next-error |
1036 ["AUTO Library Extensions" (describe-variable 'verilog-library-extensions) t] | 1058 :help "Visit next compilation error message and corresponding source code"] |
1037 ["AUTO `define Reading" (describe-function 'verilog-read-defines) t] | 1059 ["Ignore Lint Warning at point" verilog-lint-off |
1038 ["AUTO `include Reading" (describe-function 'verilog-read-includes) t] | 1060 :help "Convert a Verilog linter warning line into a disable statement"] |
1039 ["AUTOARG" (describe-function 'verilog-auto-arg) t] | 1061 "----" |
1040 ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum) t] | 1062 ["Line up declarations around point" verilog-pretty-declarations |
1041 ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module) t] | 1063 :help "Line up declarations around point"] |
1042 ["AUTOINOUT" (describe-function 'verilog-auto-inout) t] | 1064 ["Line up equations around point" verilog-pretty-expr |
1043 ["AUTOINPUT" (describe-function 'verilog-auto-input) t] | 1065 :help "Line up expressions around point"] |
1044 ["AUTOINST" (describe-function 'verilog-auto-inst) t] | 1066 ["Redo/insert comments on every end" verilog-label-be |
1045 ["AUTOINST (.*)" (describe-function 'verilog-auto-star) t] | 1067 :help "Label matching begin ... end statements"] |
1046 ["AUTOINSTPARAM" (describe-function 'verilog-auto-inst-param) t] | 1068 ["Expand [x:y] vector line" verilog-expand-vector |
1047 ["AUTOOUTPUT" (describe-function 'verilog-auto-output) t] | 1069 :help "Take a signal vector on the current line and expand it to multiple lines"] |
1048 ["AUTOOUTPUTEVERY" (describe-function 'verilog-auto-output-every) t] | 1070 ["Insert begin-end block" verilog-insert-block |
1049 ["AUTOREG" (describe-function 'verilog-auto-reg) t] | 1071 :help "Insert begin ... end"] |
1050 ["AUTOREGINPUT" (describe-function 'verilog-auto-reg-input) t] | 1072 ["Complete word" verilog-complete-word |
1051 ["AUTORESET" (describe-function 'verilog-auto-reset) t] | 1073 :help "Complete word at point"] |
1052 ["AUTOSENSE" (describe-function 'verilog-auto-sense) t] | 1074 "----" |
1053 ["AUTOTIEOFF" (describe-function 'verilog-auto-tieoff) t] | 1075 ["Recompute AUTOs" verilog-auto |
1054 ["AUTOUNUSED" (describe-function 'verilog-auto-unused) t] | 1076 :help "Expand AUTO meta-comment statements"] |
1055 ["AUTOWIRE" (describe-function 'verilog-auto-wire) t] | 1077 ["Kill AUTOs" verilog-delete-auto |
1056 ) | 1078 :help "Remove AUTO expansions"] |
1057 "----" | 1079 ["Inject AUTOs" verilog-inject-auto |
1058 ["Submit bug report" verilog-submit-bug-report t] | 1080 :help "Inject AUTOs into legacy non-AUTO buffer"] |
1059 ["Version and FAQ" verilog-faq t] | 1081 ("AUTO Help..." |
1060 ["Customize Verilog Mode..." verilog-customize t] | 1082 ["AUTO General" (describe-function 'verilog-auto) |
1061 ["Customize Verilog Fonts & Colors" verilog-font-customize t])) | 1083 :help "Help introduction on AUTOs"] |
1084 ["AUTO Library Flags" (describe-variable 'verilog-library-flags) | |
1085 :help "Help on verilog-library-flags"] | |
1086 ["AUTO Library Path" (describe-variable 'verilog-library-directories) | |
1087 :help "Help on verilog-library-directories"] | |
1088 ["AUTO Library Files" (describe-variable 'verilog-library-files) | |
1089 :help "Help on verilog-library-files"] | |
1090 ["AUTO Library Extensions" (describe-variable 'verilog-library-extensions) | |
1091 :help "Help on verilog-library-extensions"] | |
1092 ["AUTO `define Reading" (describe-function 'verilog-read-defines) | |
1093 :help "Help on reading `defines"] | |
1094 ["AUTO `include Reading" (describe-function 'verilog-read-includes) | |
1095 :help "Help on parsing `includes"] | |
1096 ["AUTOARG" (describe-function 'verilog-auto-arg) | |
1097 :help "Help on AUTOARG - declaring module port list"] | |
1098 ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum) | |
1099 :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"] | |
1100 ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module) | |
1101 :help "Help on AUTOINOUTMODULE - copying i/o from another file"] | |
1102 ["AUTOINOUT" (describe-function 'verilog-auto-inout) | |
1103 :help "Help on AUTOINOUT - adding inouts from cells"] | |
1104 ["AUTOINPUT" (describe-function 'verilog-auto-input) | |
1105 :help "Help on AUTOINPUT - adding inputs from cells"] | |
1106 ["AUTOINST" (describe-function 'verilog-auto-inst) | |
1107 :help "Help on AUTOINST - adding pins for cells"] | |
1108 ["AUTOINST (.*)" (describe-function 'verilog-auto-star) | |
1109 :help "Help on expanding Verilog-2001 .* pins"] | |
1110 ["AUTOINSTPARAM" (describe-function 'verilog-auto-inst-param) | |
1111 :help "Help on AUTOINSTPARAM - adding parameter pins to cells"] | |
1112 ["AUTOOUTPUT" (describe-function 'verilog-auto-output) | |
1113 :help "Help on AUTOOUTPUT - adding outputs from cells"] | |
1114 ["AUTOOUTPUTEVERY" (describe-function 'verilog-auto-output-every) | |
1115 :help "Help on AUTOOUTPUTEVERY - adding outputs of all signals"] | |
1116 ["AUTOREG" (describe-function 'verilog-auto-reg) | |
1117 :help "Help on AUTOREG - declaring registers for non-wires"] | |
1118 ["AUTOREGINPUT" (describe-function 'verilog-auto-reg-input) | |
1119 :help "Help on AUTOREGINPUT - declaring inputs for non-wires"] | |
1120 ["AUTORESET" (describe-function 'verilog-auto-reset) | |
1121 :help "Help on AUTORESET - resetting always blocks"] | |
1122 ["AUTOSENSE" (describe-function 'verilog-auto-sense) | |
1123 :help "Help on AUTOSENSE - sensitivity lists for always blocks"] | |
1124 ["AUTOTIEOFF" (describe-function 'verilog-auto-tieoff) | |
1125 :help "Help on AUTOTIEOFF - tieing off unused outputs"] | |
1126 ["AUTOUNUSED" (describe-function 'verilog-auto-unused) | |
1127 :help "Help on AUTOUNUSED - terminating unused inputs"] | |
1128 ["AUTOWIRE" (describe-function 'verilog-auto-wire) | |
1129 :help "Help on AUTOWIRE - declaring wires for cells"] | |
1130 ) | |
1131 "----" | |
1132 ["Submit bug report" verilog-submit-bug-report | |
1133 :help "Submit via mail a bug report on verilog-mode.el"] | |
1134 ["Version and FAQ" verilog-faq | |
1135 :help "Show the current version, and where to get the FAQ etc"] | |
1136 ["Customize Verilog Mode..." verilog-customize | |
1137 :help "Customize variables and other settings used by Verilog-Mode"] | |
1138 ["Customize Verilog Fonts & Colors" verilog-font-customize | |
1139 :help "Customize fonts used by Verilog-Mode."])) | |
1062 | 1140 |
1063 (easy-menu-define | 1141 (easy-menu-define |
1064 verilog-stmt-menu verilog-mode-map "Menu for statement templates in Verilog." | 1142 verilog-stmt-menu verilog-mode-map "Menu for statement templates in Verilog." |
1065 '("Statements" | 1143 '("Statements" |
1066 ["Header" verilog-sk-header t] | 1144 ["Header" verilog-sk-header |
1067 ["Comment" verilog-sk-comment t] | 1145 :help "Insert a header block at the top of file"] |
1068 "----" | 1146 ["Comment" verilog-sk-comment |
1069 ["Module" verilog-sk-module t] | 1147 :help "Insert a comment block"] |
1070 ["Primitive" verilog-sk-primitive t] | 1148 "----" |
1071 "----" | 1149 ["Module" verilog-sk-module |
1072 ["Input" verilog-sk-input t] | 1150 :help "Insert a module .. (/*AUTOARG*/);.. endmodule block"] |
1073 ["Output" verilog-sk-output t] | 1151 ["Primitive" verilog-sk-primitive |
1074 ["Inout" verilog-sk-inout t] | 1152 :help "Insert a primitive .. (.. );.. endprimitive block"] |
1075 ["Wire" verilog-sk-wire t] | 1153 "----" |
1076 ["Reg" verilog-sk-reg t] | 1154 ["Input" verilog-sk-input |
1077 ["Define thing under point as a register" verilog-sk-define-signal t] | 1155 :help "Insert an input declaration"] |
1078 "----" | 1156 ["Output" verilog-sk-output |
1079 ["Initial" verilog-sk-initial t] | 1157 :help "Insert an output declaration"] |
1080 ["Always" verilog-sk-always t] | 1158 ["Inout" verilog-sk-inout |
1081 ["Function" verilog-sk-function t] | 1159 :help "Insert an inout declaration"] |
1082 ["Task" verilog-sk-task t] | 1160 ["Wire" verilog-sk-wire |
1083 ["Specify" verilog-sk-specify t] | 1161 :help "Insert a wire declaration"] |
1084 ["Generate" verilog-sk-generate t] | 1162 ["Reg" verilog-sk-reg |
1085 "----" | 1163 :help "Insert a register declaration"] |
1086 ["Begin" verilog-sk-begin t] | 1164 ["Define thing under point as a register" verilog-sk-define-signal |
1087 ["If" verilog-sk-if t] | 1165 :help "Define signal under point as a register at the top of the module"] |
1088 ["(if) else" verilog-sk-else-if t] | 1166 "----" |
1089 ["For" verilog-sk-for t] | 1167 ["Initial" verilog-sk-initial |
1090 ["While" verilog-sk-while t] | 1168 :help "Insert an initial begin .. end block"] |
1091 ["Fork" verilog-sk-fork t] | 1169 ["Always" verilog-sk-always |
1092 ["Repeat" verilog-sk-repeat t] | 1170 :help "Insert an always @(AS) begin .. end block"] |
1093 ["Case" verilog-sk-case t] | 1171 ["Function" verilog-sk-function |
1094 ["Casex" verilog-sk-casex t] | 1172 :help "Insert a function .. begin .. end endfunction block"] |
1095 ["Casez" verilog-sk-casez t])) | 1173 ["Task" verilog-sk-task |
1174 :help "Insert a task .. begin .. end endtask block"] | |
1175 ["Specify" verilog-sk-specify | |
1176 :help "Insert a specify .. endspecify block"] | |
1177 ["Generate" verilog-sk-generate | |
1178 :help "Insert a generate .. endgenerate block"] | |
1179 "----" | |
1180 ["Begin" verilog-sk-begin | |
1181 :help "Insert a begin .. end block"] | |
1182 ["If" verilog-sk-if | |
1183 :help "Insert an if (..) begin .. end block"] | |
1184 ["(if) else" verilog-sk-else-if | |
1185 :help "Insert an else if (..) begin .. end block"] | |
1186 ["For" verilog-sk-for | |
1187 :help "Insert a for (...) begin .. end block"] | |
1188 ["While" verilog-sk-while | |
1189 :help "Insert a while (...) begin .. end block"] | |
1190 ["Fork" verilog-sk-fork | |
1191 :help "Insert a fork begin .. end .. join block"] | |
1192 ["Repeat" verilog-sk-repeat | |
1193 :help "Insert a repeat (..) begin .. end block"] | |
1194 ["Case" verilog-sk-case | |
1195 :help "Insert a case block, prompting for details"] | |
1196 ["Casex" verilog-sk-casex | |
1197 :help "Insert a casex (...) item: begin.. end endcase block"] | |
1198 ["Casez" verilog-sk-casez | |
1199 :help "Insert a casez (...) item: begin.. end endcase block"])) | |
1096 | 1200 |
1097 (defvar verilog-mode-abbrev-table nil | 1201 (defvar verilog-mode-abbrev-table nil |
1098 "Abbrev table in use in Verilog-mode buffers.") | 1202 "Abbrev table in use in Verilog-mode buffers.") |
1099 | 1203 |
1100 (define-abbrev-table 'verilog-mode-abbrev-table ()) | 1204 (define-abbrev-table 'verilog-mode-abbrev-table ()) |
1123 string)) | 1227 string)) |
1124 | 1228 |
1125 (defsubst verilog-re-search-forward (REGEXP BOUND NOERROR) | 1229 (defsubst verilog-re-search-forward (REGEXP BOUND NOERROR) |
1126 ; checkdoc-params: (REGEXP BOUND NOERROR) | 1230 ; checkdoc-params: (REGEXP BOUND NOERROR) |
1127 "Like `re-search-forward', but skips over match in comments or strings." | 1231 "Like `re-search-forward', but skips over match in comments or strings." |
1128 (store-match-data '(nil nil)) | 1232 (store-match-data '(nil nil)) ;; So match-end will return nil if no matches found |
1129 (while (and | 1233 (while (and |
1130 (re-search-forward REGEXP BOUND NOERROR) | 1234 (re-search-forward REGEXP BOUND NOERROR) |
1131 (and (verilog-skip-forward-comment-or-string) | 1235 (and (verilog-skip-forward-comment-or-string) |
1132 (progn | 1236 (progn |
1133 (store-match-data '(nil nil)) | 1237 (store-match-data '(nil nil)) |
1137 (match-end 0)) | 1241 (match-end 0)) |
1138 | 1242 |
1139 (defsubst verilog-re-search-backward (REGEXP BOUND NOERROR) | 1243 (defsubst verilog-re-search-backward (REGEXP BOUND NOERROR) |
1140 ; checkdoc-params: (REGEXP BOUND NOERROR) | 1244 ; checkdoc-params: (REGEXP BOUND NOERROR) |
1141 "Like `re-search-backward', but skips over match in comments or strings." | 1245 "Like `re-search-backward', but skips over match in comments or strings." |
1142 (store-match-data '(nil nil)) | 1246 (store-match-data '(nil nil)) ;; So match-end will return nil if no matches found |
1143 (while (and | 1247 (while (and |
1144 (re-search-backward REGEXP BOUND NOERROR) | 1248 (re-search-backward REGEXP BOUND NOERROR) |
1145 (and (verilog-skip-backward-comment-or-string) | 1249 (and (verilog-skip-backward-comment-or-string) |
1146 (progn | 1250 (progn |
1147 (store-match-data '(nil nil)) | 1251 (store-match-data '(nil nil)) |
2002 buffer-file-name | 2106 buffer-file-name |
2003 (buffer-name)) | 2107 (buffer-name)) |
2004 ":" (int-to-string (count-lines (point-min) (or pointnum (point)))))) | 2108 ":" (int-to-string (count-lines (point-min) (or pointnum (point)))))) |
2005 | 2109 |
2006 (defun electric-verilog-backward-sexp () | 2110 (defun electric-verilog-backward-sexp () |
2007 "Move backward over a sexp." | 2111 "Move backward over one balanced expression." |
2008 (interactive) | 2112 (interactive) |
2009 ;; before that see if we are in a comment | 2113 ;; before that see if we are in a comment |
2010 (verilog-backward-sexp)) | 2114 (verilog-backward-sexp)) |
2011 | 2115 |
2012 (defun electric-verilog-forward-sexp () | 2116 (defun electric-verilog-forward-sexp () |
2013 "Move forward over a sexp." | 2117 "Move forward over one balanced expression." |
2014 (interactive) | 2118 (interactive) |
2015 ;; before that see if we are in a comment | 2119 ;; before that see if we are in a comment |
2016 (verilog-forward-sexp)) | 2120 (verilog-forward-sexp)) |
2017 | 2121 |
2018 ;;;used by hs-minor-mode | 2122 ;;;used by hs-minor-mode |
2306 \\[verilog-end-of-defun] Move to end of current function. | 2410 \\[verilog-end-of-defun] Move to end of current function. |
2307 \\[verilog-label-be] Label matching begin ... end, fork ... join, etc statements. | 2411 \\[verilog-label-be] Label matching begin ... end, fork ... join, etc statements. |
2308 | 2412 |
2309 \\[verilog-comment-region] Put marked area in a comment. | 2413 \\[verilog-comment-region] Put marked area in a comment. |
2310 \\[verilog-uncomment-region] Uncomment an area commented with \\[verilog-comment-region]. | 2414 \\[verilog-uncomment-region] Uncomment an area commented with \\[verilog-comment-region]. |
2311 \\[verilog-insert-block] Insert begin ... end;. | 2415 \\[verilog-insert-block] Insert begin ... end. |
2312 \\[verilog-star-comment] Insert /* ... */. | 2416 \\[verilog-star-comment] Insert /* ... */. |
2313 | 2417 |
2314 \\[verilog-sk-always] Insert a always @(AS) begin .. end block. | 2418 \\[verilog-sk-always] Insert an always @(AS) begin .. end block. |
2315 \\[verilog-sk-begin] Insert a begin .. end block. | 2419 \\[verilog-sk-begin] Insert a begin .. end block. |
2316 \\[verilog-sk-case] Insert a case block, prompting for details. | 2420 \\[verilog-sk-case] Insert a case block, prompting for details. |
2317 \\[verilog-sk-for] Insert a for (...) begin .. end block, prompting for details. | 2421 \\[verilog-sk-for] Insert a for (...) begin .. end block, prompting for details. |
2318 \\[verilog-sk-generate] Insert a generate .. endgenerate block. | 2422 \\[verilog-sk-generate] Insert a generate .. endgenerate block. |
2319 \\[verilog-sk-header] Insert a nice header block at the top of file. | 2423 \\[verilog-sk-header] Insert a header block at the top of file. |
2320 \\[verilog-sk-initial] Insert an initial begin .. end block. | 2424 \\[verilog-sk-initial] Insert an initial begin .. end block. |
2321 \\[verilog-sk-fork] Insert a fork begin .. end .. join block. | 2425 \\[verilog-sk-fork] Insert a fork begin .. end .. join block. |
2322 \\[verilog-sk-module] Insert a module .. (/*AUTOARG*/);.. endmodule block. | 2426 \\[verilog-sk-module] Insert a module .. (/*AUTOARG*/);.. endmodule block. |
2323 \\[verilog-sk-primitive] Insert a primitive .. (.. );.. endprimitive block. | 2427 \\[verilog-sk-primitive] Insert a primitive .. (.. );.. endprimitive block. |
2324 \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block. | 2428 \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block. |
4422 (let ((state | 4526 (let ((state |
4423 (save-excursion | 4527 (save-excursion |
4424 (parse-partial-sexp (point-min) (point))))) | 4528 (parse-partial-sexp (point-min) (point))))) |
4425 (cond | 4529 (cond |
4426 ((nth 3 state) ;Inside string | 4530 ((nth 3 state) ;Inside string |
4427 (goto-char (nth 3 state)) | 4531 (search-forward "\"") |
4428 t) | 4532 t) |
4429 ((nth 7 state) ;Inside // comment | 4533 ((nth 7 state) ;Inside // comment |
4430 (forward-line 1) | 4534 (forward-line 1) |
4431 t) | 4535 t) |
4432 ((nth 4 state) ;Inside any comment (hence /**/) | 4536 ((nth 4 state) ;Inside any comment (hence /**/) |
6278 (let ((end-mod-point (verilog-get-end-of-defun t)) | 6382 (let ((end-mod-point (verilog-get-end-of-defun t)) |
6279 st-point end-inst-point | 6383 st-point end-inst-point |
6280 ;; below 3 modified by verilog-read-sub-decls-line | 6384 ;; below 3 modified by verilog-read-sub-decls-line |
6281 sigs-out sigs-inout sigs-in) | 6385 sigs-out sigs-inout sigs-in) |
6282 (verilog-beg-of-defun) | 6386 (verilog-beg-of-defun) |
6283 (while (re-search-forward "\\(/\\*AUTOINST\\*/\\|\\.\\*\\)" end-mod-point t) | 6387 (while (verilog-re-search-forward "\\(/\\*AUTOINST\\*/\\|\\.\\*\\)" end-mod-point t) |
6284 (save-excursion | 6388 (save-excursion |
6285 (goto-char (match-beginning 0)) | 6389 (goto-char (match-beginning 0)) |
6286 (unless (verilog-inside-comment-p) | 6390 (unless (verilog-inside-comment-p) |
6287 ;; Attempt to snarf a comment | 6391 ;; Attempt to snarf a comment |
6288 (let* ((submod (verilog-read-inst-module)) | 6392 (let* ((submod (verilog-read-inst-module)) |
7295 | 7399 |
7296 ;; | 7400 ;; |
7297 ;; Auto creation utilities | 7401 ;; Auto creation utilities |
7298 ;; | 7402 ;; |
7299 | 7403 |
7404 (defun verilog-auto-re-search-do (search-for func) | |
7405 "Search for the given auto text regexp SEARCH-FOR, and perform FUNC where it occurs." | |
7406 (goto-char (point-min)) | |
7407 (while (verilog-re-search-forward search-for nil t) | |
7408 (funcall func))) | |
7409 | |
7300 (defun verilog-auto-search-do (search-for func) | 7410 (defun verilog-auto-search-do (search-for func) |
7301 "Search for the given auto text SEARCH-FOR, and perform FUNC where it occurs." | 7411 "Search for the given auto text SEARCH-FOR, and perform FUNC where it occurs." |
7302 (goto-char (point-min)) | 7412 (verilog-auto-re-search-do (regexp-quote search-for) func)) |
7303 (while (search-forward search-for nil t) | |
7304 (if (not (save-excursion | |
7305 (goto-char (match-beginning 0)) | |
7306 (verilog-inside-comment-p))) | |
7307 (funcall func)))) | |
7308 | |
7309 (defun verilog-auto-re-search-do (search-for func) | |
7310 "Search for the given auto text SEARCH-FOR, and perform FUNC where it occurs." | |
7311 (goto-char (point-min)) | |
7312 (while (re-search-forward search-for nil t) | |
7313 (if (not (save-excursion | |
7314 (goto-char (match-beginning 0)) | |
7315 (verilog-inside-comment-p))) | |
7316 (funcall func)))) | |
7317 | 7413 |
7318 (defun verilog-insert-one-definition (sig type indent-pt) | 7414 (defun verilog-insert-one-definition (sig type indent-pt) |
7319 "Print out a definition for SIG of the given TYPE, | 7415 "Print out a definition for SIG of the given TYPE, |
7320 with appropriate INDENT-PT indentation." | 7416 with appropriate INDENT-PT indentation." |
7321 (indent-to indent-pt) | 7417 (indent-to indent-pt) |