Skip to content

Commit

Permalink
Handle else if statement in makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
tancnle committed Aug 23, 2024
1 parent 04887af commit 8182de1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rouge/lexers/make.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def initialize(opts={})
groups Keyword, Text, Name::Variable
end

rule %r/(else\b)([\t ]+)((?:ifn?def|ifn?eq)\b)([\t ]+)([^#\n]+)/ do
groups Keyword, Text, Keyword, Text, Name::Variable
end

rule %r/(?:else|endif|endef|endfor)[\t ]*(?=[#\n])/, Keyword

rule %r/(export)([\t ]+)(?=[\w\${}()\t -]+\n)/ do
Expand Down
9 changes: 9 additions & 0 deletions spec/visual/samples/make
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,12 @@ export variable := value
export variable += value
export variable
unexport variable

# handle
ifeq ($(OS), Linux)
MES = "Hi, Linux"
else ifeq ($(OS), Darwin)
MES = "Hi, Mac"
else
MES = "Unknown"
endif

0 comments on commit 8182de1

Please sign in to comment.