1
1
/**
2
2
* @file Rust grammar for tree-sitter
3
3
* @author Maxim Sokolov <maxim0xff@gmail.com>
4
- * @author Max Brunsfeld
4
+ * @author Max Brunsfeld <maxbrunsfeld@gmail.com>
5
5
* @author Amaan Qureshi <amaanq12@gmail.com>
6
6
* @license MIT
7
7
*/
8
8
9
- /* eslint-disable arrow-parens */
10
- /* eslint-disable camelcase */
11
- /* eslint-disable-next-line spaced-comment */
12
9
/// <reference types="tree-sitter-cli/dsl" />
13
10
// @ts -check
14
11
@@ -33,7 +30,7 @@ const PREC = {
33
30
closure : - 1 ,
34
31
} ;
35
32
36
- const numeric_types = [
33
+ const numericTypes = [
37
34
'u8' ,
38
35
'i8' ,
39
36
'u16' ,
@@ -59,7 +56,7 @@ const TOKEN_TREE_NON_SPECIAL_TOKENS = [
59
56
'<' , '>' , '|' , '~' ,
60
57
] ;
61
58
62
- const primitive_types = numeric_types . concat ( [ 'bool' , 'str' , 'char' ] ) ;
59
+ const primitiveTypes = numericTypes . concat ( [ 'bool' , 'str' , 'char' ] ) ;
63
60
64
61
module . exports = grammar ( {
65
62
name : 'rust' ,
@@ -236,7 +233,7 @@ module.exports = grammar({
236
233
// with $).
237
234
_non_special_token : $ => choice (
238
235
$ . _literal , $ . identifier , $ . mutable_specifier , $ . self , $ . super , $ . crate ,
239
- alias ( choice ( ...primitive_types ) , $ . primitive_type ) ,
236
+ alias ( choice ( ...primitiveTypes ) , $ . primitive_type ) ,
240
237
prec . right ( repeat1 ( choice ( ...TOKEN_TREE_NON_SPECIAL_TOKENS ) ) ) ,
241
238
'\'' ,
242
239
'as' , 'async' , 'await' , 'break' , 'const' , 'continue' , 'default' , 'enum' , 'fn' , 'for' , 'if' , 'impl' ,
@@ -481,7 +478,7 @@ module.exports = grammar({
481
478
$ . tuple_type ,
482
479
$ . array_type ,
483
480
$ . higher_ranked_trait_bound ,
484
- alias ( choice ( ...primitive_types ) , $ . primitive_type ) ,
481
+ alias ( choice ( ...primitiveTypes ) , $ . primitive_type ) ,
485
482
) ) ,
486
483
field ( 'bounds' , $ . trait_bounds ) ,
487
484
) ,
@@ -714,7 +711,7 @@ module.exports = grammar({
714
711
$ . empty_type ,
715
712
$ . dynamic_type ,
716
713
$ . bounded_type ,
717
- alias ( choice ( ...primitive_types ) , $ . primitive_type ) ,
714
+ alias ( choice ( ...primitiveTypes ) , $ . primitive_type ) ,
718
715
) ,
719
716
720
717
bracketed_type : $ => seq (
@@ -886,7 +883,7 @@ module.exports = grammar({
886
883
$ . yield_expression ,
887
884
$ . _literal ,
888
885
prec . left ( $ . identifier ) ,
889
- alias ( choice ( ...primitive_types ) , $ . identifier ) ,
886
+ alias ( choice ( ...primitiveTypes ) , $ . identifier ) ,
890
887
prec . left ( $ . _reserved_identifier ) ,
891
888
$ . self ,
892
889
$ . scoped_identifier ,
@@ -1312,7 +1309,7 @@ module.exports = grammar({
1312
1309
1313
1310
_pattern : $ => choice (
1314
1311
$ . _literal_pattern ,
1315
- alias ( choice ( ...primitive_types ) , $ . identifier ) ,
1312
+ alias ( choice ( ...primitiveTypes ) , $ . identifier ) ,
1316
1313
$ . identifier ,
1317
1314
$ . scoped_identifier ,
1318
1315
$ . tuple_pattern ,
@@ -1457,7 +1454,7 @@ module.exports = grammar({
1457
1454
/ 0 b [ 0 1 _ ] + / ,
1458
1455
/ 0 o [ 0 - 7 _ ] + / ,
1459
1456
) ,
1460
- optional ( choice ( ...numeric_types ) ) ,
1457
+ optional ( choice ( ...numericTypes ) ) ,
1461
1458
) ) ,
1462
1459
1463
1460
string_literal : $ => seq (
@@ -1550,7 +1547,7 @@ module.exports = grammar({
1550
1547
1551
1548
_path : $ => choice (
1552
1549
$ . self ,
1553
- alias ( choice ( ...primitive_types ) , $ . identifier ) ,
1550
+ alias ( choice ( ...primitiveTypes ) , $ . identifier ) ,
1554
1551
$ . metavariable ,
1555
1552
$ . super ,
1556
1553
$ . crate ,
0 commit comments