diff options
author | Georg Brandl <georg@python.org> | 2014-09-16 09:39:52 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-09-16 09:39:52 +0200 |
commit | dcd83d52d1d4a3dc55987316db3cc5c22c5b4250 (patch) | |
tree | 45ecd2f56e149ff7982b0b3ebf77893712a6ee74 /pygments/lexers/compiled.py | |
parent | 37edcfcaa1f6953ac4134fd2adcd92b80365c83e (diff) | |
parent | ab3fc81f632662a604e7e963457a199a28be9e2a (diff) | |
download | pygments-dcd83d52d1d4a3dc55987316db3cc5c22c5b4250.tar.gz |
Merged in omasanori/pygments (pull request #388)
Fix RustLexer to handle nested block comments.
Diffstat (limited to 'pygments/lexers/compiled.py')
-rw-r--r-- | pygments/lexers/compiled.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 79790725..67f2b5ee 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -3321,7 +3321,7 @@ class RustLexer(RegexLexer): (r'\s+', Text), (r'//[/!](.*?)\n', Comment.Doc), (r'//(.*?)\n', Comment.Single), - (r'/[*](.|\n)*?[*]/', Comment.Multiline), + (r'/\*', Comment.Multiline, 'comment'), # Keywords (r'(as|box|break|continue' @@ -3403,6 +3403,12 @@ class RustLexer(RegexLexer): (r'([A-Za-z_]\w*)!\s*([A-Za-z_]\w*)?\(', bygroups(Comment.Preproc, Name), 'macro('), ], + 'comment': [ + (r'[^*/]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], 'number_lit': [ (r'(([ui](8|16|32|64)?)|(f(32|64)?))?', Keyword, '#pop'), ], |