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
257 stars 90 forks source link

Incorrect indentation when using nested curly brackets #1719

Closed leventyakay closed 3 years ago

leventyakay commented 3 years ago

When double curly brackets are used to do bit replication and/or concatenation, indentation breaks starting with next line. Example:

always_ff @(posedge clk or negedge rst_n)
  if (~rst_n)
    begin
    a <= {(5){1'b0}};
  // auto-indentation fails
  a <= 1;
  end

always_ff @(posedge clk or negedge rst_n)
  if (~rst_n)
    begin
    a <= {5{1'b0}};
    // auto-indentation works
    a <= 1;
    end

always_ff @(posedge clk or negedge rst_n)
  if (~rst_n)
    begin
    a <= {{1'b0,1'b0}};
  // auto-indentation fails
  a <= 1;
  end
wsnyder commented 3 years ago

Somewhat surprising, but confirmed. Note indentation bugs are in mostly in only-fixed-by-contribution mode, so if you could look into a pull request to fix this, it would be appreciated.

acr4 commented 3 years ago

I can also confirm this issue still exists. I tried to clean up some of the {{ and }} quirks years ago, and never managed to quite beat it into submission. That code is ... squirrely.

On Thu, Mar 25, 2021 at 9:35 PM Wilson Snyder @.***> wrote:

Somewhat surprising, but confirmed. Note indentation bugs are in mostly in only-fixed-by-contribution mode, so if you could look into a pull request to fix this, it would be appreciated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/veripool/verilog-mode/issues/1719#issuecomment-807865146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMKS2JOA2ZGNHAB2WAJAGDTFPQFZANCNFSM4Z2CLY4A .

leventyakay commented 3 years ago

Unfortunately I am no expert in lisp. When I have some spare time, I'll see if I can do a fix. I didn't use github before though.

wsnyder commented 3 years ago

@punzik, appreciate your fix for this!