diff options
author | Chris Morgan <me@chrismorgan.info> | 2015-04-21 23:12:55 +1000 |
---|---|---|
committer | Chris Morgan <me@chrismorgan.info> | 2015-04-21 23:12:55 +1000 |
commit | 9cf89d88ddd0369a32fe05039198ba15b113ac63 (patch) | |
tree | 2a4513673fc51b4610b80e198324ed9fd45c61a2 | |
parent | db77d4873ca2858446132608272f05bb83aa7ada (diff) | |
download | pygments-9cf89d88ddd0369a32fe05039198ba15b113ac63.tar.gz |
Fix Rust doc comments.
-rw-r--r-- | pygments/lexers/rust.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py index 354ab2be..656c289a 100644 --- a/pygments/lexers/rust.py +++ b/pygments/lexers/rust.py @@ -32,8 +32,11 @@ class RustLexer(RegexLexer): # Whitespace and Comments (r'\n', Whitespace), (r'\s+', Whitespace), - (r'//[/!](.*?)\n', Comment.Doc), + (r'//!.*?\n', String.Doc), + (r'///(\n|[^/].*?\n)', String.Doc), (r'//(.*?)\n', Comment.Single), + (r'/\*\*(\n|[^/*])', String.Doc, 'doccomment'), + (r'/\*!', String.Doc, 'doccomment'), (r'/\*', Comment.Multiline, 'comment'), # Macro parameters @@ -136,6 +139,12 @@ class RustLexer(RegexLexer): (r'\*/', Comment.Multiline, '#pop'), (r'[*/]', Comment.Multiline), ], + 'doccomment': [ + (r'[^*/]+', String.Doc), + (r'/\*', String.Doc, '#push'), + (r'\*/', String.Doc, '#pop'), + (r'[*/]', String.Doc), + ], 'number_lit': [ (r'[ui](8|16|32|64|size)', Keyword, '#pop'), (r'f(32|64)', Keyword, '#pop'), |