diff options
author | Masanori Ogino <masanori.ogino@gmail.com> | 2014-08-03 01:12:59 +0900 |
---|---|---|
committer | Masanori Ogino <masanori.ogino@gmail.com> | 2014-08-03 01:12:59 +0900 |
commit | ab3fc81f632662a604e7e963457a199a28be9e2a (patch) | |
tree | 9931eec54b6230578b8cb2b6603d927787361f7b /pygments/lexers/compiled.py | |
parent | 2f1c724903db081f1d6941d366ca95070049e94b (diff) | |
download | pygments-ab3fc81f632662a604e7e963457a199a28be9e2a.tar.gz |
Fix RustLexer to handle nested block comments.
Since Rust 0.9, block comments (e.g. /* ... */) may be nested.
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 25c7a4d8..8bfa6058 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'), ], |