Skip to content

Commit

Permalink
Update groovy for record, enum, var (#1984)
Browse files Browse the repository at this point in the history
The 'record' keyword defines a new kind of record class.
'enum' was moved as the same level as the other types, as enums are also kind of classes.
Added 'var' as an alternative to 'def' for defining variables and such.
  • Loading branch information
glaforge committed Aug 25, 2023
1 parent 263655e commit 4e47529
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rouge/lexers/groovy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ def self.keywords

def self.declarations
@declarations ||= Set.new %w(
abstract const enum extends final implements native private
abstract const extends final implements native private
protected public static strictfp super synchronized throws
transient volatile
)
end

def self.types
@types ||= Set.new %w(
def boolean byte char double float int long short void
def var boolean byte char double float int long short void
)
end

Expand All @@ -56,7 +56,7 @@ def self.constants
rule %r(//.*?$), Comment::Single
rule %r(/[*].*?[*]/)m, Comment::Multiline
rule %r/@\w[\w.]*/, Name::Decorator
rule %r/(class|interface|trait)\b/, Keyword::Declaration, :class
rule %r/(class|interface|trait|enum|record)\b/, Keyword::Declaration, :class
rule %r/package\b/, Keyword::Namespace, :import
rule %r/import\b/, Keyword::Namespace, :import

Expand Down

0 comments on commit 4e47529

Please sign in to comment.