Skip to content

Commit 74e533b

Browse files
authored
Merge pull request vhda#233 from vhda/indent/eos_increment_decrement
Indent: Improve end-of-statement regexp to ignore increment/decrement
2 parents b47a3c0 + e42291a commit 74e533b

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

indent/verilog_systemverilog.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ setlocal indentkeys+==endgenerate,=endchecker,=endconfig,=endprimitive,=endtable
2323
setlocal indentkeys+==`else,=`endif
2424
setlocal indentkeys+=;
2525

26-
let s:vlog_open_statement = '\([<>:!=?&|^%/*+]\|-[^>]\)'
26+
let s:vlog_open_statement = '\([<>:!=?&|^%/*]\|+\%([;+]\)\@!\|-\%([>;-]\)\@!\)'
2727
let s:vlog_end_statement = ')\s*;'
2828
let s:vlog_comment = '\(//.*\|/\*.*\*/\)'
2929
let s:vlog_macro = '`\k\+\((.*)\)\?\s*$'

test/indent.sv

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class z;
2626

2727
int unsigned cnt=0;
2828

29+
// Code from: // https://github.com/vhda/verilog_systemverilog.vim/issues/232
30+
foo--;
31+
bar();
32+
// End of copied code
33+
2934
function new();
3035
super.new();
3136
endfunction;

test/indent.sv.html

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828

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

31+
<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>
32+
foo<span class="Special">--;</span>
33+
<span class="Identifier">bar</span><span class="Special">();</span>
34+
<span class="Comment">// End of copied code</span>
35+
3136
<span class="Statement">function</span> <span class="Identifier">new</span><span class="Special">();</span>
3237
<span class="Type">super</span><span class="Special">.</span><span class="Identifier">new</span><span class="Special">();</span>
3338
<span class="Statement">endfunction</span><span class="Special">;</span>

test/indent_standalone.sv

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class z;
2626

2727
int unsigned cnt=0;
2828

29+
// Code from: // https://github.com/vhda/verilog_systemverilog.vim/issues/232
30+
foo--;
31+
bar();
32+
// End of copied code
33+
2934
function new();
3035
super.new();
3136
endfunction;

0 commit comments

Comments
 (0)