11/**
22 * @file Rust grammar for tree-sitter
33 * @author Maxim Sokolov <maxim0xff@gmail.com>
4- * @author Max Brunsfeld
4+ * @author Max Brunsfeld <maxbrunsfeld@gmail.com>
55 * @author Amaan Qureshi <amaanq12@gmail.com>
66 * @license MIT
77 */
88
9- /* eslint-disable arrow-parens */
10- /* eslint-disable camelcase */
11- /* eslint-disable-next-line spaced-comment */
129/// <reference types="tree-sitter-cli/dsl" />
1310// @ts -check
1411
@@ -33,7 +30,7 @@ const PREC = {
3330 closure : - 1 ,
3431} ;
3532
36- const numeric_types = [
33+ const numericTypes = [
3734 'u8' ,
3835 'i8' ,
3936 'u16' ,
@@ -59,7 +56,7 @@ const TOKEN_TREE_NON_SPECIAL_TOKENS = [
5956 '<' , '>' , '|' , '~' ,
6057] ;
6158
62- const primitive_types = numeric_types . concat ( [ 'bool' , 'str' , 'char' ] ) ;
59+ const primitiveTypes = numericTypes . concat ( [ 'bool' , 'str' , 'char' ] ) ;
6360
6461module . exports = grammar ( {
6562 name : 'rust' ,
@@ -236,7 +233,7 @@ module.exports = grammar({
236233 // with $).
237234 _non_special_token : $ => choice (
238235 $ . _literal , $ . identifier , $ . mutable_specifier , $ . self , $ . super , $ . crate ,
239- alias ( choice ( ...primitive_types ) , $ . primitive_type ) ,
236+ alias ( choice ( ...primitiveTypes ) , $ . primitive_type ) ,
240237 prec . right ( repeat1 ( choice ( ...TOKEN_TREE_NON_SPECIAL_TOKENS ) ) ) ,
241238 '\'' ,
242239 'as' , 'async' , 'await' , 'break' , 'const' , 'continue' , 'default' , 'enum' , 'fn' , 'for' , 'if' , 'impl' ,
@@ -481,7 +478,7 @@ module.exports = grammar({
481478 $ . tuple_type ,
482479 $ . array_type ,
483480 $ . higher_ranked_trait_bound ,
484- alias ( choice ( ...primitive_types ) , $ . primitive_type ) ,
481+ alias ( choice ( ...primitiveTypes ) , $ . primitive_type ) ,
485482 ) ) ,
486483 field ( 'bounds' , $ . trait_bounds ) ,
487484 ) ,
@@ -714,7 +711,7 @@ module.exports = grammar({
714711 $ . empty_type ,
715712 $ . dynamic_type ,
716713 $ . bounded_type ,
717- alias ( choice ( ...primitive_types ) , $ . primitive_type ) ,
714+ alias ( choice ( ...primitiveTypes ) , $ . primitive_type ) ,
718715 ) ,
719716
720717 bracketed_type : $ => seq (
@@ -886,7 +883,7 @@ module.exports = grammar({
886883 $ . yield_expression ,
887884 $ . _literal ,
888885 prec . left ( $ . identifier ) ,
889- alias ( choice ( ...primitive_types ) , $ . identifier ) ,
886+ alias ( choice ( ...primitiveTypes ) , $ . identifier ) ,
890887 prec . left ( $ . _reserved_identifier ) ,
891888 $ . self ,
892889 $ . scoped_identifier ,
@@ -1312,7 +1309,7 @@ module.exports = grammar({
13121309
13131310 _pattern : $ => choice (
13141311 $ . _literal_pattern ,
1315- alias ( choice ( ...primitive_types ) , $ . identifier ) ,
1312+ alias ( choice ( ...primitiveTypes ) , $ . identifier ) ,
13161313 $ . identifier ,
13171314 $ . scoped_identifier ,
13181315 $ . tuple_pattern ,
@@ -1457,7 +1454,7 @@ module.exports = grammar({
14571454 / 0 b [ 0 1 _ ] + / ,
14581455 / 0 o [ 0 - 7 _ ] + / ,
14591456 ) ,
1460- optional ( choice ( ...numeric_types ) ) ,
1457+ optional ( choice ( ...numericTypes ) ) ,
14611458 ) ) ,
14621459
14631460 string_literal : $ => seq (
@@ -1550,7 +1547,7 @@ module.exports = grammar({
15501547
15511548 _path : $ => choice (
15521549 $ . self ,
1553- alias ( choice ( ...primitive_types ) , $ . identifier ) ,
1550+ alias ( choice ( ...primitiveTypes ) , $ . identifier ) ,
15541551 $ . metavariable ,
15551552 $ . super ,
15561553 $ . crate ,
0 commit comments