veripool / verilog-mode

Verilog-Mode for Emacs with Indentation, Hightlighting and AUTOs. Master repository for pushing to GNU, verilog.com and veripool.org.
http://veripool.org/verilog-mode
GNU General Public License v3.0
247 stars 90 forks source link

Fix bug in forward-sexp and backward-sexp for some constructs #1765

Closed gmlarumbe closed 2 years ago

gmlarumbe commented 2 years ago

In the following snippet, running verilog-forward-sexp while the point is at generate/covergroup/property/sequence keywords will move the point to the end of the file instead of to its corresponding enclosing keyword:

module foo

    generate
        // ...
    endgenerate

    covergroup
        // ...
    endgroup

    property
        // ...
    endproperty

    sequence
        // ...
    endsequence

endmodule

In addition, running verilog-forward-sexp or verilog-backward-sexp while over package/endpackage and program/endprogram does not work as expected either. verilog-forward-sexp moves the point to the end of the file while verilog-backward-sexp does not have any effect:

package
    // ...
endpackage

program
    // ...
endprogram

It seems it could be due to a bug in the capture groups numbering of verilog-forward-sexp and missing clauses in verilog-leap-to-head and verilog-backward-sexp.

This pull request seems to fix this issue with GNU Emacs 27.1

acr4 commented 2 years ago

Is the second commit (fix tests) related to the first or is it just cleaning up a regression introduced previously? If the former, please squash these into a single commit. If the latter, can you identify when the test files broke and reference that in the commit message (so we have a linkage between the events).

gmlarumbe commented 2 years ago

I squashed them into a single commit.

First commit made these three regression tests fail because of these blanks after endpackage in the golden references.

wsnyder commented 2 years ago

Thanks for fixing this and accepting the feedback.