Ifdef/elsif/else/endif Verilog 预处理关键字的语法折叠

Syntax folding of Ifdef/elsif/else/endif Verilog preprocessing keywords

Verilog 支持以下预处理关键字结构:

`ifdef A
  `ifdef B
  `else
  `endif
`elsif C
`endif

我正在寻找一个语法定义,它允许嵌套折叠此结构的各个元素,但允许在其中突出显示透明语法 (contains=ALL)。以下是所需折叠的示例。

我已经尝试了在之前关于 Whosebug 的问题中找到的等效 #ifdef,#elsif,#endif 示例的示例,但在他们的 implementation/porting.

中没有成功

折叠嵌套关键字:

`ifdef A
--  X lines: `ifdef B---------
--  X lines: `else------------
`elsif C
`endif

折叠顶级`ifdef

--  X lines: `ifdef A---------
`elsif C
`endif

折叠顶层`elsif

`ifdef A
  `ifdef B
  `else
  `endif
--  X lines: `elsif C---------

看看Syntax folding of Vim scripts;它为 Vimscript 提供了这样的语法定义。如果您对 Vim 的语法高亮有点熟悉,您应该能够使其适应 Verilog 语法。