summaryrefslogtreecommitdiff
path: root/pygments/lexers/compiled.py
diff options
context:
space:
mode:
authorMasanori Ogino <masanori.ogino@gmail.com>2014-08-03 01:12:59 +0900
committerMasanori Ogino <masanori.ogino@gmail.com>2014-08-03 01:12:59 +0900
commitab3fc81f632662a604e7e963457a199a28be9e2a (patch)
tree9931eec54b6230578b8cb2b6603d927787361f7b /pygments/lexers/compiled.py
parent2f1c724903db081f1d6941d366ca95070049e94b (diff)
downloadpygments-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.py8
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'),
],