unposted: internal: ztst.vim: Make sure syntax elements are only hidden if they're followed by something visible

This commit is contained in:
Daniel Shahaf 2020-03-19 20:27:37 +00:00
parent b13e8d16cf
commit 65f8e90f0d
2 changed files with 22 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2020-03-20 Daniel Shahaf <d.s@daniel.shahaf.name>
* unposted: Util/ztst-syntax.vim: internal: ztst.vim: Make
sure syntax elements are only hidden if they're followed by
something visible
2020-03-18 Daniel Shahaf <d.s@daniel.shahaf.name>
* unposted: .editorconfig: Specify tabs for Makefiles.

View file

@ -35,25 +35,25 @@ syn match ztstPayload /^\s.*/ contains=@zsh
syn match ztstExitCode /^\d\+\|^-/ nextgroup=ztstFlags
syn match ztstFlags /[.dDqf]*:/ contained nextgroup=ztstTestName contains=ztstColon
syn match ztstColon /:/ contained
syn match ztstColon /:.\@=/ contained
syn region ztstTestName start=// end=/$/ contained
syn match ztstInputMarker /^</ nextgroup=ztstInput
syn match ztstInputMarker /^<.\@=/ nextgroup=ztstInput
syn region ztstInput start=// end=/$/ contained
syn match ztstOutputPattern /^[*]>/ nextgroup=ztstOutput contains=ztstOutputPatternSigil,ztstOutputPatternMarker
syn match ztstOutputPatternSigil /[*]/ contained
syn match ztstOutputPatternMarker /[>]/ contained conceal
syn match ztstOutputLiteral /^>/ nextgroup=ztstOutput
syn match ztstOutputPatternMarker /[>].\@=/ contained conceal
syn match ztstOutputLiteral /^>.\@=/ nextgroup=ztstOutput
syn region ztstOutput start=// end=/$/ contained
syn match ztstErrputPattern /^[*][?]/ nextgroup=ztstErrput contains=ztstErrputPatternSigil,ztstErrputPatternMarker
syn match ztstErrputPatternSigil /[*]/ contained
syn match ztstErrputPatternMarker /[?]/ contained conceal
syn match ztstErrputLiteral /^[?]/ nextgroup=ztstErrput
syn match ztstErrputPatternMarker /[?].\@=/ contained conceal
syn match ztstErrputLiteral /^[?].\@=/ nextgroup=ztstErrput
syn region ztstErrput start=// end=/$/ contained
syn match ztstFrequentExplanationMarker /^F:/ nextgroup=ztstFrequentExplanation
syn match ztstFrequentExplanationMarker /^F:.\@=/ nextgroup=ztstFrequentExplanation
syn region ztstFrequentExplanation start=// end=/$/ contained
syn match ztstDirective /^%.*/
@ -75,6 +75,15 @@ syn keyword ztstSpecialVariable ZTST_unimplemented ZTST_skip ZTST_testdir ZTST_f
syn sync maxlines=1
"" Highlight groups:
" Note: every group that's defaulted to "Ignore" has a match pattern that ends
" with /.\@=/. This ensures the Ignore will only be effective if there is an
" immediately following group that _will_ be highlighted. (That group will be
" one of ztstTestName, ztstInput, ztstOutput, and ztstErrput.)
"
" ### The Ignore would still apply if the rest of the line is all-whitespace.
" ###
" ### If you run into such lines, consider setting the 'list' and 'listchars'
" ### options appropriately.
hi def link ztstExitCode Number
hi def link ztstFlags Normal
hi def link ztstColon Ignore