summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-10-04 11:12:18 -0700
committerTim Hatch <tim@timhatch.com>2014-10-04 11:12:18 -0700
commitaecd82a97ccca9955401ca2261d0bd3d989a1865 (patch)
treeafeb41cbc79c5801b2a440c58ab9669b841ca68b
parent9c1cc3718f960d907120e48ffe3c887bed428ede (diff)
downloadpygments-aecd82a97ccca9955401ca2261d0bd3d989a1865.tar.gz
Fix bygroups usage in RustLexer
-rw-r--r--pygments/lexers/rust.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py
index 914d3c7e..87bdcc5e 100644
--- a/pygments/lexers/rust.py
+++ b/pygments/lexers/rust.py
@@ -11,7 +11,7 @@
from pygments.lexer import RegexLexer, include, bygroups, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
- Number, Punctuation
+ Number, Punctuation, Whitespace
__all__ = ['RustLexer']
@@ -30,8 +30,8 @@ class RustLexer(RegexLexer):
tokens = {
'root': [
# Whitespace and Comments
- (r'\n', Text),
- (r'\s+', Text),
+ (r'\n', Whitespace),
+ (r'\s+', Whitespace),
(r'//[/!](.*?)\n', Comment.Doc),
(r'//(.*?)\n', Comment.Single),
(r'/\*', Comment.Multiline, 'comment'),
@@ -114,10 +114,12 @@ class RustLexer(RegexLexer):
# Attributes
(r'#\[', Comment.Preproc, 'attribute['),
# Macros
- (r'([A-Za-z_]\w*)!\s*([A-Za-z_]\w*)?\s*\{',
- bygroups(Comment.Preproc, Name), 'macro{'),
- (r'([A-Za-z_]\w*)!\s*([A-Za-z_]\w*)?\(',
- bygroups(Comment.Preproc, Name), 'macro('),
+ (r'([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\s*)(\{)',
+ bygroups(Comment.Preproc, Punctuation, Whitespace, Name,
+ Whitespace, Punctuation), 'macro{'),
+ (r'([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\()',
+ bygroups(Comment.Preproc, Punctuation, Whitespace, Name,
+ Punctuation), 'macro('),
],
'comment': [
(r'[^*/]+', Comment.Multiline),