Skip to content

Commit

Permalink
Combine import and package rules in Java lexer (#1389)
Browse files Browse the repository at this point in the history
The lexing that is performed for packages imported using the import 
keyword should be the same for the package keyword. This is consistent 
with the current behaviour in the Pygments lexer.
  • Loading branch information
pyrmont committed Jan 17, 2020
1 parent 0e6b3a6 commit c999334
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/rouge/lexers/java.rb
Expand Up @@ -50,10 +50,9 @@ class Java < RegexLexer
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
Expand Down

0 comments on commit c999334

Please sign in to comment.