lib/rouge/lexers/java.rb in rouge-3.15.0 vs lib/rouge/lexers/java.rb in rouge-3.16.0
- old
+ new
@@ -21,13 +21,13 @@
public static strictfp super synchronized throws transient volatile
)
types = %w(boolean byte char double float int long short var void)
- id = /[a-zA-Z_][a-zA-Z0-9_]*/
- const_name = /[A-Z][A-Z0-9_]*\b/
- class_name = /[A-Z][a-zA-Z0-9]*\b/
+ id = /[[:alpha:]_][[:word:]]*/
+ const_name = /[[:upper:]][[:upper:][:digit:]_]*\b/
+ class_name = /[[:upper:]][[:alnum:]]*\b/
state :root do
rule %r/[^\S\n]+/, Text
rule %r(//.*?$), Comment::Single
rule %r(/\*.*?\*/)m, Comment::Multiline
@@ -48,13 +48,12 @@
end
rule %r/@#{id}/, Name::Decorator
rule %r/(?:#{declarations.join('|')})\b/, Keyword::Declaration
rule %r/(?:#{types.join('|')})\b/, Keyword::Type
- rule %r/package\b/, Keyword::Namespace
rule %r/(?:true|false|null)\b/, Keyword::Constant
rule %r/(?:class|interface)\b/, Keyword::Declaration, :class
- rule %r/import\b/, Keyword::Namespace, :import
+ rule %r/(?:import|package)\b/, Keyword::Namespace, :import
rule %r/"(\\\\|\\"|[^"])*"/, Str
rule %r/'(?:\\.|[^\\]|\\u[0-9a-f]{4})'/, Str::Char
rule %r/(\.)(#{id})/ do
groups Operator, Name::Attribute
end