(grammar (start source_file) (matching longest) (settling tokens precedence dynamic ambiguity))
(extra (class plain (char %20) (char %09) (char %0A) (char %0D) (char %0C) (char %0B)))
(extra (ref line_comment))
(extra (ref block_comment))
(conflict type pattern)
(conflict unit_type tuple_pattern)
(conflict scoped_identifier scoped_type_identifier)
(conflict parameters pattern)
(conflict parameters tuple_structure_pattern)
(conflict array_expression)
(conflict visibility_modifier)
(conflict visibility_modifier scoped_identifier scoped_type_identifier)
(conflict foreign_module_item function_modifiers)
(scanner strings (tokens string_content string_close) (operations (if (valid string_content) (then (if (some (next (literal %22)) (next (literal %5C)) atEnd) (then fail)) (while (not (some (next (literal %22)) (next (literal %5C)))) (do advance)) (emit string_content))) (if (valid string_close) (then (consume (literal %22)) (emit string_close))) fail))
(scanner raw_strings (tokens raw_string_literal_start raw_string_literal_content raw_string_literal_end) (operations (if (valid raw_string_literal_start) (then (while (next (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))) (do (skip (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))))) (if (some (next (literal b)) (next (literal c))) (then advance)) (consume (literal r)) (while (next (literal %23)) (do advance (push hashes (integer 1)))) (consume (literal %22)) (emit raw_string_literal_start))) (if (valid raw_string_literal_content) (then (while (next (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))) (do (skip (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))))) (while (not atEnd) (do (if (next (literal %22)) (then mark advance (while (all (next (literal %23)) (less (depth seen) (depth hashes))) (do advance (push seen (integer 1)))) (if (equal (depth seen) (depth hashes)) (then (while (greater (depth seen) (integer 0)) (do (pop seen))) (emit raw_string_literal_content))) (while (greater (depth seen) (integer 0)) (do (pop seen)))) (else advance)))) fail)) (if (valid raw_string_literal_end) (then (while (next (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))) (do (skip (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))))) (consume (literal %22)) (while (greater (depth hashes) (integer 0)) (do advance (pop hashes))) (emit raw_string_literal_end))) fail))
(scanner floats (tokens float_literal) (operations (while (next (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))) (do (skip (class plain (char %20) (char %09) (char %0A) (char %0B) (char %0C) (char %0D))))) (if (not (next (class plain (range 0 9)))) (then fail)) advance (while (next (class plain (range 0 9) (char _))) (do advance)) (if (next (literal .)) (then advance (if (some (next (class plain (category Lu) (category Ll) (category Lt) (category Lm) (category Lo))) (next (literal .))) (then fail)) (while (next (class plain (range 0 9) (char _))) (do advance)) (push float (integer 1)))) mark (if (some (next (literal e)) (next (literal E))) (then advance (if (some (next (literal %2B)) (next (literal -))) (then advance)) (if (not (next (class plain (range 0 9) (char _)))) (then (while (greater (depth float) (integer 0)) (do (pop float))) (emit float_literal))) advance (while (next (class plain (range 0 9) (char _))) (do advance)) mark (push float (integer 1)))) (if (equal (depth float) (integer 0)) (then fail)) (while (greater (depth float) (integer 0)) (do (pop float))) (if (not (some (next (literal u)) (next (literal i)) (next (literal f)))) (then (emit float_literal))) advance (if (not (next (class plain (range 0 9)))) (then (emit float_literal))) (while (next (class plain (range 0 9))) (do advance)) mark (emit float_literal)))
(scanner block_comments (tokens outer_block_documentation_comment_marker inner_block_documentation_comment_marker block_comment_content) (operations (if (valid inner_block_documentation_comment_marker) (then (consume (literal %21)) (if (not (next (literal %2A%2F))) (then (push documentation (integer 1)))) (emit inner_block_documentation_comment_marker))) (if (valid outer_block_documentation_comment_marker) (then (consume (literal %2A)) (if (some (next (literal %2F)) (next (literal %2A))) (then fail)) (push documentation (integer 1)) (emit outer_block_documentation_comment_marker))) (if (valid block_comment_content) (then (if (greater (depth documentation) (integer 0)) (then (pop documentation)) (else (if (some (next (literal %21)) (all (next (literal %2A)) (not (next (literal %2A%2A))))) (then fail)))) (if (next (literal %2A%2F)) (then fail)) (push nesting (integer 1)) (while (greater (depth nesting) (integer 0)) (do (if atEnd (then (while (greater (depth nesting) (integer 0)) (do (pop nesting)))) (else (if (next (literal %2A%2F)) (then (pop nesting) (if (greater (depth nesting) (integer 0)) (then (consume (literal %2A%2F))))) (else (if (next (literal %2F%2A)) (then (consume (literal %2F%2A)) (push nesting (integer 1))) (else advance)))))))) (emit block_comment_content))) fail))
(scanner line_documentation (tokens line_documentation_content) (operations (while (not (some atEnd (next (literal %0A)))) (do advance)) (if (next (literal %0A)) (then advance)) (emit line_documentation_content)))
(scanner error_sentinel (tokens error_sentinel) (operations fail))
(kind documentation_comment (source-names (tree-sitter doc_comment)))
(kind outer_documentation_comment_marker (source-names (tree-sitter outer_doc_comment_marker)))
(kind inner_documentation_comment_marker (source-names (tree-sitter inner_doc_comment_marker)))
(rule source_file normal (seq (optional (ref shebang)) (optional (ref frontmatter)) (repeat0 (ref statement))) (concept grammar.source-file))
(rule statement silent (choice unordered (ref expression_statement) (ref declaration_statement)) (concept grammar.statement) (source-names (tree-sitter _statement)))
(rule empty_statement normal (literal %3B) (concept grammar.empty-statement))
(rule expression_statement normal (choice unordered (seq (ref expression) (literal %3B)) (precedence 1 none (ref expression_ending_with_block))) (concept grammar.expression-statement))
(rule declaration_statement silent (choice unordered (ref constant_item) (ref macro_invocation) (ref macro_definition) (ref empty_statement) (ref attribute_item) (ref inner_attribute_item) (ref module_item) (ref foreign_module_item) (ref structure_item) (ref union_item) (ref enumeration_item) (ref type_item) (ref function_item) (ref function_signature_item) (ref implementation_item) (ref trait_item) (ref associated_type) (ref let_declaration) (ref use_declaration) (ref extern_crate_declaration) (ref static_item)) (concept grammar.declaration-statement) (source-names (tree-sitter _declaration_statement)))
(rule macro_definition normal (seq (literal macro_rules%21) (capture labeled name (choice unordered (ref identifier) (ref reserved_identifier))) (choice unordered (seq (literal %28) (seq (repeat0 (seq (ref macro_rule) (literal %3B))) (optional (ref macro_rule))) (literal %29) (literal %3B)) (seq (literal %5B) (seq (repeat0 (seq (ref macro_rule) (literal %3B))) (optional (ref macro_rule))) (literal %5D) (literal %3B)) (seq (literal %7B) (seq (repeat0 (seq (ref macro_rule) (literal %3B))) (optional (ref macro_rule))) (literal %7D)))) (concept grammar.macro-definition))
(rule macro_rule normal (seq (capture labeled left (ref token_tree_pattern)) (literal %3D%3E) (capture labeled right (ref token_tree))) (concept grammar.macro-rule))
(rule token_pattern silent (choice unordered (ref token_tree_pattern) (ref token_repetition_pattern) (ref token_binding_pattern) (ref metavariable) (ref non_special_token) (precedence -1 none (literal %24))) (concept grammar.token-pattern) (source-names (tree-sitter _token_pattern)))
(rule token_tree_pattern normal (choice unordered (seq (literal %28) (repeat0 (ref token_pattern)) (literal %29)) (seq (literal %5B) (repeat0 (ref token_pattern)) (literal %5D)) (seq (literal %7B) (repeat0 (ref token_pattern)) (literal %7D))) (concept grammar.token-tree-pattern))
(rule token_binding_pattern normal (precedence 1 none (seq (capture labeled name (ref metavariable)) (literal %3A) (capture labeled type (ref fragment_specifier)))) (concept grammar.token-binding-pattern))
(rule token_repetition_pattern normal (seq (literal %24) (literal %28) (repeat0 (ref token_pattern)) (literal %29) (optional (alias unnamed_token (token (repeat1 (class negated (char %2B) (char %2A) (char %3F)))))) (choice unordered (literal %2B) (literal %2A) (literal %3F))) (concept grammar.token-repetition-pattern))
(rule fragment_specifier normal (choice unordered (token (seq (literal block) (not (ref word_characters)))) (token (seq (literal expr) (not (ref word_characters)))) (token (seq (literal expr_2021) (not (ref word_characters)))) (token (seq (literal ident) (not (ref word_characters)))) (token (seq (literal item) (not (ref word_characters)))) (token (seq (literal lifetime) (not (ref word_characters)))) (token (seq (literal literal) (not (ref word_characters)))) (token (seq (literal meta) (not (ref word_characters)))) (token (seq (literal pat) (not (ref word_characters)))) (token (seq (literal pat_param) (not (ref word_characters)))) (token (seq (literal path) (not (ref word_characters)))) (token (seq (literal stmt) (not (ref word_characters)))) (token (seq (literal tt) (not (ref word_characters)))) (token (seq (literal ty) (not (ref word_characters)))) (token (seq (literal vis) (not (ref word_characters))))) (concept grammar.fragment-specifier))
(rule tokens silent (choice unordered (ref token_tree) (ref token_repetition) (ref metavariable) (ref non_special_token) (precedence -1 none (literal %24))) (concept grammar.tokens) (source-names (tree-sitter _tokens)))
(rule token_tree normal (choice unordered (seq (literal %28) (repeat0 (ref tokens)) (literal %29)) (seq (literal %5B) (repeat0 (ref tokens)) (literal %5D)) (seq (literal %7B) (repeat0 (ref tokens)) (literal %7D))) (concept grammar.token-tree))
(rule token_repetition normal (seq (literal %24) (literal %28) (repeat0 (ref tokens)) (literal %29) (optional (alias unnamed_token (token (repeat1 (class negated (char %2B) (char %2A) (char %3F)))))) (choice unordered (literal %2B) (literal %2A) (literal %3F))) (concept grammar.token-repetition))
(rule non_special_token silent (choice unordered (ref literal) (ref identifier) (ref mutable_specifier) (ref self) (ref super) (ref crate) (alias primitive_type (choice unordered (token (seq (literal u8) (not (ref word_characters)))) (token (seq (literal i8) (not (ref word_characters)))) (token (seq (literal u16) (not (ref word_characters)))) (token (seq (literal i16) (not (ref word_characters)))) (token (seq (literal u32) (not (ref word_characters)))) (token (seq (literal i32) (not (ref word_characters)))) (token (seq (literal u64) (not (ref word_characters)))) (token (seq (literal i64) (not (ref word_characters)))) (token (seq (literal u128) (not (ref word_characters)))) (token (seq (literal i128) (not (ref word_characters)))) (token (seq (literal isize) (not (ref word_characters)))) (token (seq (literal usize) (not (ref word_characters)))) (token (seq (literal f32) (not (ref word_characters)))) (token (seq (literal f64) (not (ref word_characters)))) (token (seq (literal bool) (not (ref word_characters)))) (token (seq (literal str) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters)))))) (precedence 0 right (repeat1 (choice unordered (literal %2B) (literal -) (literal %2A) (literal %2F) (literal %25) (literal %5E) (literal %21) (literal %26) (literal %7C) (literal %26%26) (literal %7C%7C) (literal %3C%3C) (literal %3E%3E) (literal %2B%3D) (literal -%3D) (literal %2A%3D) (literal %2F%3D) (literal %25%3D) (literal %5E%3D) (literal %26%3D) (literal %7C%3D) (literal %3C%3C%3D) (literal %3E%3E%3D) (literal %3D) (literal %3D%3D) (literal %21%3D) (literal %3E) (literal %3C) (literal %3E%3D) (literal %3C%3D) (literal %40) (token (seq (literal _) (not (ref word_characters)))) (literal .) (literal ..) (literal ...) (literal ..%3D) (literal %2C) (literal %3B) (literal %3A) (literal %3A%3A) (literal -%3E) (literal %3D%3E) (literal %23) (literal %3F) (literal %7E)))) (literal %27) (token (seq (literal as) (not (ref word_characters)))) (token (seq (literal async) (not (ref word_characters)))) (token (seq (literal await) (not (ref word_characters)))) (token (seq (literal break) (not (ref word_characters)))) (token (seq (literal const) (not (ref word_characters)))) (token (seq (literal continue) (not (ref word_characters)))) (token (seq (literal default) (not (ref word_characters)))) (token (seq (literal enum) (not (ref word_characters)))) (token (seq (literal fn) (not (ref word_characters)))) (token (seq (literal for) (not (ref word_characters)))) (token (seq (literal gen) (not (ref word_characters)))) (token (seq (literal if) (not (ref word_characters)))) (token (seq (literal impl) (not (ref word_characters)))) (token (seq (literal let) (not (ref word_characters)))) (token (seq (literal loop) (not (ref word_characters)))) (token (seq (literal match) (not (ref word_characters)))) (token (seq (literal mod) (not (ref word_characters)))) (token (seq (literal pub) (not (ref word_characters)))) (token (seq (literal return) (not (ref word_characters)))) (token (seq (literal static) (not (ref word_characters)))) (token (seq (literal struct) (not (ref word_characters)))) (token (seq (literal trait) (not (ref word_characters)))) (token (seq (literal type) (not (ref word_characters)))) (token (seq (literal union) (not (ref word_characters)))) (token (seq (literal unsafe) (not (ref word_characters)))) (token (seq (literal use) (not (ref word_characters)))) (token (seq (literal where) (not (ref word_characters)))) (token (seq (literal while) (not (ref word_characters))))) (concept grammar.non-special-token) (source-names (tree-sitter _non_special_token)))
(rule attribute_item normal (seq (literal %23) (literal %5B) (ref attribute) (literal %5D)) (concept grammar.attribute-item))
(rule inner_attribute_item normal (seq (literal %23) (literal %21) (literal %5B) (ref attribute) (literal %5D)) (concept grammar.inner-attribute-item))
(rule attribute normal (seq (ref path) (optional (choice unordered (seq (literal %3D) (capture labeled value (ref expression))) (capture labeled arguments (alias token_tree (ref delimited_token_tree)))))) (concept program.attributes))
(rule module_item normal (seq (optional (ref visibility_modifier)) (token (seq (literal mod) (not (ref word_characters)))) (capture labeled name (ref identifier)) (choice unordered (literal %3B) (capture labeled body (ref declaration_list)))) (concept grammar.module-item) (source-names (tree-sitter mod_item)))
(rule foreign_module_item normal (seq (optional (token (seq (literal unsafe) (not (ref word_characters))))) (ref extern_modifier) (choice unordered (literal %3B) (capture labeled body (ref declaration_list)))) (concept grammar.foreign-module-item) (source-names (tree-sitter foreign_mod_item)))
(rule declaration_list normal (seq (literal %7B) (repeat0 (ref declaration_statement)) (literal %7D)) (concept grammar.declaration-list))
(rule structure_item normal (seq (optional (ref visibility_modifier)) (token (seq (literal struct) (not (ref word_characters)))) (capture labeled name (ref type_identifier_alias)) (capture labeled type_parameters (optional (ref type_parameters))) (choice unordered (seq (optional (ref where_clause)) (capture labeled body (ref field_declaration_list))) (seq (capture labeled body (ref ordered_field_declaration_list)) (optional (ref where_clause)) (literal %3B)) (seq (ref where_clause) (literal %3B)) (literal %3B))) (concept grammar.structure-item) (source-names (tree-sitter struct_item)))
(rule union_item normal (seq (optional (ref visibility_modifier)) (token (seq (literal union) (not (ref word_characters)))) (capture labeled name (ref type_identifier_alias)) (capture labeled type_parameters (optional (ref type_parameters))) (optional (ref where_clause)) (capture labeled body (ref field_declaration_list))) (concept grammar.union-item))
(rule enumeration_item normal (seq (optional (ref visibility_modifier)) (token (seq (literal enum) (not (ref word_characters)))) (capture labeled name (ref type_identifier_alias)) (capture labeled type_parameters (optional (ref type_parameters))) (optional (ref where_clause)) (capture labeled body (ref enumeration_variant_list))) (concept grammar.enumeration-item) (source-names (tree-sitter enum_item)))
(rule enumeration_variant_list normal (seq (literal %7B) (optional (seq (seq (repeat0 (ref attribute_item)) (ref enumeration_variant)) (repeat0 (seq (literal %2C) (seq (repeat0 (ref attribute_item)) (ref enumeration_variant)))))) (optional (literal %2C)) (literal %7D)) (concept grammar.enumeration-variant-list) (source-names (tree-sitter enum_variant_list)))
(rule enumeration_variant normal (seq (optional (ref visibility_modifier)) (capture labeled name (ref identifier)) (capture labeled body (optional (choice unordered (ref field_declaration_list) (ref ordered_field_declaration_list)))) (optional (seq (literal %3D) (capture labeled value (ref expression))))) (concept grammar.enumeration-variant) (source-names (tree-sitter enum_variant)))
(rule field_declaration_list normal (seq (literal %7B) (optional (seq (seq (repeat0 (ref attribute_item)) (ref field_declaration)) (repeat0 (seq (literal %2C) (seq (repeat0 (ref attribute_item)) (ref field_declaration)))))) (optional (literal %2C)) (literal %7D)) (concept grammar.field-declaration-list))
(rule field_declaration normal (seq (optional (ref visibility_modifier)) (capture labeled name (ref field_identifier_alias)) (literal %3A) (capture labeled type (ref type))) (concept grammar.field-declaration))
(rule ordered_field_declaration_list normal (seq (literal %28) (optional (seq (seq (repeat0 (ref attribute_item)) (optional (ref visibility_modifier)) (capture labeled type (ref type))) (repeat0 (seq (literal %2C) (seq (repeat0 (ref attribute_item)) (optional (ref visibility_modifier)) (capture labeled type (ref type))))))) (optional (literal %2C)) (literal %29)) (concept grammar.ordered-field-declaration-list))
(rule extern_crate_declaration normal (seq (optional (ref visibility_modifier)) (token (seq (literal extern) (not (ref word_characters)))) (ref crate) (capture labeled name (ref identifier)) (optional (seq (token (seq (literal as) (not (ref word_characters)))) (capture labeled alias (ref identifier)))) (literal %3B)) (concept grammar.extern-crate-declaration))
(rule constant_item normal (seq (optional (ref visibility_modifier)) (token (seq (literal const) (not (ref word_characters)))) (capture labeled name (ref identifier)) (literal %3A) (capture labeled type (ref type)) (optional (seq (literal %3D) (capture labeled value (ref expression)))) (literal %3B)) (concept grammar.constant-item) (source-names (tree-sitter const_item)))
(rule static_item normal (seq (optional (ref visibility_modifier)) (token (seq (literal static) (not (ref word_characters)))) (optional (token (seq (literal ref) (not (ref word_characters))))) (optional (ref mutable_specifier)) (capture labeled name (ref identifier)) (literal %3A) (capture labeled type (ref type)) (optional (seq (literal %3D) (capture labeled value (ref expression)))) (literal %3B)) (concept grammar.static-item))
(rule type_item normal (seq (optional (ref visibility_modifier)) (token (seq (literal type) (not (ref word_characters)))) (capture labeled name (ref type_identifier_alias)) (capture labeled type_parameters (optional (ref type_parameters))) (optional (ref where_clause)) (literal %3D) (capture labeled type (ref type)) (optional (ref where_clause)) (literal %3B)) (concept grammar.type-item))
(rule function_item normal (seq (optional (ref visibility_modifier)) (optional (ref function_modifiers)) (token (seq (literal fn) (not (ref word_characters)))) (capture labeled name (choice unordered (ref identifier) (ref metavariable))) (capture labeled type_parameters (optional (ref type_parameters))) (capture labeled parameters (ref parameters)) (optional (seq (literal -%3E) (capture labeled return_type (ref type)))) (optional (ref where_clause)) (capture labeled body (ref block))) (concept grammar.function-item))
(rule function_signature_item normal (seq (optional (ref visibility_modifier)) (optional (ref function_modifiers)) (token (seq (literal fn) (not (ref word_characters)))) (capture labeled name (choice unordered (ref identifier) (ref metavariable))) (capture labeled type_parameters (optional (ref type_parameters))) (capture labeled parameters (ref parameters)) (optional (seq (literal -%3E) (capture labeled return_type (ref type)))) (optional (ref where_clause)) (literal %3B)) (concept grammar.function-signature-item))
(rule function_modifiers normal (repeat1 (choice unordered (token (seq (literal async) (not (ref word_characters)))) (token (seq (literal default) (not (ref word_characters)))) (token (seq (literal const) (not (ref word_characters)))) (token (seq (literal unsafe) (not (ref word_characters)))) (ref extern_modifier))) (concept grammar.function-modifiers))
(rule where_clause normal (precedence 0 right (seq (token (seq (literal where) (not (ref word_characters)))) (optional (seq (seq (ref where_predicate) (repeat0 (seq (literal %2C) (ref where_predicate)))) (optional (literal %2C)))))) (concept grammar.where-clause))
(rule where_predicate normal (seq (capture labeled left (choice unordered (ref lifetime) (ref type_identifier_alias) (ref scoped_type_identifier) (ref generic_type) (ref reference_type) (ref pointer_type) (ref tuple_type) (ref unit_type) (ref array_type) (ref higher_ranked_trait_bound) (alias primitive_type (choice unordered (token (seq (literal u8) (not (ref word_characters)))) (token (seq (literal i8) (not (ref word_characters)))) (token (seq (literal u16) (not (ref word_characters)))) (token (seq (literal i16) (not (ref word_characters)))) (token (seq (literal u32) (not (ref word_characters)))) (token (seq (literal i32) (not (ref word_characters)))) (token (seq (literal u64) (not (ref word_characters)))) (token (seq (literal i64) (not (ref word_characters)))) (token (seq (literal u128) (not (ref word_characters)))) (token (seq (literal i128) (not (ref word_characters)))) (token (seq (literal isize) (not (ref word_characters)))) (token (seq (literal usize) (not (ref word_characters)))) (token (seq (literal f32) (not (ref word_characters)))) (token (seq (literal f64) (not (ref word_characters)))) (token (seq (literal bool) (not (ref word_characters)))) (token (seq (literal str) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters)))))))) (capture labeled bounds (ref trait_bounds))) (concept grammar.where-predicate))
(rule implementation_item normal (seq (optional (token (seq (literal unsafe) (not (ref word_characters))))) (token (seq (literal impl) (not (ref word_characters)))) (capture labeled type_parameters (optional (ref type_parameters))) (optional (seq (optional (literal %21)) (capture labeled trait (choice unordered (ref type_identifier_alias) (ref scoped_type_identifier) (ref generic_type))) (token (seq (literal for) (not (ref word_characters)))))) (capture labeled type (ref type)) (optional (ref where_clause)) (choice unordered (capture labeled body (ref declaration_list)) (literal %3B))) (concept grammar.implementation-item) (source-names (tree-sitter impl_item)))
(rule trait_item normal (seq (optional (ref visibility_modifier)) (optional (token (seq (literal unsafe) (not (ref word_characters))))) (token (seq (literal trait) (not (ref word_characters)))) (capture labeled name (ref type_identifier_alias)) (capture labeled type_parameters (optional (ref type_parameters))) (capture labeled bounds (optional (ref trait_bounds))) (optional (ref where_clause)) (capture labeled body (ref declaration_list))) (concept grammar.trait-item))
(rule associated_type normal (seq (token (seq (literal type) (not (ref word_characters)))) (capture labeled name (ref type_identifier_alias)) (capture labeled type_parameters (optional (ref type_parameters))) (capture labeled bounds (optional (ref trait_bounds))) (optional (ref where_clause)) (literal %3B)) (concept grammar.associated-type))
(rule trait_bounds normal (seq (literal %3A) (seq (choice unordered (ref type) (ref lifetime) (ref higher_ranked_trait_bound)) (repeat0 (seq (literal %2B) (choice unordered (ref type) (ref lifetime) (ref higher_ranked_trait_bound)))))) (concept grammar.trait-bounds))
(rule higher_ranked_trait_bound normal (seq (token (seq (literal for) (not (ref word_characters)))) (capture labeled type_parameters (ref type_parameters)) (capture labeled type (ref type))) (concept grammar.higher-ranked-trait-bound))
(rule removed_trait_bound normal (seq (literal %3F) (ref type)) (concept grammar.removed-trait-bound))
(rule type_parameters normal (precedence 1 none (seq (literal %3C) (seq (seq (repeat0 (ref attribute_item)) (choice unordered (ref metavariable) (ref type_parameter) (ref lifetime_parameter) (ref constant_parameter))) (repeat0 (seq (literal %2C) (seq (repeat0 (ref attribute_item)) (choice unordered (ref metavariable) (ref type_parameter) (ref lifetime_parameter) (ref constant_parameter)))))) (optional (literal %2C)) (literal %3E))) (concept grammar.type-parameter-list))
(rule constant_parameter normal (seq (token (seq (literal const) (not (ref word_characters)))) (capture labeled name (ref identifier)) (literal %3A) (capture labeled type (ref type)) (optional (seq (literal %3D) (capture labeled value (choice unordered (ref block) (ref identifier) (ref literal) (ref negative_literal)))))) (concept grammar.constant-parameter) (source-names (tree-sitter const_parameter)))
(rule type_parameter normal (precedence 1 none (seq (capture labeled name (ref type_identifier_alias)) (optional (capture labeled bounds (ref trait_bounds))) (optional (seq (literal %3D) (capture labeled default_type (ref type)))))) (concept grammar.type-parameter))
(rule lifetime_parameter normal (precedence 1 none (seq (capture labeled name (ref lifetime)) (optional (capture labeled bounds (ref trait_bounds))))) (concept grammar.lifetime-parameter))
(rule let_declaration normal (seq (token (seq (literal let) (not (ref word_characters)))) (optional (ref mutable_specifier)) (capture labeled pattern (ref pattern)) (optional (seq (literal %3A) (capture labeled type (ref type)))) (optional (seq (literal %3D) (capture labeled value (ref expression)))) (optional (seq (token (seq (literal else) (not (ref word_characters)))) (capture labeled alternative (ref block)))) (literal %3B)) (concept grammar.let-declaration))
(rule use_declaration normal (seq (optional (ref visibility_modifier)) (token (seq (literal use) (not (ref word_characters)))) (capture labeled argument (ref use_clause)) (literal %3B)) (concept grammar.use-declaration))
(rule use_clause silent (choice unordered (ref path) (ref use_as_clause) (ref use_list) (ref scoped_use_list) (ref use_wildcard)) (concept grammar.use-clause) (source-names (tree-sitter _use_clause)))
(rule scoped_use_list normal (seq (capture labeled path (optional (ref path))) (literal %3A%3A) (capture labeled list (ref use_list))) (concept grammar.scoped-use-list))
(rule use_list normal (seq (literal %7B) (optional (seq (ref use_clause) (repeat0 (seq (literal %2C) (ref use_clause))))) (optional (literal %2C)) (literal %7D)) (concept grammar.use-list))
(rule use_as_clause normal (seq (capture labeled path (ref path)) (token (seq (literal as) (not (ref word_characters)))) (capture labeled alias (ref identifier))) (concept grammar.use-as-clause))
(rule use_wildcard normal (seq (optional (seq (optional (ref path)) (literal %3A%3A))) (literal %2A)) (concept grammar.use-wildcard))
(rule parameters normal (seq (literal %28) (optional (seq (seq (optional (ref attribute_item)) (choice unordered (ref parameter) (ref self_parameter) (ref variadic_parameter) (token (seq (literal _) (not (ref word_characters)))) (ref type))) (repeat0 (seq (literal %2C) (seq (optional (ref attribute_item)) (choice unordered (ref parameter) (ref self_parameter) (ref variadic_parameter) (token (seq (literal _) (not (ref word_characters)))) (ref type))))))) (optional (literal %2C)) (literal %29)) (concept grammar.parameter-list))
(rule self_parameter normal (seq (optional (literal %26)) (optional (ref lifetime)) (optional (ref mutable_specifier)) (ref self)) (concept grammar.self-parameter))
(rule variadic_parameter normal (seq (optional (ref mutable_specifier)) (optional (seq (capture labeled pattern (ref pattern)) (literal %3A))) (literal ...)) (concept grammar.variadic-parameter))
(rule parameter normal (seq (optional (ref mutable_specifier)) (capture labeled pattern (choice unordered (ref pattern) (ref self))) (literal %3A) (capture labeled type (ref type))) (concept parameter))
(rule extern_modifier normal (seq (token (seq (literal extern) (not (ref word_characters)))) (optional (ref string_literal))) (concept grammar.extern-modifier))
(rule visibility_modifier normal (choice unordered (ref crate) (seq (token (seq (literal pub) (not (ref word_characters)))) (optional (seq (literal %28) (choice unordered (ref self) (ref super) (ref crate) (seq (token (seq (literal in) (not (ref word_characters)))) (ref path))) (literal %29))))) (concept grammar.visibility-modifier))
(rule type silent (choice unordered (ref abstract_type) (ref reference_type) (ref metavariable) (ref pointer_type) (ref generic_type) (ref scoped_type_identifier) (ref tuple_type) (ref unit_type) (ref array_type) (ref function_type) (ref type_identifier_alias) (ref macro_invocation) (ref never_type) (ref dynamic_type) (ref bounded_type) (ref removed_trait_bound) (alias primitive_type (choice unordered (token (seq (literal u8) (not (ref word_characters)))) (token (seq (literal i8) (not (ref word_characters)))) (token (seq (literal u16) (not (ref word_characters)))) (token (seq (literal i16) (not (ref word_characters)))) (token (seq (literal u32) (not (ref word_characters)))) (token (seq (literal i32) (not (ref word_characters)))) (token (seq (literal u64) (not (ref word_characters)))) (token (seq (literal i64) (not (ref word_characters)))) (token (seq (literal u128) (not (ref word_characters)))) (token (seq (literal i128) (not (ref word_characters)))) (token (seq (literal isize) (not (ref word_characters)))) (token (seq (literal usize) (not (ref word_characters)))) (token (seq (literal f32) (not (ref word_characters)))) (token (seq (literal f64) (not (ref word_characters)))) (token (seq (literal bool) (not (ref word_characters)))) (token (seq (literal str) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters))))))) (concept grammar.type) (source-names (tree-sitter _type)))
(rule bracketed_type normal (seq (literal %3C) (choice unordered (ref type) (ref qualified_type)) (literal %3E)) (concept grammar.bracketed-type))
(rule qualified_type normal (seq (capture labeled type (ref type)) (token (seq (literal as) (not (ref word_characters)))) (capture labeled alias (ref type))) (concept grammar.qualified-type))
(rule lifetime normal (precedence 1 none (seq (literal %27) (ref identifier))) (concept grammar.lifetime))
(rule array_type normal (seq (literal %5B) (capture labeled element (ref type)) (optional (seq (literal %3B) (capture labeled length (ref expression)))) (literal %5D)) (concept grammar.array-type))
(rule for_lifetimes normal (seq (token (seq (literal for) (not (ref word_characters)))) (literal %3C) (seq (ref lifetime) (repeat0 (seq (literal %2C) (ref lifetime)))) (optional (literal %2C)) (literal %3E)) (concept grammar.for-lifetimes))
(rule function_type normal (seq (optional (ref for_lifetimes)) (precedence 15 none (seq (choice unordered (capture labeled trait (choice unordered (ref type_identifier_alias) (ref scoped_type_identifier))) (seq (optional (ref function_modifiers)) (token (seq (literal fn) (not (ref word_characters)))))) (capture labeled parameters (ref parameters)))) (optional (seq (literal -%3E) (capture labeled return_type (ref type))))) (concept grammar.function-type))
(rule tuple_type normal (seq (literal %28) (seq (ref type) (repeat0 (seq (literal %2C) (ref type)))) (optional (literal %2C)) (literal %29)) (concept grammar.tuple-type))
(rule unit_type normal (seq (literal %28) (literal %29)) (concept grammar.unit-type))
(rule generic_function normal (precedence 1 none (seq (capture labeled function (choice unordered (ref identifier) (alias identifier (choice unordered (token (seq (literal u8) (not (ref word_characters)))) (token (seq (literal i8) (not (ref word_characters)))) (token (seq (literal u16) (not (ref word_characters)))) (token (seq (literal i16) (not (ref word_characters)))) (token (seq (literal u32) (not (ref word_characters)))) (token (seq (literal i32) (not (ref word_characters)))) (token (seq (literal u64) (not (ref word_characters)))) (token (seq (literal i64) (not (ref word_characters)))) (token (seq (literal u128) (not (ref word_characters)))) (token (seq (literal i128) (not (ref word_characters)))) (token (seq (literal isize) (not (ref word_characters)))) (token (seq (literal usize) (not (ref word_characters)))) (token (seq (literal f32) (not (ref word_characters)))) (token (seq (literal f64) (not (ref word_characters)))) (token (seq (literal bool) (not (ref word_characters)))) (token (seq (literal str) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters)))))) (ref scoped_identifier) (ref field_expression))) (literal %3A%3A) (capture labeled type_arguments (ref type_arguments)))) (concept grammar.generic-function))
(rule generic_type normal (precedence 1 none (seq (capture labeled type (choice unordered (ref type_identifier_alias) (ref reserved_identifier) (ref scoped_type_identifier))) (capture labeled type_arguments (ref type_arguments)))) (concept grammar.generic-type))
(rule generic_type_with_turbofish normal (seq (capture labeled type (choice unordered (ref type_identifier_alias) (ref scoped_identifier))) (literal %3A%3A) (capture labeled type_arguments (ref type_arguments))) (concept grammar.generic-type-with-turbofish))
(rule bounded_type normal (precedence -1 left (seq (choice unordered (ref lifetime) (ref type) (ref use_bounds)) (literal %2B) (choice unordered (ref lifetime) (ref type) (ref use_bounds)))) (concept grammar.bounded-type))
(rule use_bounds normal (seq (token (seq (literal use) (not (ref word_characters)))) (token (lexicalPrecedence 1 (literal %3C))) (optional (seq (choice unordered (ref lifetime) (ref type_identifier_alias)) (repeat0 (seq (literal %2C) (choice unordered (ref lifetime) (ref type_identifier_alias)))))) (optional (literal %2C)) (literal %3E)) (concept grammar.use-bounds))
(rule type_arguments normal (seq (token (lexicalPrecedence 1 (literal %3C))) (seq (seq (choice unordered (ref type) (ref type_binding) (ref lifetime) (ref literal) (ref block)) (optional (ref trait_bounds))) (repeat0 (seq (literal %2C) (seq (choice unordered (ref type) (ref type_binding) (ref lifetime) (ref literal) (ref block)) (optional (ref trait_bounds)))))) (optional (literal %2C)) (literal %3E)) (concept grammar.type-argument-list))
(rule type_binding normal (seq (capture labeled name (ref type_identifier_alias)) (capture labeled type_arguments (optional (ref type_arguments))) (literal %3D) (capture labeled type (ref type))) (concept grammar.type-binding))
(rule reference_type normal (seq (literal %26) (optional (ref lifetime)) (optional (ref mutable_specifier)) (capture labeled type (ref type))) (concept grammar.reference-type))
(rule pointer_type normal (seq (literal %2A) (choice unordered (token (seq (literal const) (not (ref word_characters)))) (ref mutable_specifier)) (capture labeled type (ref type))) (concept grammar.pointer-type))
(rule never_type normal (literal %21) (concept grammar.never-type))
(rule abstract_type normal (seq (token (seq (literal impl) (not (ref word_characters)))) (optional (seq (token (seq (literal for) (not (ref word_characters)))) (ref type_parameters))) (capture labeled trait (precedence 1 none (choice unordered (ref type_identifier_alias) (ref scoped_type_identifier) (ref removed_trait_bound) (ref generic_type) (ref function_type) (ref tuple_type) (ref bounded_type))))) (concept grammar.abstract-type))
(rule dynamic_type normal (seq (token (seq (literal dyn) (not (ref word_characters)))) (capture labeled trait (choice unordered (ref higher_ranked_trait_bound) (ref type_identifier_alias) (ref scoped_type_identifier) (ref generic_type) (ref function_type) (ref tuple_type)))) (concept grammar.dynamic-type))
(rule mutable_specifier token (seq (literal mut) (not (ref word_characters))) (concept grammar.mutable-specifier))
(rule expression_except_range silent (choice unordered (ref unary_expression) (ref reference_expression) (ref try_expression) (ref binary_expression) (ref assignment_expression) (ref compound_assignment_expression) (ref type_cast_expression) (ref call_expression) (ref return_expression) (ref yield_expression) (ref literal) (precedence 0 left (ref identifier)) (alias identifier (choice unordered (token (seq (literal u8) (not (ref word_characters)))) (token (seq (literal i8) (not (ref word_characters)))) (token (seq (literal u16) (not (ref word_characters)))) (token (seq (literal i16) (not (ref word_characters)))) (token (seq (literal u32) (not (ref word_characters)))) (token (seq (literal i32) (not (ref word_characters)))) (token (seq (literal u64) (not (ref word_characters)))) (token (seq (literal i64) (not (ref word_characters)))) (token (seq (literal u128) (not (ref word_characters)))) (token (seq (literal i128) (not (ref word_characters)))) (token (seq (literal isize) (not (ref word_characters)))) (token (seq (literal usize) (not (ref word_characters)))) (token (seq (literal f32) (not (ref word_characters)))) (token (seq (literal f64) (not (ref word_characters)))) (token (seq (literal bool) (not (ref word_characters)))) (token (seq (literal str) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters)))))) (precedence 0 left (ref reserved_identifier)) (ref self) (ref scoped_identifier) (ref generic_function) (ref await_expression) (ref field_expression) (ref array_expression) (ref tuple_expression) (precedence 1 none (ref macro_invocation)) (ref unit_expression) (ref break_expression) (ref continue_expression) (ref index_expression) (ref metavariable) (ref closure_expression) (ref parenthesized_expression) (ref structure_expression) (ref expression_ending_with_block)) (concept grammar.expression-except-range) (source-names (tree-sitter _expression_except_range)))
(rule expression silent (choice unordered (ref expression_except_range) (ref range_expression)) (concept grammar.expression) (source-names (tree-sitter _expression)))
(rule expression_ending_with_block silent (choice unordered (ref unsafe_block) (ref asynchronous_block) (ref generator_block) (ref try_block) (ref block) (ref if_expression) (ref match_expression) (ref while_expression) (ref loop_expression) (ref for_expression) (ref constant_block)) (concept grammar.expression-ending-with-block) (source-names (tree-sitter _expression_ending_with_block)))
(rule macro_invocation normal (seq (capture labeled macro (choice unordered (ref scoped_identifier) (ref identifier) (ref reserved_identifier) (alias identifier (token (seq (literal try) (not (ref word_characters))))))) (literal %21) (alias token_tree (ref delimited_token_tree))) (concept grammar.macro-invocation))
(rule delimited_token_tree normal (choice unordered (seq (literal %28) (repeat0 (ref delimited_tokens)) (literal %29)) (seq (literal %5B) (repeat0 (ref delimited_tokens)) (literal %5D)) (seq (literal %7B) (repeat0 (ref delimited_tokens)) (literal %7D))) (concept grammar.delimited-token-tree) (source-names (tree-sitter delim_token_tree)))
(rule delimited_tokens silent (choice unordered (ref non_delimited_token) (alias token_tree (ref delimited_token_tree))) (concept grammar.delimited-tokens) (source-names (tree-sitter _delim_tokens)))
(rule non_delimited_token silent (choice unordered (ref non_special_token) (literal %24)) (concept grammar.non-delimited-token) (source-names (tree-sitter _non_delim_token)))
(rule scoped_identifier normal (seq (capture labeled path (optional (choice unordered (ref path) (ref bracketed_type) (alias generic_type (ref generic_type_with_turbofish))))) (literal %3A%3A) (capture labeled name (choice unordered (ref identifier) (ref super)))) (concept grammar.scoped-identifier))
(rule scoped_type_identifier_in_expression_position normal (precedence -2 none (seq (capture labeled path (optional (choice unordered (ref path) (alias generic_type (ref generic_type_with_turbofish))))) (literal %3A%3A) (capture labeled name (ref type_identifier_alias)))) (concept grammar.scoped-type-identifier-in-expression-position))
(rule scoped_type_identifier normal (seq (capture labeled path (optional (choice unordered (ref path) (alias generic_type (ref generic_type_with_turbofish)) (ref bracketed_type) (ref generic_type)))) (literal %3A%3A) (capture labeled name (ref type_identifier_alias))) (concept grammar.scoped-type-identifier))
(rule range_expression normal (precedence 1 left (choice unordered (seq (ref expression) (choice unordered (literal ..) (literal ...) (literal ..%3D)) (ref expression)) (seq (ref expression) (literal ..)) (seq (literal ..) (ref expression)) (literal ..))) (concept grammar.range-expression))
(rule unary_expression normal (precedence 12 none (seq (choice unordered (literal -) (literal %2A) (literal %21)) (ref expression))) (concept grammar.unary-expression))
(rule try_expression normal (precedence 13 none (seq (ref expression) (literal %3F))) (concept grammar.try-expression))
(rule reference_expression normal (precedence 12 none (seq (literal %26) (choice unordered (seq (token (seq (literal raw) (not (ref word_characters)))) (choice unordered (token (seq (literal const) (not (ref word_characters)))) (ref mutable_specifier))) (optional (ref mutable_specifier))) (capture labeled value (ref expression)))) (concept grammar.reference-expression))
(rule binary_expression normal (choice unordered (precedence 3 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %26%26)) (capture labeled right (ref expression)))) (precedence 2 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %7C%7C)) (capture labeled right (ref expression)))) (precedence 7 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %26)) (capture labeled right (ref expression)))) (precedence 5 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %7C)) (capture labeled right (ref expression)))) (precedence 6 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %5E)) (capture labeled right (ref expression)))) (precedence 4 left (seq (capture labeled left (ref expression)) (capture labeled operator (choice unordered (literal %3D%3D) (literal %21%3D) (literal %3C) (token (lexicalPrecedence 1 (literal %3C%3D))) (literal %3E) (literal %3E%3D))) (capture labeled right (ref expression)))) (precedence 8 left (seq (capture labeled left (ref expression)) (capture labeled operator (choice unordered (literal %3C%3C) (literal %3E%3E))) (capture labeled right (ref expression)))) (precedence 9 left (seq (capture labeled left (ref expression)) (capture labeled operator (choice unordered (literal %2B) (literal -))) (capture labeled right (ref expression)))) (precedence 10 left (seq (capture labeled left (ref expression)) (capture labeled operator (choice unordered (literal %2A) (literal %2F) (literal %25))) (capture labeled right (ref expression))))) (concept grammar.binary-expression))
(rule assignment_expression normal (precedence 0 left (seq (capture labeled left (ref expression)) (literal %3D) (capture labeled right (ref expression)))) (concept grammar.assignment-expression))
(rule compound_assignment_expression normal (precedence 0 left (seq (capture labeled left (ref expression)) (capture labeled operator (choice unordered (literal %2B%3D) (literal -%3D) (literal %2A%3D) (literal %2F%3D) (literal %25%3D) (literal %26%3D) (literal %7C%3D) (literal %5E%3D) (literal %3C%3C%3D) (literal %3E%3E%3D))) (capture labeled right (ref expression)))) (concept grammar.compound-assignment-expression) (source-names (tree-sitter compound_assignment_expr)))
(rule type_cast_expression normal (precedence 11 left (seq (capture labeled value (ref expression)) (token (seq (literal as) (not (ref word_characters)))) (capture labeled type (ref type)))) (concept grammar.type-cast-expression))
(rule return_expression normal (choice unordered (precedence 0 left (seq (token (seq (literal return) (not (ref word_characters)))) (ref expression))) (precedence -1 none (token (seq (literal return) (not (ref word_characters)))))) (concept grammar.return-expression))
(rule yield_expression normal (choice unordered (precedence 0 left (seq (token (seq (literal yield) (not (ref word_characters)))) (ref expression))) (precedence -1 none (token (seq (literal yield) (not (ref word_characters)))))) (concept grammar.yield-expression))
(rule call_expression normal (precedence 15 none (seq (capture labeled function (ref expression_except_range)) (capture labeled arguments (ref arguments)))) (concept grammar.call-expression))
(rule arguments normal (seq (literal %28) (optional (seq (seq (repeat0 (ref attribute_item)) (ref expression)) (repeat0 (seq (literal %2C) (seq (repeat0 (ref attribute_item)) (ref expression)))))) (optional (literal %2C)) (literal %29)) (concept grammar.argument-list))
(rule array_expression normal (seq (literal %5B) (repeat0 (ref attribute_item)) (choice unordered (seq (ref expression) (literal %3B) (capture labeled length (ref expression))) (seq (optional (seq (seq (repeat0 (ref attribute_item)) (ref expression)) (repeat0 (seq (literal %2C) (seq (repeat0 (ref attribute_item)) (ref expression)))))) (optional (literal %2C)))) (literal %5D)) (concept grammar.array-expression))
(rule parenthesized_expression normal (seq (literal %28) (ref expression) (literal %29)) (concept grammar.parenthesized-expression))
(rule tuple_expression normal (seq (literal %28) (repeat0 (ref attribute_item)) (seq (ref expression) (literal %2C)) (repeat0 (seq (repeat0 (ref attribute_item)) (ref expression) (literal %2C))) (optional (seq (repeat0 (ref attribute_item)) (ref expression))) (literal %29)) (concept grammar.tuple-expression))
(rule unit_expression normal (seq (literal %28) (literal %29)) (concept grammar.unit-expression))
(rule structure_expression normal (seq (capture labeled name (choice unordered (ref type_identifier_alias) (alias scoped_type_identifier (ref scoped_type_identifier_in_expression_position)) (ref generic_type_with_turbofish))) (capture labeled body (ref field_initializer_list))) (concept grammar.structure-expression) (source-names (tree-sitter struct_expression)))
(rule field_initializer_list normal (seq (literal %7B) (optional (seq (choice unordered (ref shorthand_field_initializer) (ref field_initializer) (ref base_field_initializer)) (repeat0 (seq (literal %2C) (choice unordered (ref shorthand_field_initializer) (ref field_initializer) (ref base_field_initializer)))))) (optional (literal %2C)) (literal %7D)) (concept grammar.field-initializer-list))
(rule shorthand_field_initializer normal (seq (repeat0 (ref attribute_item)) (ref identifier)) (concept grammar.shorthand-field-initializer))
(rule field_initializer normal (seq (repeat0 (ref attribute_item)) (capture labeled field (choice unordered (ref field_identifier_alias) (ref integer_literal))) (literal %3A) (capture labeled value (ref expression))) (concept grammar.field-initializer))
(rule base_field_initializer normal (seq (literal ..) (ref expression)) (concept grammar.base-field-initializer))
(rule if_expression normal (precedence 0 right (seq (token (seq (literal if) (not (ref word_characters)))) (capture labeled condition (ref condition)) (capture labeled consequence (ref block)) (optional (capture labeled alternative (ref else_clause))))) (concept grammar.if-expression))
(rule let_condition normal (seq (token (seq (literal let) (not (ref word_characters)))) (capture labeled pattern (ref pattern)) (literal %3D) (capture labeled value (precedence 3 left (ref expression)))) (concept grammar.let-condition))
(rule let_chain_alias silent (precedence 3 left (choice unordered (seq (ref let_chain_alias) (literal %26%26) (ref let_condition)) (seq (ref let_chain_alias) (literal %26%26) (ref expression)) (seq (ref let_condition) (literal %26%26) (ref expression)) (seq (ref let_condition) (literal %26%26) (ref let_condition)) (seq (ref expression) (literal %26%26) (ref let_condition)))) (concept grammar.let-chain-alias) (source-names (tree-sitter _let_chain)))
(rule condition silent (choice unordered (ref expression) (ref let_condition) (alias let_chain (ref let_chain_alias))) (concept grammar.condition) (source-names (tree-sitter _condition)))
(rule else_clause normal (seq (token (seq (literal else) (not (ref word_characters)))) (choice unordered (ref block) (ref if_expression))) (concept grammar.else-clause))
(rule match_expression normal (seq (token (seq (literal match) (not (ref word_characters)))) (capture labeled value (ref expression)) (capture labeled body (ref match_block))) (concept grammar.match-expression))
(rule match_block normal (seq (literal %7B) (optional (seq (repeat0 (ref match_arm)) (alias match_arm (ref last_match_arm)))) (literal %7D)) (concept grammar.match-block))
(rule match_arm normal (precedence 0 right (seq (repeat0 (choice unordered (ref attribute_item) (ref inner_attribute_item))) (capture labeled pattern (ref match_pattern)) (literal %3D%3E) (choice unordered (seq (capture labeled value (ref expression)) (literal %2C)) (capture labeled value (precedence 1 none (ref expression_ending_with_block)))))) (concept grammar.match-arm))
(rule last_match_arm normal (seq (repeat0 (choice unordered (ref attribute_item) (ref inner_attribute_item))) (capture labeled pattern (ref match_pattern)) (literal %3D%3E) (capture labeled value (ref expression)) (optional (literal %2C))) (concept grammar.last-match-arm))
(rule match_pattern normal (seq (ref pattern) (optional (seq (token (seq (literal if) (not (ref word_characters)))) (capture labeled condition (ref condition))))) (concept grammar.match-pattern))
(rule while_expression normal (seq (optional (seq (ref label) (literal %3A))) (token (seq (literal while) (not (ref word_characters)))) (capture labeled condition (ref condition)) (capture labeled body (ref block))) (concept grammar.while-expression))
(rule loop_expression normal (seq (optional (seq (ref label) (literal %3A))) (token (seq (literal loop) (not (ref word_characters)))) (capture labeled body (ref block))) (concept grammar.loop-expression))
(rule for_expression normal (seq (optional (seq (ref label) (literal %3A))) (token (seq (literal for) (not (ref word_characters)))) (capture labeled pattern (ref pattern)) (token (seq (literal in) (not (ref word_characters)))) (capture labeled value (ref expression)) (capture labeled body (ref block))) (concept grammar.for-expression))
(rule constant_block normal (seq (token (seq (literal const) (not (ref word_characters)))) (capture labeled body (ref block))) (concept grammar.constant-block) (source-names (tree-sitter const_block)))
(rule closure_expression normal (precedence -1 none (seq (optional (token (seq (literal static) (not (ref word_characters))))) (optional (token (seq (literal async) (not (ref word_characters))))) (optional (token (seq (literal move) (not (ref word_characters))))) (capture labeled parameters (ref closure_parameters)) (choice unordered (seq (optional (seq (literal -%3E) (capture labeled return_type (ref type)))) (capture labeled body (ref block))) (capture labeled body (choice unordered (ref expression) (token (seq (literal _) (not (ref word_characters))))))))) (concept grammar.closure-expression))
(rule closure_parameters normal (seq (literal %7C) (optional (seq (choice unordered (ref pattern) (ref parameter)) (repeat0 (seq (literal %2C) (choice unordered (ref pattern) (ref parameter)))))) (literal %7C)) (concept grammar.closure-parameters))
(rule label normal (seq (literal %27) (ref identifier)) (concept grammar.label))
(rule break_expression normal (precedence 0 left (seq (token (seq (literal break) (not (ref word_characters)))) (optional (ref label)) (optional (ref expression)))) (concept grammar.break-expression))
(rule continue_expression normal (precedence 0 left (seq (token (seq (literal continue) (not (ref word_characters)))) (optional (ref label)))) (concept grammar.continue-expression))
(rule index_expression normal (precedence 15 none (seq (ref expression) (literal %5B) (ref expression) (literal %5D))) (concept grammar.index-expression))
(rule await_expression normal (precedence 14 none (seq (ref expression) (literal .) (token (seq (literal await) (not (ref word_characters)))))) (concept grammar.await-expression))
(rule field_expression normal (precedence 14 none (seq (capture labeled value (ref expression)) (literal .) (capture labeled field (choice unordered (ref field_identifier_alias) (ref integer_literal))))) (concept grammar.field-expression))
(rule unsafe_block normal (seq (token (seq (literal unsafe) (not (ref word_characters)))) (ref block)) (concept grammar.unsafe-block))
(rule asynchronous_block normal (seq (token (seq (literal async) (not (ref word_characters)))) (optional (token (seq (literal move) (not (ref word_characters))))) (ref block)) (concept grammar.asynchronous-block) (source-names (tree-sitter async_block)))
(rule generator_block normal (seq (token (seq (literal gen) (not (ref word_characters)))) (optional (token (seq (literal move) (not (ref word_characters))))) (ref block)) (concept grammar.generator-block) (source-names (tree-sitter gen_block)))
(rule try_block normal (seq (token (seq (literal try) (not (ref word_characters)))) (ref block)) (concept grammar.try-block))
(rule block normal (seq (optional (seq (ref label) (literal %3A))) (literal %7B) (repeat0 (ref statement)) (optional (ref expression)) (literal %7D)) (concept grammar.block))
(rule pattern silent (choice unordered (ref literal_pattern) (alias identifier (choice unordered (token (seq (literal u8) (not (ref word_characters)))) (token (seq (literal i8) (not (ref word_characters)))) (token (seq (literal u16) (not (ref word_characters)))) (token (seq (literal i16) (not (ref word_characters)))) (token (seq (literal u32) (not (ref word_characters)))) (token (seq (literal i32) (not (ref word_characters)))) (token (seq (literal u64) (not (ref word_characters)))) (token (seq (literal i64) (not (ref word_characters)))) (token (seq (literal u128) (not (ref word_characters)))) (token (seq (literal i128) (not (ref word_characters)))) (token (seq (literal isize) (not (ref word_characters)))) (token (seq (literal usize) (not (ref word_characters)))) (token (seq (literal f32) (not (ref word_characters)))) (token (seq (literal f64) (not (ref word_characters)))) (token (seq (literal bool) (not (ref word_characters)))) (token (seq (literal str) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters)))))) (ref identifier) (ref scoped_identifier) (ref generic_pattern) (ref tuple_pattern) (ref tuple_structure_pattern) (ref structure_pattern) (ref reserved_identifier) (ref by_reference_pattern) (ref slice_pattern) (ref captured_pattern) (ref reference_pattern) (ref remaining_field_pattern) (ref mutable_pattern) (ref range_pattern) (ref or_pattern) (ref constant_block) (ref macro_invocation) (token (seq (literal _) (not (ref word_characters))))) (concept grammar.pattern) (source-names (tree-sitter _pattern)))
(rule generic_pattern normal (seq (choice unordered (ref identifier) (ref scoped_identifier)) (literal %3A%3A) (capture labeled type_arguments (ref type_arguments))) (concept grammar.generic-pattern))
(rule tuple_pattern normal (seq (literal %28) (optional (seq (choice unordered (ref pattern) (ref closure_expression)) (repeat0 (seq (literal %2C) (choice unordered (ref pattern) (ref closure_expression)))))) (optional (literal %2C)) (literal %29)) (concept grammar.tuple-pattern))
(rule slice_pattern normal (seq (literal %5B) (optional (seq (ref pattern) (repeat0 (seq (literal %2C) (ref pattern))))) (optional (literal %2C)) (literal %5D)) (concept grammar.slice-pattern))
(rule tuple_structure_pattern normal (seq (capture labeled type (choice unordered (ref identifier) (ref scoped_identifier) (alias generic_type (ref generic_type_with_turbofish)))) (literal %28) (optional (seq (ref pattern) (repeat0 (seq (literal %2C) (ref pattern))))) (optional (literal %2C)) (literal %29)) (concept grammar.tuple-structure-pattern) (source-names (tree-sitter tuple_struct_pattern)))
(rule structure_pattern normal (seq (capture labeled type (choice unordered (ref type_identifier_alias) (ref scoped_type_identifier))) (literal %7B) (optional (seq (choice unordered (ref field_pattern) (ref remaining_field_pattern)) (repeat0 (seq (literal %2C) (choice unordered (ref field_pattern) (ref remaining_field_pattern)))))) (optional (literal %2C)) (literal %7D)) (concept grammar.structure-pattern) (source-names (tree-sitter struct_pattern)))
(rule field_pattern normal (seq (repeat0 (ref attribute_item)) (optional (token (seq (literal ref) (not (ref word_characters))))) (optional (ref mutable_specifier)) (choice unordered (capture labeled name (alias shorthand_field_identifier (ref identifier))) (seq (capture labeled name (ref field_identifier_alias)) (literal %3A) (capture labeled pattern (ref pattern))))) (concept grammar.field-pattern))
(rule remaining_field_pattern normal (literal ..) (concept grammar.remaining-field-pattern))
(rule mutable_pattern normal (precedence -1 none (seq (ref mutable_specifier) (ref pattern))) (concept grammar.mutable-pattern) (source-names (tree-sitter mut_pattern)))
(rule range_pattern normal (choice unordered (seq (capture labeled left (choice unordered (ref literal_pattern) (ref path))) (choice unordered (seq (choice unordered (literal ...) (literal ..%3D) (literal ..)) (capture labeled right (choice unordered (ref literal_pattern) (ref path)))) (literal ..))) (seq (choice unordered (literal ..%3D) (literal ..)) (capture labeled right (choice unordered (ref literal_pattern) (ref path))))) (concept grammar.range-pattern))
(rule by_reference_pattern normal (seq (token (seq (literal ref) (not (ref word_characters)))) (ref pattern)) (concept grammar.by-reference-pattern) (source-names (tree-sitter ref_pattern)))
(rule captured_pattern normal (seq (ref identifier) (literal %40) (ref pattern)) (concept grammar.captured-pattern))
(rule reference_pattern normal (seq (literal %26) (optional (ref mutable_specifier)) (ref pattern)) (concept grammar.reference-pattern))
(rule or_pattern normal (precedence -2 left (choice unordered (seq (ref pattern) (literal %7C) (ref pattern)) (seq (literal %7C) (ref pattern)))) (concept grammar.or-pattern))
(rule literal silent (choice unordered (ref string_literal) (ref raw_string_literal) (ref character_literal) (ref boolean_literal) (ref integer_literal) (ref float_literal)) (concept grammar.literal) (source-names (tree-sitter _literal)))
(rule literal_pattern silent (choice unordered (ref string_literal) (ref raw_string_literal) (ref character_literal) (ref boolean_literal) (ref integer_literal) (ref float_literal) (ref negative_literal)) (concept grammar.literal-pattern) (source-names (tree-sitter _literal_pattern)))
(rule negative_literal normal (seq (literal -) (choice unordered (ref integer_literal) (ref float_literal))) (concept grammar.negative-literal))
(rule integer_literal token (seq (choice unordered (seq (class plain (range 0 9)) (repeat0 (class plain (range 0 9) (char _)))) (seq (literal 0x) (repeat1 (class plain (range 0 9) (range a f) (range A F) (char _)))) (seq (literal 0b) (repeat1 (class plain (char 0) (char 1) (char _)))) (seq (literal 0o) (repeat1 (class plain (range 0 7) (char _))))) (optional (choice unordered (literal u8) (literal i8) (literal u16) (literal i16) (literal u32) (literal i32) (literal u64) (literal i64) (literal u128) (literal i128) (literal isize) (literal usize) (literal f32) (literal f64)))) (concept grammar.integer-literal))
(rule string_literal normal (seq (alias %27%22 (token (seq (optional (class plain (char b) (char c))) (literal %22)))) (repeat0 (choice unordered (ref escape_sequence) (alias string_content (immediateToken (ref string_content))))) (alias %27%22 (immediateToken (ref string_close)))) (concept grammar.string-literal))
(rule raw_string_literal normal (seq (alias unnamed_token (ref raw_string_literal_start)) (alias string_content (immediateToken (ref raw_string_literal_content))) (alias unnamed_token (immediateToken (ref raw_string_literal_end)))) (concept grammar.raw-string-literal))
(rule character_literal token (seq (optional (literal b)) (literal %27) (optional (choice unordered (seq (literal %5C) (choice unordered (class negated (char x) (char u)) (seq (literal u) (repeat 4 4 (class plain (range 0 9) (range a f) (range A F)))) (seq (literal u%7B) (repeat1 (class plain (range 0 9) (range a f) (range A F))) (literal %7D)) (seq (literal x) (repeat 2 2 (class plain (range 0 9) (range a f) (range A F)))))) (class negated (char %5C) (char %27)))) (literal %27)) (concept grammar.character-literal) (source-names (tree-sitter char_literal)))
(rule escape_sequence silent (alias escape_sequence (immediateToken (seq (literal %5C) (choice unordered (class negated (char x) (char u)) (seq (literal u) (repeat 4 4 (class plain (range 0 9) (range a f) (range A F)))) (seq (literal u%7B) (repeat1 (class plain (range 0 9) (range a f) (range A F))) (literal %7D)) (seq (literal x) (repeat 2 2 (class plain (range 0 9) (range a f) (range A F)))))))) (concept grammar.escape-sequence))
(rule boolean_literal normal (choice unordered (token (seq (literal true) (not (ref word_characters)))) (token (seq (literal false) (not (ref word_characters))))) (concept grammar.boolean-literal))
(rule comment normal (choice unordered (ref line_comment) (ref block_comment)) (concept grammar.comment))
(rule line_comment normal (seq (literal %2F%2F) (choice unordered (seq (alias unnamed_token (immediateToken (lexicalPrecedence 2 (seq (literal %2F) (literal %2F))))) (alias unnamed_token (token (repeat0 (class negated (char %0A)))))) (seq (ref line_documentation_comment_marker) (capture labeled doc (alias documentation_comment (immediateToken (ref line_documentation_content))))) (alias unnamed_token (immediateToken (lexicalPrecedence 1 (repeat0 (class negated (char %0A)))))))) (concept grammar.line-comment))
(rule line_documentation_comment_marker silent (choice unordered (capture labeled outer (alias outer_documentation_comment_marker (ref outer_line_documentation_comment_marker))) (capture labeled inner (alias inner_documentation_comment_marker (ref inner_line_documentation_comment_marker)))) (concept grammar.line-documentation-comment-marker) (source-names (tree-sitter _line_doc_comment_marker)))
(rule inner_line_documentation_comment_marker silent (immediateToken (lexicalPrecedence 2 (literal %21))) (concept grammar.inner-line-documentation-comment-marker) (source-names (tree-sitter _inner_line_doc_comment_marker)))
(rule outer_line_documentation_comment_marker silent (immediateToken (lexicalPrecedence 2 (literal %2F))) (concept grammar.outer-line-documentation-comment-marker) (source-names (tree-sitter _outer_line_doc_comment_marker)))
(rule block_comment normal (seq (literal %2F%2A) (optional (choice unordered (seq (ref block_documentation_comment_marker) (optional (capture labeled doc (alias documentation_comment (immediateToken (ref block_comment_content)))))) (alias unnamed_token (immediateToken (ref block_comment_content))))) (literal %2A%2F)) (concept grammar.block-comment))
(rule block_documentation_comment_marker silent (choice unordered (capture labeled outer (alias outer_documentation_comment_marker (immediateToken (ref outer_block_documentation_comment_marker)))) (capture labeled inner (alias inner_documentation_comment_marker (immediateToken (ref inner_block_documentation_comment_marker))))) (concept grammar.block-documentation-comment-marker) (source-names (tree-sitter _block_doc_comment_marker)))
(rule path silent (choice unordered (ref self) (alias identifier (choice unordered (token (seq (literal u8) (not (ref word_characters)))) (token (seq (literal i8) (not (ref word_characters)))) (token (seq (literal u16) (not (ref word_characters)))) (token (seq (literal i16) (not (ref word_characters)))) (token (seq (literal u32) (not (ref word_characters)))) (token (seq (literal i32) (not (ref word_characters)))) (token (seq (literal u64) (not (ref word_characters)))) (token (seq (literal i64) (not (ref word_characters)))) (token (seq (literal u128) (not (ref word_characters)))) (token (seq (literal i128) (not (ref word_characters)))) (token (seq (literal isize) (not (ref word_characters)))) (token (seq (literal usize) (not (ref word_characters)))) (token (seq (literal f32) (not (ref word_characters)))) (token (seq (literal f64) (not (ref word_characters)))) (token (seq (literal bool) (not (ref word_characters)))) (token (seq (literal str) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters)))))) (ref metavariable) (ref super) (ref crate) (ref identifier) (ref scoped_identifier) (ref reserved_identifier)) (concept grammar.path) (source-names (tree-sitter _path)))
(rule identifier token (seq (optional (literal r%23)) (class plain (char _) (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl)) (repeat0 (class plain (char _) (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl) (category Mn) (category Mc) (category Nd) (category Pc)))) (concept grammar.identifier))
(rule shebang token (seq (literal %23%21) (repeat0 (class plain (char %0D) (char %0C) (char %09) (char %0B) (char %20))) (optional (seq (class negated (char %5B) (char %0A)) (repeat0 (class negated (char %0A))))) (literal %0A)) (concept grammar.shebang))
(rule frontmatter token (seq (seq (literal ---) (repeat0 (class negated (char %0A))) (literal %0A)) (repeat0 (choice unordered (seq (choice unordered (class negated (char -) (char %0A)) (seq (literal -) (class negated (char -) (char %0A))) (seq (literal --) (class negated (char -) (char %0A)))) (repeat0 (class negated (char %0A))) (literal %0A)) (seq (optional (literal -)) (optional (literal -)) (optional (literal %0D)) (literal %0A)))) (seq (literal ---) (repeat0 (class plain (char %20) (char %09))))) (concept grammar.frontmatter))
(rule reserved_identifier silent (alias identifier (choice unordered (token (seq (literal default) (not (ref word_characters)))) (token (seq (literal union) (not (ref word_characters)))) (token (seq (literal gen) (not (ref word_characters)))) (token (seq (literal raw) (not (ref word_characters)))))) (concept grammar.reserved-identifier) (source-names (tree-sitter _reserved_identifier)))
(rule type_identifier_alias silent (alias type_identifier (ref identifier)) (concept grammar.type-identifier-alias) (source-names (tree-sitter _type_identifier)))
(rule field_identifier_alias silent (alias field_identifier (ref identifier)) (concept grammar.field-identifier-alias) (source-names (tree-sitter _field_identifier)))
(rule self token (seq (literal self) (not (ref word_characters))) (concept grammar.self))
(rule super token (seq (literal super) (not (ref word_characters))) (concept grammar.super))
(rule crate token (seq (literal crate) (not (ref word_characters))) (concept grammar.crate))
(rule metavariable token (seq (literal %24) (class plain (range a z) (range A Z) (char _)) (repeat0 (class plain (range a z) (range A Z) (range 0 9) (char _)))) (concept grammar.metavariable))
(rule word_characters token (seq (optional (literal r%23)) (class plain (char _) (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl)) (repeat0 (class plain (char _) (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl) (category Mn) (category Mc) (category Nd) (category Pc)))) (concept grammar.word-characters))