Skip to content

Commit d95861f

Browse files
committed
made all rust operators tokenize as unit
1 parent 7a9e1d8 commit d95861f

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

grammars/rust.cson

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,29 @@
252252
{ 'include': '#ref_lifetime' }
253253
# Operators
254254
{
255-
'comment': 'Operator'
256-
'name': 'keyword.operator.rust'
257-
'match': '(\\+|-|/|\\*|=|<=|>=|\\^|&|\\||!|%|::|\\bas\\b|<<|>>|>|<)'
255+
'comment': 'Miscellaneous operator'
256+
'name': 'keyword.operator.misc.rust'
257+
'match': '(=>|::|\\bas\\b)'
258+
}
259+
{
260+
'comment': 'Comparison operator'
261+
'name': 'keyword.operator.comparison.rust'
262+
'match': '(&&|\\|\\||==|!=)'
263+
}
264+
{
265+
'comment': 'Assignment operator'
266+
'name': 'keyword.operator.assignment.rust'
267+
'match': '(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)'
268+
}
269+
{
270+
'comment': 'Arithmetic operator'
271+
'name': 'keyword.operator.arithmetic.rust'
272+
'match': '(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)'
273+
}
274+
{
275+
'comment': 'Comparison operator (second group because of regex precedence)'
276+
'name': 'keyword.operator.comparison.rust'
277+
'match': '(<=|>=|<|>)'
258278
}
259279
# Standard types and traits
260280
{ 'include': '#core_types' }

0 commit comments

Comments
 (0)