Skip to content

Commit 90b5c83

Browse files
authored
Handle else if statement in makefile (rouge-ruby#2063)
1 parent c5e4a8a commit 90b5c83

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/rouge/lexers/make.rb

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def initialize(opts={})
4040
groups Keyword, Text, Name::Variable
4141
end
4242

43+
rule %r/(else\b)([\t ]+)((?:ifn?def|ifn?eq)\b)([\t ]+)([^#\n]+)/ do
44+
groups Keyword, Text, Keyword, Text, Name::Variable
45+
end
46+
4347
rule %r/(?:else|endif|endef|endfor)[\t ]*(?=[#\n])/, Keyword
4448

4549
rule %r/(export)([\t ]+)(?=[\w\${}()\t -]+\n)/ do

spec/visual/samples/make

+8
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ else
9292
THING2 = default
9393
endif
9494

95+
ifeq ($(OS), Linux)
96+
MES = "Hi, Linux"
97+
else ifeq ($(OS), Darwin)
98+
MES = "Hi, Mac"
99+
else
100+
MES = "Unknown"
101+
endif
102+
95103
ifeq ($(TARGET),special) # syntax variant: parentheses and separating comma
96104
TARGET = something_else
97105
else

0 commit comments

Comments
 (0)