From 4d2a285bd14f4dc153360e171bebdc52d1921089 Mon Sep 17 00:00:00 2001 From: VishalN7 <50436995+VishalN7@users.noreply.github.com> Date: Tue, 10 May 2022 20:40:31 +0930 Subject: java multiline highlighting based on issue 1858 (#2132) Co-authored-by: Chung Tai --- pygments/lexers/jvm.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pygments') diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index d053e373..aa055047 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -65,6 +65,7 @@ class JavaLexer(RegexLexer): (r'(var)(\s+)', bygroups(Keyword.Declaration, Whitespace), 'var'), (r'(import(?:\s+static)?)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'import'), + (r'"""\n', String, 'multiline_string'), (r'"', String, 'string'), (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Punctuation, @@ -99,6 +100,11 @@ class JavaLexer(RegexLexer): 'import': [ (r'[\w.]+\*?', Name.Namespace, '#pop') ], + 'multiline_string': [ + (r'"""', String, '#pop'), + (r'"', String), + include('string') + ], 'string': [ (r'[^\\"]+', String), (r'\\\\', String), # Escaped backslash -- cgit v1.2.1