File tree Expand file tree Collapse file tree 5 files changed +63
-1
lines changed
Expand file tree Collapse file tree 5 files changed +63
-1
lines changed Original file line number Diff line number Diff line change @@ -612,6 +612,10 @@ <h3>
612612 Errorlist: Fix reset escape sequence to set style SCE_ERR_DEFAULT (0) instead of SCE_ERR_ES_BLACK.
613613 < a href ="https://github.com/ScintillaOrg/lexilla/issues/333 "> Issue #333</ a > .
614614 </ li >
615+ < li >
616+ Makefile: Recognize comments in more situations.
617+ < a href ="https://github.com/ScintillaOrg/lexilla/issues/40 "> Issue #40</ a > .
618+ </ li >
615619 </ ul >
616620 < h3 >
617621 < a href ="https://www.scintilla.org/lexilla546.zip "> Release 5.4.6</ a >
Original file line number Diff line number Diff line change @@ -167,8 +167,13 @@ void LexerMakeFile::ColouriseMakeLine(
167167 }
168168 }
169169 int varCount = 0 ;
170+ char previous = 0 ;
170171 while (i < lengthLine) {
171- if (lineBuffer.substr (i, 2 ) == " $(" ) {
172+ if (lineBuffer[i] == ' #' && !bCommand && (varCount == 0 ) && (previous != ' \\ ' )) {
173+ styler.ColourTo (startLine + i - 1 , state);
174+ styler.ColourTo (endPos, SCE_MAKE_COMMENT);
175+ return ;
176+ } else if (lineBuffer.substr (i, 2 ) == " $(" ) {
172177 styler.ColourTo (startLine + i - 1 , state);
173178 state = SCE_MAKE_IDENTIFIER;
174179 varCount++;
@@ -200,6 +205,7 @@ void LexerMakeFile::ColouriseMakeLine(
200205 if (!isspacechar (lineBuffer[i])) {
201206 lastNonSpace = i;
202207 }
208+ previous = lineBuffer[i];
203209 i++;
204210 }
205211 if (state == SCE_MAKE_IDENTIFIER) {
Original file line number Diff line number Diff line change 1+ # Comment
2+
3+ test = 5 # Comment
4+
5+ $(info $(test)) # Comment
6+
7+ clean : # Comment
8+ echo # Not comment
9+
10+ # Quoting a #
11+ HASH = \#
12+
13+ # Inside variable reference
14+ OUT = $(#SYM )
15+
16+ # Inside function call
17+ X = $(subst /,#,$1)
Original file line number Diff line number Diff line change 1+ 0 400 0 # Comment
2+ 0 400 0
3+ 0 400 0 test = 5 # Comment
4+ 0 400 0
5+ 0 400 0 $(info $(test)) # Comment
6+ 0 400 0
7+ 0 400 0 clean: # Comment
8+ 0 400 0 echo # Not comment
9+ 0 400 0
10+ 0 400 0 # Quoting a #
11+ 0 400 0 HASH = \#
12+ 0 400 0
13+ 0 400 0 # Inside variable reference
14+ 0 400 0 OUT = $(#SYM)
15+ 0 400 0
16+ 0 400 0 # Inside function call
17+ 0 400 0 X = $(subst /,#,$1)
18+ 0 400 0
Original file line number Diff line number Diff line change 1+ {1}# Comment
2+ {0}
3+ {3}test{0} {4}={0} 5 {1}# Comment
4+ {0}
5+ {3}$(info $(test)){0} {1}# Comment
6+ {0}
7+ {5}clean{4}:{0} {1}# Comment
8+ {0} echo # Not comment
9+
10+ {1}# Quoting a #
11+ {3}HASH{0} {4}={0} \#
12+
13+ {1}# Inside variable reference
14+ {3}OUT{0} {4}={0} {3}$(#SYM){0}
15+
16+ {1}# Inside function call
17+ {3}X{0} {4}={0} {3}$(subst /,#,$1){0}
You can’t perform that action at this time.
0 commit comments