lib/rouge/lexers/apex.rb in rouge-3.23.0 vs lib/rouge/lexers/apex.rb in rouge-3.24.0
- old
+ new
@@ -47,28 +47,30 @@
id = /[a-z_][a-z0-9_]*/i
state :root do
rule %r/\s+/m, Text
-
+
rule %r(//.*?$), Comment::Single
rule %r(/\*.*?\*/)m, Comment::Multiline
rule %r/(?:class|interface)\b/, Keyword::Declaration, :class
rule %r/import\b/, Keyword::Namespace, :import
rule %r/([@$.]?)(#{id})([:(]?)/io do |m|
- if self.class.keywords.include? m[0].downcase
+ lowercased = m[0].downcase
+ uppercased = m[0].upcase
+ if self.class.keywords.include? lowercased
token Keyword
- elsif self.class.soql.include? m[0].upcase
+ elsif self.class.soql.include? uppercased
token Keyword
- elsif self.class.declarations.include? m[0].downcase
+ elsif self.class.declarations.include? lowercased
token Keyword::Declaration
- elsif self.class.types.include? m[0].downcase
+ elsif self.class.types.include? lowercased
token Keyword::Type
- elsif self.class.constants.include? m[0].downcase
+ elsif self.class.constants.include? lowercased
token Keyword::Constant
- elsif 'package'.casecmp m[0]
+ elsif lowercased == 'package'
token Keyword::Namespace
elsif m[1] == "@"
token Name::Decorator
elsif m[3] == ":"
groups Operator, Name::Label, Punctuation