From c99933406ca1c515ec95f3789ee093ca4af8d89e Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Sat, 18 Jan 2020 03:51:57 +0900 Subject: [PATCH] Combine import and package rules in Java lexer (#1389) 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. --- lib/rouge/lexers/java.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rouge/lexers/java.rb b/lib/rouge/lexers/java.rb index 4869add69f..22e1b6bc14 100644 --- a/lib/rouge/lexers/java.rb +++ b/lib/rouge/lexers/java.rb @@ -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