vim-patch:ddb88ab: runtime(haskell): allow spaces in backticked operators in syntax script

This formatting (although rare) is actually accepted by GHC, but vim
does not highlight it. This patch adds the simplest possible regex to
support the behavior.

Inconveniently, this might trigger weird formatting on lines that
contain errors, e.g. if the first backtick is removed from:

    a `b` c `d` e

then `c` is going to be marked as an operator, which seems weird but is
valid.

closes: vim/vim#18776

ddb88ab796

Co-authored-by: Mirek Kratochvil <exa.exa@gmail.com>
This commit is contained in:
zeertzjq
2025-11-21 08:49:57 +08:00
parent 2fa8825bef
commit cafd5cfca7

View File

@@ -2,6 +2,7 @@
" Language: Haskell " Language: Haskell
" Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org> " Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org>
" Last Change: 2024 Mar 28 by Enrico Maria De Angelis <enricomaria.dean6elis@gmail.com> " Last Change: 2024 Mar 28 by Enrico Maria De Angelis <enricomaria.dean6elis@gmail.com>
" 2025 Nov 20 by Vim Project: Allow spaces in backticks #18776
" Original Author: John Williams <jrw@pobox.com> " Original Author: John Williams <jrw@pobox.com>
" "
" Thanks to Ryan Crumley for suggestions and John Meacham for " Thanks to Ryan Crumley for suggestions and John Meacham for
@@ -46,8 +47,8 @@ syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[a-z][a-zA-Z0-9_']*\>" contains=@
" others are variables (e.g. functions). " others are variables (e.g. functions).
syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*" syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*"
syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*" syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"
syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`" syn match hsVarSym "` *\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']* *`"
syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`" syn match hsConSym "` *\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']* *`"
" (Non-qualified) identifiers which start with # are labels " (Non-qualified) identifiers which start with # are labels
syn match hsLabel "#[a-z][a-zA-Z0-9_']*\>" syn match hsLabel "#[a-z][a-zA-Z0-9_']*\>"