lib/rouge/lexers/lasso.rb in rouge-3.18.0 vs lib/rouge/lexers/lasso.rb in rouge-3.19.0
- old
+ new
@@ -34,11 +34,11 @@
push :lasso if start_inline?
end
# self-modifying method that loads the keywords file
def self.keywords
- load File.join(Lexers::BASE_DIR, 'lasso/keywords.rb')
+ Kernel::load File.join(Lexers::BASE_DIR, 'lasso/keywords.rb')
keywords
end
id = /[a-z_][\w.]*/i
@@ -118,11 +118,10 @@
groups Operator, Name::Other
end
rule %r/(?<!->)(self|inherited|currentcapture|givenblock)\b/i, Name::Builtin::Pseudo
rule %r/-(?!infinity)#{id}/i, Name::Attribute
rule %r/::\s*#{id}/, Name::Label
- rule %r/error_((code|msg)_\w+|adderror|columnrestriction|databaseconnectionunavailable|databasetimeout|deleteerror|fieldrestriction|filenotfound|invaliddatabase|invalidpassword|invalidusername|modulenotfound|noerror|nopermission|outofmemory|reqcolumnmissing|reqfieldmissing|requiredcolumnmissing|requiredfieldmissing|updateerror)/i, Name::Exception
# definitions
rule %r/(define)(\s+)(#{id})(\s*=>\s*)(type|trait|thread)\b/i do
groups Keyword::Declaration, Text, Name::Class, Operator, Keyword
end
@@ -143,11 +142,10 @@
end
# keywords
rule %r/(true|false|none|minimal|full|all|void)\b/i, Keyword::Constant
rule %r/(local|var|variable|global|data(?=\s))\b/i, Keyword::Declaration
- rule %r/(array|date|decimal|duration|integer|map|pair|string|tag|xml|null|boolean|bytes|keyword|list|locale|queue|set|stack|staticarray)\b/i, Keyword::Type
rule %r/(#{id})(\s+)(in)\b/i do
groups Name, Text, Keyword
end
rule %r/(let|into)(\s+)(#{id})/i do
groups Keyword, Text, Name
@@ -167,12 +165,18 @@
token Punctuation, m[1]
end
if name == 'namespace_using'
token Keyword::Namespace, m[2]
+ elsif self.class.keywords[:exceptions].include? name
+ token Name::Exception, m[2]
+ elsif self.class.keywords[:types].include? name
+ token Keyword::Type, m[2]
+ elsif self.class.keywords[:traits].include? name
+ token Name::Decorator, m[2]
elsif self.class.keywords[:keywords].include? name
token Keyword, m[2]
- elsif self.class.keywords[:types_traits].include? name
+ elsif self.class.keywords[:builtins].include? name
token Name::Builtin, m[2]
else
token Name::Other, m[2]
end
end