diff options
author | Tim Hatch <tim@timhatch.com> | 2014-10-07 13:29:40 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-10-07 13:29:40 -0700 |
commit | 292b11fdfa96f33f40380a1053b65a2d5f344783 (patch) | |
tree | 317dc69ac42f77ca8714de4ea12ff9bc5102a897 /pygments/lexers/jvm.py | |
parent | a34c60a2e073e9ddaa46f976064cf864125affbb (diff) | |
parent | 34d2f291d161ac07e090a597660c9fb383b9522b (diff) | |
download | pygments-292b11fdfa96f33f40380a1053b65a2d5f344783.tar.gz |
Merge with -main
Diffstat (limited to 'pygments/lexers/jvm.py')
-rw-r--r-- | pygments/lexers/jvm.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index c5fe49f6..86a45d1e 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -244,6 +244,7 @@ class ScalaLexer(RegexLexer): u'\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]') idrest = u'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op) + letter_letter_digit = u'%s(?:%s|\d)*' % (letter, letter) tokens = { 'root': [ @@ -268,6 +269,7 @@ class ScalaLexer(RegexLexer): (r'""".*?"""(?!")', String), (r'"(\\\\|\\"|[^"])*"', String), (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), + (r'[fs]"""', String, 'interptriplestring'), # interpolated strings (r'[fs]"', String, 'interpstring'), # interpolated strings (r'raw"(\\\\|\\"|[^"])*"', String), # raw strings # (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator, @@ -322,18 +324,27 @@ class ScalaLexer(RegexLexer): 'import': [ (u'(%s|\\.)+' % idrest, Name.Namespace, '#pop') ], - 'interpstring': [ - (r'[^"$\\]', String), - (r'\$\{', String.Interpol, 'interpbrace'), + 'interpstringcommon': [ + (r'[^"$\\]+', String), (r'\$\$', String), + (r'\$' + letter_letter_digit, String.Interpol), + (r'\$\{', String.Interpol, 'interpbrace'), (r'\\.', String), + ], + 'interptriplestring': [ + (r'"""(?!")', String, '#pop'), + (r'"', String), + include('interpstringcommon'), + ], + 'interpstring': [ (r'"', String, '#pop'), + include('interpstringcommon'), ], 'interpbrace': [ (r'\}', String.Interpol, '#pop'), (r'\{', String.Interpol, '#push'), include('root'), - ] + ], } |