eric6/ThirdParty/Pygments/pygments/lexers/rust.py

changeset 7701
25f42e208e08
parent 7547
21b0534faebc
child 7983
54c5cfbb1e29
equal deleted inserted replaced
7700:a3cf077a8db3 7701:25f42e208e08
3 pygments.lexers.rust 3 pygments.lexers.rust
4 ~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for the Rust language. 6 Lexers for the Rust language.
7 7
8 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 from pygments.lexer import RegexLexer, include, bygroups, words, default 12 from pygments.lexer import RegexLexer, include, bygroups, words, default
13 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ 13 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
38 'AsRef', 'AsMut', 'Into', 'From', 38 'AsRef', 'AsMut', 'Into', 'From',
39 'Iterator', 'Extend', 'IntoIterator', 'DoubleEndedIterator', 39 'Iterator', 'Extend', 'IntoIterator', 'DoubleEndedIterator',
40 'ExactSizeIterator', 'Option', 'Result', 40 'ExactSizeIterator', 'Option', 'Result',
41 'Box', 'ToOwned', 'String', 'ToString', 'Vec', 41 'Box', 'ToOwned', 'String', 'ToString', 'Vec',
42 'Clone', 'Copy', 'Default', 'Eq', 'Hash', 'Ord', 'PartialEq', 42 'Clone', 'Copy', 'Default', 'Eq', 'Hash', 'Ord', 'PartialEq',
43 'PartialOrd', 'Eq', 'Ord', 43 'PartialOrd', 'Ord',
44 ), suffix=r'\b'), Name.Builtin) 44 ), suffix=r'\b'), Name.Builtin)
45 45
46 builtin_funcs_macros = (words(( 46 builtin_funcs_macros = (words((
47 'drop', 'Some', 'None', 'Ok', 'Err', 47 'drop', 'Some', 'None', 'Ok', 'Err',
48 'asm!', 'assert!', 'assert_eq!', 'assert_ne!', 'cfg!', 'column!', 48 'asm!', 'assert!', 'assert_eq!', 'assert_ne!', 'cfg!', 'column!',
129 (r'b"', String, 'bytestring'), 129 (r'b"', String, 'bytestring'),
130 (r'"', String, 'string'), 130 (r'"', String, 'string'),
131 (r'b?r(#*)".*?"\1', String), 131 (r'b?r(#*)".*?"\1', String),
132 132
133 # Lifetime names 133 # Lifetime names
134 (r"'(static|_)", Name.Builtin), 134 (r"'", Operator, 'lifetime'),
135 (r"'[a-zA-Z_]\w*", Name.Attribute),
136 135
137 # Operators and Punctuation 136 # Operators and Punctuation
138 (r'\.\.=?', Operator), 137 (r'\.\.=?', Operator),
139 (r'[{}()\[\],.;]', Punctuation), 138 (r'[{}()\[\],.;]', Punctuation),
140 (r'[+\-*/%&|<>^!~@=:?]', Operator), 139 (r'[+\-*/%&|<>^!~@=:?]', Operator),
170 default('#pop'), 169 default('#pop'),
171 ], 170 ],
172 'typename': [ 171 'typename': [
173 (r'\s+', Text), 172 (r'\s+', Text),
174 (r'&', Keyword.Pseudo), 173 (r'&', Keyword.Pseudo),
174 (r"'", Operator, 'lifetime'),
175 builtin_types, 175 builtin_types,
176 keyword_types, 176 keyword_types,
177 (r'[a-zA-Z_]\w*', Name.Class, '#pop'), 177 (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
178 default('#pop'),
179 ],
180 'lifetime': [
181 (r"(static|_)", Name.Builtin),
182 (r"[a-zA-Z_]+\w*", Name.Attribute),
178 default('#pop'), 183 default('#pop'),
179 ], 184 ],
180 'number_lit': [ 185 'number_lit': [
181 (r'[ui](8|16|32|64|size)', Keyword, '#pop'), 186 (r'[ui](8|16|32|64|size)', Keyword, '#pop'),
182 (r'f(32|64)', Keyword, '#pop'), 187 (r'f(32|64)', Keyword, '#pop'),

eric ide

mercurial