Skip to content

Commit 519dc39

Browse files
3V3RYONEchrisbra
authored andcommitted
runtime(make): Makefile highlighting breaks with ')' in string
Problem: Makefile syntax highlighting incorrectly ends function calls when encountering ')' inside double or single quoted strings, causing incorrect highlighting for the remainder of the line. Solution: Add makeDString and makeSString to the contains list for makeIdent regions. This allows strings to be recognized inside variable references and function calls. fixes: #18687 closes: #18818 Signed-off-by: Beleswar Prasad Padhi <beleswarprasad@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent aded554 commit 519dc39

3 files changed

Lines changed: 23 additions & 15 deletions

File tree

runtime/syntax/make.vim

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
" 2025 Oct 12 by Vim project: update makeDefine highlighting (#18403)
99
" 2025 Oct 25 by Vim project: update makeTargetinDefine highlighting (#18570)
1010
" 2025 Dec 23 by Vim project: fix too greedy match (#18938)
11+
" 2025 Dec 23 by Vim project: wrong highlight with paranthesis inside quotes (#18818)
1112

1213
" quit when a syntax file was already loaded
1314
if exists("b:current_syntax")
@@ -42,15 +43,15 @@ syn match makeIdent "\$\$\$\$\w*" containedin=makeDefine
4243
syn match makeIdent "\$[^({]"
4344
syn match makeIdent "\$\$[^({]" containedin=makeDefine
4445
if get(b:, 'make_flavor', s:make_flavor) == 'microsoft'
45-
syn region makeIdent start="\$(" end=")" contains=makeStatement,makeIdent
46-
syn region makeIdent start="\${" end="}" contains=makeStatement,makeIdent
47-
syn region makeIdent start="\$\$(" end=")" containedin=makeDefine contains=makeStatement,makeIdent
48-
syn region makeIdent start="\$\${" end="}" containedin=makeDefine contains=makeStatement,makeIdent
46+
syn region makeIdent start="\$(" end=")" contains=makeStatement,makeIdent,makeDString,makeSString
47+
syn region makeIdent start="\${" end="}" contains=makeStatement,makeIdent,makeDString,makeSString
48+
syn region makeIdent start="\$\$(" end=")" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
49+
syn region makeIdent start="\$\${" end="}" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
4950
else
50-
syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent
51-
syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent
52-
syn region makeIdent start="\$\$(" skip="\\)\|\\\\" end=")" containedin=makeDefine contains=makeStatement,makeIdent
53-
syn region makeIdent start="\$\${" skip="\\}\|\\\\" end="}" containedin=makeDefine contains=makeStatement,makeIdent
51+
syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent,makeDString,makeSString
52+
syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent,makeDString,makeSString
53+
syn region makeIdent start="\$\$(" skip="\\)\|\\\\" end=")" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
54+
syn region makeIdent start="\$\${" skip="\\}\|\\\\" end="}" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
5455
endif
5556
syn match makeIdent "^ *[^:#= \t]*\s*[:+?!*]="me=e-2
5657
syn match makeIdent "^ *[^:#= \t]*\s*::="me=e-3

runtime/syntax/testdir/dumps/make_01_00.dump

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
| +0#e000e06&@7|@|e+0#e000002&|c|h|o| |d|o|u|b|l|e|-|c|o|l|o|n| |r|u|l|e| +0#0000000&@43
88
@75
99
|$+0#00e0e07&|(|a|)| |++0#0000000&|=| |o|u|t|p|u|t| @60
10+
@75
11+
|d+0#e000e06&|e|f|i|n|e| |s|a|y| +0#0000000&@64
12+
| +0#e000e06&@7|e|c|h|o| |$+0#00e0e07&|1| +0#0000000&@59
13+
|e+0#e000e06&|n|d|e|f| +0#0000000&@69
14+
@75
15+
|d+0#00e0e07&|e|f|a|u|l|t|:| +0#0000000&@66
16+
| +0#e000002&@7|$+0#00e0e07&|(|c+0#af5f00255&|a|l@1| +0#00e0e07&|s|a|y|,|"+0#e000002&|H|e|l@1|o| |(|w|o|r|l|d|)|!|"|)+0#00e0e07&| +0#0000000&@38
1017
|~+0#4040ff13&| @73
1118
|~| @73
1219
|~| @73
13-
|~| @73
14-
|~| @73
15-
|~| @73
16-
|~| @73
17-
|~| @73
18-
|~| @73
19-
|~| @73
2020
| +0#0000000&@56|1|,|1| @10|A|l@1|

runtime/syntax/testdir/input/make_01.mak

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ $(a)::
77
@echo double-colon rule
88

99
$(a) += output
10+
11+
define say
12+
echo $1
13+
endef
14+
15+
default:
16+
$(call say,"Hello (world)!")

0 commit comments

Comments
 (0)