Skip to content

Commit

Permalink
Merge branch 'rouge-ruby:master' into feat.bicepLexer
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviermignot authored Apr 11, 2023
2 parents 450356d + b274a10 commit de97ef7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/rouge/lexers/javascript.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,14 @@ def self.id_regex

rule %r/function(?=(\(.*\)))/, Keyword::Declaration # For anonymous functions

rule %r/(#{id})[ \t]*(?=(\(.*\)))/m, Name::Function
rule %r/(#{id})[ \t]*(?=(\(.*\)))/m do |m|
if self.class.keywords.include? m[1]
# "if" in "if (...)" or "switch" in "switch (...)" are recognized as keywords.
token Keyword
else
token Name::Function
end
end

rule %r/[{}]/, Punctuation, :statement

Expand Down

0 comments on commit de97ef7

Please sign in to comment.