summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2014-11-06 08:46:19 +0100
committerArmin Ronacher <armin.ronacher@active-4.com>2014-11-06 08:46:19 +0100
commit87efaf7f8a29c0eaff6e0ff27adf07a2875ad1ac (patch)
treee622b115e3a2a3209affe9f85579a456c4453369
parente68c8a8772b899f4dc2ce9fa396fbf7baef39e54 (diff)
downloadpygments-87efaf7f8a29c0eaff6e0ff27adf07a2875ad1ac.tar.gz
Improved lifetimes and added macro parameters to rust.
-rw-r--r--pygments/lexers/rust.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py
index 0c156b20..500ff30b 100644
--- a/pygments/lexers/rust.py
+++ b/pygments/lexers/rust.py
@@ -36,6 +36,10 @@ class RustLexer(RegexLexer):
(r'//(.*?)\n', Comment.Single),
(r'/\*', Comment.Multiline, 'comment'),
+ # Lifetime
+ (r"""'[a-zA-Z_]\w*""", Name.Label),
+ # Macro parameters
+ (r"""\$([a-zA-Z_]\w*|\(,?|\),?|,?)""", Comment.Preproc),
# Keywords
(words((
'as', 'box', 'break', 'continue', 'do', 'else', 'enum', 'extern',
@@ -88,8 +92,6 @@ class RustLexer(RegexLexer):
(r"""'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}"""
r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|.)'""",
String.Char),
- # Lifetime
- (r"""'[a-zA-Z_]\w*""", Name.Label),
# Binary Literal
(r'0b[01_]+', Number.Bin, 'number_lit'),
# Octal Literal