Skip to content

Commit fc159c4

Browse files
committed
Java: do not lex whitespace as Label, do not lex "default" as Label
Fixes #1851
1 parent 5f7ab20 commit fc159c4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pygments/lexers/jvm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ class JavaLexer(RegexLexer):
6868
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
6969
(r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Punctuation,
7070
Name.Attribute)),
71-
(r'^\s*([^\W\d]|\$)[\w$]*:', Name.Label),
71+
(r'^(\s*)(default)(:)', bygroups(Text, Keyword, Punctuation)),
72+
(r'^(\s*)((?:[^\W\d]|\$)[\w$]*)(:)', bygroups(Text, Name.Label,
73+
Punctuation)),
7274
(r'([^\W\d]|\$)[\w$]*', Name),
7375
(r'([0-9][0-9_]*\.([0-9][0-9_]*)?|'
7476
r'\.[0-9][0-9_]*)'

0 commit comments

Comments
 (0)