Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indent: Improve end-of-statement regexp to ignore increment/decrement #233

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion indent/verilog_systemverilog.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ setlocal indentkeys+==endgenerate,=endchecker,=endconfig,=endprimitive,=endtable
setlocal indentkeys+==`else,=`endif
setlocal indentkeys+=;

let s:vlog_open_statement = '\([<>:!=?&|^%/*+]\|-[^>]\)'
let s:vlog_open_statement = '\([<>:!=?&|^%/*]\|+\%([;+]\)\@!\|-\%([>;-]\)\@!\)'
let s:vlog_end_statement = ')\s*;'
let s:vlog_comment = '\(//.*\|/\*.*\*/\)'
let s:vlog_macro = '`\k\+\((.*)\)\?\s*$'
Expand Down
5 changes: 5 additions & 0 deletions test/indent.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class z;

int unsigned cnt=0;

// Code from: // https://github.com/vhda/verilog_systemverilog.vim/issues/232
foo--;
bar();
// End of copied code

function new();
super.new();
endfunction;
Expand Down
5 changes: 5 additions & 0 deletions test/indent.sv.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

<span class="Statement">int</span> <span class="Statement">unsigned</span> cnt<span class="Special">=</span><span class="Constant">0</span><span class="Special">;</span>

<span class="Comment">// Code from: // <a href="https://github.com/vhda/verilog_systemverilog.vim/issues/232">https://github.com/vhda/verilog_systemverilog.vim/issues/232</a></span>
foo<span class="Special">--;</span>
<span class="Identifier">bar</span><span class="Special">();</span>
<span class="Comment">// End of copied code</span>

<span class="Statement">function</span> <span class="Identifier">new</span><span class="Special">();</span>
<span class="Type">super</span><span class="Special">.</span><span class="Identifier">new</span><span class="Special">();</span>
<span class="Statement">endfunction</span><span class="Special">;</span>
Expand Down
5 changes: 5 additions & 0 deletions test/indent_standalone.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class z;

int unsigned cnt=0;

// Code from: // https://github.com/vhda/verilog_systemverilog.vim/issues/232
foo--;
bar();
// End of copied code

function new();
super.new();
endfunction;
Expand Down
Loading