summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorVishalN7 <50436995+VishalN7@users.noreply.github.com>2022-05-10 20:40:31 +0930
committerGitHub <noreply@github.com>2022-05-10 13:10:31 +0200
commit4d2a285bd14f4dc153360e171bebdc52d1921089 (patch)
tree2994779aaf59c46f63071ae076eb9cc9b3b4e8ac /pygments
parent8b2834e393ee2cec32c03ea02b08107e04d5ae87 (diff)
downloadpygments-git-4d2a285bd14f4dc153360e171bebdc52d1921089.tar.gz
java multiline highlighting based on issue 1858 (#2132)
Co-authored-by: Chung Tai <chungtai456@gmail.com>
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/jvm.py6
1 files changed, 6 insertions, 0 deletions
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