summaryrefslogtreecommitdiff
path: root/pygments/lexers/compiled.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-09-16 09:39:52 +0200
committerGeorg Brandl <georg@python.org>2014-09-16 09:39:52 +0200
commitdcd83d52d1d4a3dc55987316db3cc5c22c5b4250 (patch)
tree45ecd2f56e149ff7982b0b3ebf77893712a6ee74 /pygments/lexers/compiled.py
parent37edcfcaa1f6953ac4134fd2adcd92b80365c83e (diff)
parentab3fc81f632662a604e7e963457a199a28be9e2a (diff)
downloadpygments-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.py8
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'),
],