diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-20 07:58:40 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-20 08:05:00 +0300 |
commit | bcd5bcc390793791d293d386b2ebefbe683fb4e1 (patch) | |
tree | c93e3b8c847237e7e7626f4a07f1b657bb34f04d /contrib/python/Pygments/py3/pygments/lexers/rust.py | |
parent | 1a9f1508fe9c8c5927ffebf33197a6108e70501d (diff) | |
download | ydb-bcd5bcc390793791d293d386b2ebefbe683fb4e1.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/rust.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/rust.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/rust.py b/contrib/python/Pygments/py3/pygments/lexers/rust.py index db68bb34614..04e15c8c774 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/rust.py +++ b/contrib/python/Pygments/py3/pygments/lexers/rust.py @@ -4,7 +4,7 @@ Lexers for the Rust language. - :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -18,14 +18,13 @@ __all__ = ['RustLexer'] class RustLexer(RegexLexer): """ Lexer for the Rust programming language (version 1.47). - - .. versionadded:: 1.6 """ name = 'Rust' url = 'https://www.rust-lang.org/' filenames = ['*.rs', '*.rs.in'] aliases = ['rust', 'rs'] mimetypes = ['text/rust', 'text/x-rust'] + version_added = '1.6' keyword_types = (words(( 'u8', 'u16', 'u32', 'u64', 'u128', 'i8', 'i16', 'i32', 'i64', 'i128', @@ -99,16 +98,16 @@ class RustLexer(RegexLexer): (r'let\b', Keyword.Declaration), (r'fn\b', Keyword, 'funcname'), (r'(struct|enum|type|union)\b', Keyword, 'typename'), - (r'(default)(\s+)(type|fn)\b', bygroups(Keyword, Text, Keyword)), + (r'(default)(\s+)(type|fn)\b', bygroups(Keyword, Whitespace, Keyword)), keyword_types, (r'[sS]elf\b', Name.Builtin.Pseudo), # Prelude (taken from Rust's src/libstd/prelude.rs) builtin_funcs_types, builtin_macros, # Path separators, so types don't catch them. - (r'::\b', Text), + (r'::\b', Punctuation), # Types in positions. - (r'(?::|->)', Text, 'typename'), + (r'(?::|->)', Punctuation, 'typename'), # Labels (r'(break|continue)(\b\s*)(\'[A-Za-z_]\w*)?', bygroups(Keyword, Text.Whitespace, Name.Label)), @@ -157,7 +156,7 @@ class RustLexer(RegexLexer): # Misc # Lone hashes: not used in Rust syntax, but allowed in macro # arguments, most famously for quote::quote!() - (r'#', Text), + (r'#', Punctuation), ], 'comment': [ (r'[^*/]+', Comment.Multiline), @@ -172,17 +171,17 @@ class RustLexer(RegexLexer): (r'[*/]', String.Doc), ], 'modname': [ - (r'\s+', Text), + (r'\s+', Whitespace), (r'[a-zA-Z_]\w*', Name.Namespace, '#pop'), default('#pop'), ], 'funcname': [ - (r'\s+', Text), + (r'\s+', Whitespace), (r'[a-zA-Z_]\w*', Name.Function, '#pop'), default('#pop'), ], 'typename': [ - (r'\s+', Text), + (r'\s+', Whitespace), (r'&', Keyword.Pseudo), (r"'", Operator, 'lifetime'), builtin_funcs_types, |