I've tried looking at a syntax file which might be using the feature: pascal.vim, because pascal, as I've learned, has nested comment sections. Unfortunately, the highlighting for the comment section is wrong when there's nesting in the comments.
Example hello_world.pas:
program HelloWorld(output);
begin
Write('Hello, World!')
{No ";" is required after the last statement of a block -
{ nested comment }
adding one adds a "null statement" to the program, which is ignored by the compiler.}
end.
This compiles and runs, but the comment section with nesting is highlighted wrong, even here on the StackOverflow.
I found the relevant line in the syntax file:
syn region pascalComment start="(\*\|{" end="\*)\|}" contains=pascalTodo,pascalSpaceError
and just naively added ,pascalComment
to the contains
attribute` and it did make vim highlight the comment region correctly.
help syntax
, probably especially regions and containedcontains=pascalTodo,pascalSpaceError,pascalComment
does make it work, I was invoking it wrong. Thanks for the help, D. Ben Knoble!