Unfortunately, the Emacs bracket matching framework does not understand many multi-valued tokens. The new SMIE library, added in Emacs-23.4, is partly designed to solve this problem. It allows the main modes to describe the syntax of the language (in a very limited form of grammar), after which things like CMf and CMb will know how to jump over logical elements, for example. skip from begin to its end match. As LindyDancer notes, such things are usually necessary for indentation, and in fact, the main motivation for SMIE was to provide a common indentation mechanism.
Verilog now does not use SMIE, but it implements similar navigation commands. So you could try something like
(defun sm-verilog-check-parens () (save-excursion (goto-char (point-min)) (while (not (eobp)) (verilog-forward-sexp))))
Tho I do not know if verilog-forward-sexp will give appropriate warnings / errors if it encounters at the end of the buffer at an unexpected moment.
Stefan
source share