From 62fe7bdff1ac21ef71661c23a84a39a0b65d8a2e Mon Sep 17 00:00:00 2001 From: Vitor Antunes Date: Sun, 13 Oct 2024 19:40:12 +0100 Subject: [PATCH] Indent: Improve support for randcase * Include 'randcase' keyword in b:match_words * Drop s:vlog_block_start/end from indent/verilog_systemverilog.vim since they are no longer in use * Add simple indent test for randcase Fixes #245. --- ftplugin/verilog_systemverilog.vim | 2 +- indent/verilog_systemverilog.vim | 5 +---- test/indent.sv | 6 ++++++ test/indent.sv.html | 6 ++++++ test/indent_standalone.sv | 6 ++++++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ftplugin/verilog_systemverilog.vim b/ftplugin/verilog_systemverilog.vim index 976eddd..b82bca0 100755 --- a/ftplugin/verilog_systemverilog.vim +++ b/ftplugin/verilog_systemverilog.vim @@ -41,7 +41,7 @@ if exists("loaded_matchit") let b:match_ignorecase=0 let b:match_words= \ '\:\,' . - \ '\\|\\|\:\,' . + \ '\\|\\|\\|\:\,' . \ '`if\(n\)\?def\>:`elsif\>:`else\>:`endif\>,' . \ '\:\,' . \ '\:\,' . diff --git a/indent/verilog_systemverilog.vim b/indent/verilog_systemverilog.vim index 91fa051..4e8fd1f 100644 --- a/indent/verilog_systemverilog.vim +++ b/indent/verilog_systemverilog.vim @@ -32,9 +32,6 @@ let s:vlog_sens_list = '\(@\s*(.*)\)' let s:vlog_always = '\\s*' . s:vlog_sens_list . '\?' let s:vlog_method = '^\(\s*pure\s\+virtual\|\s*extern\)\@!.*\<\(function\|task\)\>\s\+\(\[.*\]\s*\)\?\w\+' -let s:vlog_block_start = '\<\(begin\|case\|^\s*fork\)\>\|{\|(' -let s:vlog_block_end = '\<\(end\|endcase\|join\(_all\|_none\)\?\)\>\|}\|)' - let s:vlog_module = '\<\(extern\s\+\)\@' let s:vlog_interface = '\(virtual\s\+\)\@\s*\(\\)\@!\w\+.*[^,]$' let s:vlog_package = '\' @@ -48,7 +45,7 @@ let s:vlog_clocking = g:verilog_syntax['clocking'][0]['match_start'] let s:vlog_preproc = '^\s*`ifn\?def\>' let s:vlog_define = '^\s*`define\>' -let s:vlog_case = '\\s*(' +let s:vlog_case = '\\s*(\|\' let s:vlog_join = '\' let s:vlog_block_decl = '\(\<\(while\|if\|foreach\|for\|repeat\)\>\s*(\)\|\<\(initial\|forever\|else\|do\)\>\|' . s:vlog_always diff --git a/test/indent.sv b/test/indent.sv index 4771e0c..612f329 100644 --- a/test/indent.sv +++ b/test/indent.sv @@ -526,6 +526,12 @@ case (Signal) endcase // End of copied code +randcase + 1: value <= 0; + 2: value <= 1; + 3: value <= 2; +endcase + interface class base; pure virtual function void a(input int unsigned N, ref t Data); diff --git a/test/indent.sv.html b/test/indent.sv.html index 3649870..bb9d295 100644 --- a/test/indent.sv.html +++ b/test/indent.sv.html @@ -528,6 +528,12 @@ endcase // End of copied code +randcase + 1: value <= 0; + 2: value <= 1; + 3: value <= 2; +endcase + interface class base; pure virtual function void a(input int unsigned N, ref t Data); diff --git a/test/indent_standalone.sv b/test/indent_standalone.sv index 8a8848c..f355f1a 100644 --- a/test/indent_standalone.sv +++ b/test/indent_standalone.sv @@ -526,6 +526,12 @@ case (Signal) endcase // End of copied code +randcase + 1: value <= 0; + 2: value <= 1; + 3: value <= 2; +endcase + interface class base; pure virtual function void a(input int unsigned N, ref t Data);