meta-language 1.0.0

A self-describing links-network core for lossless language representation
Documentation
(grammar (start program) (matching longest) (settling tokens precedence dynamic ambiguity))
(extra (ref line_comment))
(extra (ref block_comment))
(extra (class plain (char %20) (char %09) (char %0A) (char %0D) (char %0C) (char %0B)))
(conflict modifiers annotated_type receiver_parameter)
(conflict modifiers annotated_type module_declaration package_declaration)
(conflict unannotated_type primary_expression inferred_parameters)
(conflict unannotated_type primary_expression)
(conflict unannotated_type primary_expression scoped_type_identifier)
(conflict unannotated_type scoped_type_identifier)
(conflict unannotated_type generic_type)
(conflict generic_type primary_expression)
(conflict expression statement)
(conflict lambda_expression primary_expression)
(conflict inferred_parameters primary_expression)
(conflict argument_list record_pattern_body)
(conflict yield_statement reserved_identifier)
(kind text_block_fragment (source-names (tree-sitter multiline_string_fragment)))
(rule program normal (repeat0 (ref top_level_statement)) (concept grammar.program))
(rule top_level_statement silent (choice unordered (ref statement) (ref method_declaration)) (concept grammar.top-level-statement) (source-names (tree-sitter _toplevel_statement)))
(rule literal silent (choice unordered (ref decimal_integer_literal) (ref hex_integer_literal) (ref octal_integer_literal) (ref binary_integer_literal) (ref decimal_floating_point_literal) (ref hex_floating_point_literal) (ref true) (ref false) (ref character_literal) (ref string_literal) (ref null_literal)) (concept grammar.literal) (source-names (tree-sitter _literal)))
(rule decimal_integer_literal token (seq (choice unordered (literal 0) (seq (class plain (range 1 9)) (optional (seq (optional (literal _)) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (repeat1 (literal _)) (repeat1 (class plain (range 0 9)))))))))) (optional (choice unordered (literal l) (literal L)))) (concept grammar.decimal-integer-literal))
(rule hex_integer_literal token (seq (choice unordered (literal 0x) (literal 0X)) (seq (repeat1 (class plain (range A F) (range a f) (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range A F) (range a f) (range 0 9)))))) (optional (choice unordered (literal l) (literal L)))) (concept grammar.hex-integer-literal))
(rule octal_integer_literal token (seq (choice unordered (literal 0o) (literal 0O) (literal 0)) (seq (repeat1 (class plain (range 0 7))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 7)))))) (optional (choice unordered (literal l) (literal L)))) (concept grammar.octal-integer-literal))
(rule binary_integer_literal token (seq (choice unordered (literal 0b) (literal 0B)) (seq (repeat1 (class plain (char 0) (char 1))) (repeat0 (seq (literal _) (repeat1 (class plain (char 0) (char 1)))))) (optional (choice unordered (literal l) (literal L)))) (concept grammar.binary-integer-literal))
(rule decimal_floating_point_literal token (choice unordered (seq (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 9)))))) (literal .) (optional (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 9))))))) (optional (seq (class plain (char e) (char E)) (optional (choice unordered (literal -) (literal %2B))) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 9)))))))) (optional (class plain (char f) (char F) (char d) (char D)))) (seq (literal .) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 9)))))) (optional (seq (class plain (char e) (char E)) (optional (choice unordered (literal -) (literal %2B))) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 9)))))))) (optional (class plain (char f) (char F) (char d) (char D)))) (seq (choice unordered (literal 0) (seq (class plain (range 1 9)) (optional (seq (optional (literal _)) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (repeat1 (literal _)) (repeat1 (class plain (range 0 9)))))))))) (class plain (char e) (char E)) (optional (choice unordered (literal -) (literal %2B))) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 9)))))) (optional (class plain (char f) (char F) (char d) (char D)))) (seq (choice unordered (literal 0) (seq (class plain (range 1 9)) (optional (seq (optional (literal _)) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (repeat1 (literal _)) (repeat1 (class plain (range 0 9)))))))))) (optional (seq (class plain (char e) (char E)) (optional (choice unordered (literal -) (literal %2B))) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range 0 9)))))))) (class plain (char f) (char F) (char d) (char D)))) (concept grammar.decimal-floating-point-literal))
(rule hex_floating_point_literal token (seq (choice unordered (literal 0x) (literal 0X)) (choice unordered (seq (seq (repeat1 (class plain (range A F) (range a f) (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range A F) (range a f) (range 0 9)))))) (optional (literal .))) (seq (optional (seq (repeat1 (class plain (range A F) (range a f) (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range A F) (range a f) (range 0 9))))))) (literal .) (seq (repeat1 (class plain (range A F) (range a f) (range 0 9))) (repeat0 (seq (literal _) (repeat1 (class plain (range A F) (range a f) (range 0 9)))))))) (optional (seq (class plain (char p) (char P)) (optional (choice unordered (literal -) (literal %2B))) (choice unordered (literal 0) (seq (class plain (range 1 9)) (optional (seq (optional (literal _)) (seq (repeat1 (class plain (range 0 9))) (repeat0 (seq (repeat1 (literal _)) (repeat1 (class plain (range 0 9)))))))))) (optional (class plain (char f) (char F) (char d) (char D)))))) (concept grammar.hex-floating-point-literal))
(rule true token (seq (literal true) (not (ref word_characters))) (concept grammar.true-value))
(rule false token (seq (literal false) (not (ref word_characters))) (concept grammar.false-value))
(rule character_literal token (seq (literal %27) (repeat1 (choice unordered (class negated (char %5C) (char %27) (char %0A)) (seq (literal %5C) (class negated (char %0A))) (seq (literal %5C) (literal %0A)))) (literal %27)) (concept grammar.character-literal))
(rule string_literal normal (choice unordered (ref single_line_string_literal) (ref text_block)) (concept grammar.string-literal))
(rule single_line_string_literal silent (seq (literal %22) (repeat0 (choice unordered (ref string_fragment) (ref escape_sequence) (ref string_interpolation))) (literal %22)) (concept grammar.single-line-string-literal) (source-names (tree-sitter _string_literal)))
(rule text_block silent (seq (literal %22%22%22) (repeat0 (choice unordered (alias text_block_fragment (ref text_block_fragment_choice)) (ref escape_sequence_choice) (ref string_interpolation))) (literal %22%22%22)) (concept grammar.text-block) (source-names (tree-sitter _multiline_string_literal)))
(rule string_fragment silent (alias string_fragment (immediateToken (lexicalPrecedence 1 (repeat1 (class negated (char %22) (char %5C)))))) (concept grammar.string-fragment))
(rule text_block_fragment_choice silent (choice unordered (alias unnamed_token (token (repeat1 (class negated (char %22) (char %5C))))) (alias unnamed_token (token (seq (literal %22) (repeat0 (choice unordered (class negated (char %22) (char %5C)) (literal %5C%22))))))) (concept grammar.text-block-fragment-choice) (source-names (tree-sitter _multiline_string_fragment)))
(rule string_interpolation normal (seq (literal %5C%7B) (ref expression) (literal %7D)) (concept grammar.string-interpolation))
(rule escape_sequence_choice silent (choice unordered (precedence 2 none (alias unnamed_token (immediateToken (seq (literal %5C) (class negated (char b) (char f) (char n) (char r) (char t) (char s) (char %27) (char %22) (char %5C)))))) (precedence 1 none (ref escape_sequence))) (concept grammar.escape-sequence-choice) (source-names (tree-sitter _escape_sequence)))
(rule escape_sequence silent (alias escape_sequence (immediateToken (seq (literal %5C) (choice unordered (class negated (char x) (char u) (range 0 7)) (repeat 1 3 (class plain (range 0 7))) (seq (literal x) (repeat 2 2 (class plain (range 0 9) (range a f) (range A F)))) (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)))))) (concept grammar.escape-sequence))
(rule null_literal token (seq (literal null) (not (ref word_characters))) (concept grammar.null-literal))
(rule expression silent (choice unordered (ref assignment_expression) (ref binary_expression) (ref instance_of_expression) (ref lambda_expression) (ref ternary_expression) (ref update_expression) (ref primary_expression) (ref unary_expression) (ref cast_expression) (ref switch_expression)) (concept grammar.expression))
(rule cast_expression normal (precedence 14 none (choice unordered (seq (literal %28) (capture labeled type (ref type)) (literal %29) (capture labeled value (ref expression))) (seq (literal %28) (seq (capture labeled type (ref type)) (repeat0 (seq (literal %26) (capture labeled type (ref type))))) (literal %29) (capture labeled value (choice unordered (ref primary_expression) (ref lambda_expression)))))) (concept grammar.cast-expression))
(rule assignment_expression normal (precedence 1 right (seq (capture labeled left (choice unordered (ref identifier) (ref reserved_identifier) (ref field_access) (ref array_access))) (capture labeled operator (choice unordered (literal %3D) (literal %2B%3D) (literal -%3D) (literal %2A%3D) (literal %2F%3D) (literal %26%3D) (literal %7C%3D) (literal %5E%3D) (literal %25%3D) (literal %3C%3C%3D) (literal %3E%3E%3D) (literal %3E%3E%3E%3D))) (capture labeled right (ref expression)))) (concept grammar.assignment-expression))
(rule binary_expression normal (choice unordered (precedence 10 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3E)) (capture labeled right (ref expression)))) (precedence 10 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3C)) (capture labeled right (ref expression)))) (precedence 10 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3E%3D)) (capture labeled right (ref expression)))) (precedence 10 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3C%3D)) (capture labeled right (ref expression)))) (precedence 9 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3D%3D)) (capture labeled right (ref expression)))) (precedence 9 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %21%3D)) (capture labeled right (ref expression)))) (precedence 5 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %26%26)) (capture labeled right (ref expression)))) (precedence 4 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %7C%7C)) (capture labeled right (ref expression)))) (precedence 12 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %2B)) (capture labeled right (ref expression)))) (precedence 12 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal -)) (capture labeled right (ref expression)))) (precedence 13 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %2A)) (capture labeled right (ref expression)))) (precedence 13 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %2F)) (capture labeled right (ref expression)))) (precedence 8 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %26)) (capture labeled right (ref expression)))) (precedence 6 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %7C)) (capture labeled right (ref expression)))) (precedence 7 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %5E)) (capture labeled right (ref expression)))) (precedence 13 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %25)) (capture labeled right (ref expression)))) (precedence 11 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3C%3C)) (capture labeled right (ref expression)))) (precedence 11 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3E%3E)) (capture labeled right (ref expression)))) (precedence 11 left (seq (capture labeled left (ref expression)) (capture labeled operator (literal %3E%3E%3E)) (capture labeled right (ref expression))))) (concept grammar.binary-expression))
(rule instance_of_expression normal (precedence 10 none (seq (capture labeled left (ref expression)) (token (seq (literal instanceof) (not (ref word_characters)))) (optional (token (seq (literal final) (not (ref word_characters))))) (choice unordered (seq (capture labeled right (ref type)) (optional (capture labeled name (choice unordered (ref identifier) (ref reserved_identifier))))) (capture labeled pattern (ref record_pattern))))) (concept grammar.instance-of-expression) (source-names (tree-sitter instanceof_expression)))
(rule lambda_expression normal (seq (capture labeled parameters (choice unordered (ref identifier) (ref formal_parameters) (ref inferred_parameters) (ref reserved_identifier))) (literal -%3E) (capture labeled body (choice unordered (ref expression) (ref block)))) (concept grammar.lambda-expression))
(rule inferred_parameters normal (seq (literal %28) (seq (choice unordered (ref identifier) (ref reserved_identifier)) (repeat0 (seq (literal %2C) (choice unordered (ref identifier) (ref reserved_identifier))))) (literal %29)) (concept grammar.inferred-parameters))
(rule ternary_expression normal (precedence 3 right (seq (capture labeled condition (ref expression)) (literal %3F) (capture labeled consequence (ref expression)) (literal %3A) (capture labeled alternative (ref expression)))) (concept grammar.ternary-expression))
(rule unary_expression normal (choice unordered (precedence 15 left (seq (capture labeled operator (literal %2B)) (capture labeled operand (ref expression)))) (precedence 15 left (seq (capture labeled operator (literal -)) (capture labeled operand (ref expression)))) (precedence 15 left (seq (capture labeled operator (literal %21)) (capture labeled operand (ref expression)))) (precedence 15 left (seq (capture labeled operator (literal %7E)) (capture labeled operand (ref expression))))) (concept grammar.unary-expression))
(rule update_expression normal (precedence 15 left (choice unordered (seq (ref expression) (literal %2B%2B)) (seq (ref expression) (literal --)) (seq (literal %2B%2B) (ref expression)) (seq (literal --) (ref expression)))) (concept grammar.update-expression))
(rule primary_expression silent (choice unordered (ref literal) (ref class_literal) (ref this) (ref identifier) (ref reserved_identifier) (ref parenthesized_expression) (ref object_creation_expression) (ref field_access) (ref array_access) (ref method_invocation) (ref method_reference) (ref array_creation_expression) (ref template_expression)) (concept grammar.primary-expression))
(rule array_creation_expression normal (precedence 0 right (seq (token (seq (literal new) (not (ref word_characters)))) (repeat0 (ref annotation_choice)) (capture labeled type (ref simple_type)) (choice unordered (seq (capture labeled dimensions (repeat1 (ref dimensions_expression))) (capture labeled dimensions (optional (ref dimensions)))) (seq (capture labeled dimensions (ref dimensions)) (capture labeled value (ref array_initializer)))))) (concept grammar.array-creation-expression))
(rule dimensions_expression normal (seq (repeat0 (ref annotation_choice)) (literal %5B) (ref expression) (literal %5D)) (concept grammar.dimensions-expression) (source-names (tree-sitter dimensions_expr)))
(rule parenthesized_expression normal (seq (literal %28) (ref expression) (literal %29)) (concept grammar.parenthesized-expression))
(rule class_literal normal (dynamicPrecedence 17 (seq (ref unannotated_type) (literal .) (token (seq (literal class) (not (ref word_characters)))))) (concept grammar.class-literal))
(rule object_creation_expression normal (choice unordered (ref unqualified_object_creation_expression) (seq (ref primary_expression) (literal .) (ref unqualified_object_creation_expression))) (concept grammar.object-creation-expression))
(rule unqualified_object_creation_expression silent (precedence 0 right (seq (token (seq (literal new) (not (ref word_characters)))) (choice unordered (seq (repeat0 (ref annotation_choice)) (capture labeled type_arguments (ref type_arguments)) (repeat0 (ref annotation_choice))) (repeat0 (ref annotation_choice))) (capture labeled type (ref simple_type)) (capture labeled arguments (ref argument_list)) (optional (ref class_body)))) (concept grammar.unqualified-object-creation-expression) (source-names (tree-sitter _unqualified_object_creation_expression)))
(rule field_access normal (seq (capture labeled object (choice unordered (ref primary_expression) (ref super))) (optional (seq (literal .) (ref super))) (literal .) (capture labeled field (choice unordered (ref identifier) (ref reserved_identifier) (ref this)))) (concept grammar.field-access))
(rule template_expression normal (seq (capture labeled template_processor (ref primary_expression)) (literal .) (capture labeled template_argument (ref string_literal))) (concept grammar.template-expression))
(rule array_access normal (seq (capture labeled array (ref primary_expression)) (literal %5B) (capture labeled index (ref expression)) (literal %5D)) (concept grammar.array-access))
(rule method_invocation normal (seq (choice unordered (capture labeled name (choice unordered (ref identifier) (ref reserved_identifier))) (seq (capture labeled object (choice unordered (ref primary_expression) (ref super))) (literal .) (optional (seq (ref super) (literal .))) (capture labeled type_arguments (optional (ref type_arguments))) (capture labeled name (choice unordered (ref identifier) (ref reserved_identifier))))) (capture labeled arguments (ref argument_list))) (concept grammar.method-invocation))
(rule argument_list normal (seq (literal %28) (optional (seq (ref expression) (repeat0 (seq (literal %2C) (ref expression))))) (literal %29)) (concept grammar.argument-list))
(rule method_reference normal (seq (choice unordered (ref type) (ref primary_expression) (ref super)) (literal %3A%3A) (optional (ref type_arguments)) (choice unordered (token (seq (literal new) (not (ref word_characters)))) (ref identifier))) (concept grammar.method-reference))
(rule type_arguments normal (seq (literal %3C) (optional (seq (choice unordered (ref type) (ref wildcard)) (repeat0 (seq (literal %2C) (choice unordered (ref type) (ref wildcard)))))) (literal %3E)) (concept grammar.type-argument-list))
(rule wildcard normal (seq (repeat0 (ref annotation_choice)) (literal %3F) (optional (ref wildcard_bounds))) (concept grammar.wildcard-type-argument))
(rule wildcard_bounds silent (choice unordered (seq (token (seq (literal extends) (not (ref word_characters)))) (ref type)) (seq (ref super) (ref type))) (concept grammar.wildcard-bounds) (source-names (tree-sitter _wildcard_bounds)))
(rule dimensions normal (precedence 0 right (repeat1 (seq (repeat0 (ref annotation_choice)) (literal %5B) (literal %5D)))) (concept grammar.array-dimensions))
(rule switch_expression normal (seq (token (seq (literal switch) (not (ref word_characters)))) (capture labeled condition (ref parenthesized_expression)) (capture labeled body (ref switch_block))) (concept grammar.switch-expression))
(rule switch_block normal (seq (literal %7B) (choice unordered (repeat0 (ref switch_block_statement_group)) (repeat0 (ref switch_rule))) (literal %7D)) (concept grammar.switch-block))
(rule switch_block_statement_group normal (precedence 0 left (seq (repeat1 (seq (ref switch_label) (literal %3A))) (repeat0 (ref statement)))) (concept grammar.switch-block-statement-group))
(rule switch_rule normal (seq (ref switch_label) (literal -%3E) (choice unordered (ref expression_statement) (ref throw_statement) (ref block))) (concept grammar.switch-rule))
(rule switch_label normal (choice unordered (seq (token (seq (literal case) (not (ref word_characters)))) (choice unordered (ref pattern) (seq (ref expression) (repeat0 (seq (literal %2C) (ref expression))))) (optional (ref guard))) (token (seq (literal default) (not (ref word_characters))))) (concept grammar.switch-label))
(rule pattern normal (choice unordered (ref type_pattern) (ref record_pattern)) (concept grammar.pattern))
(rule type_pattern normal (seq (ref unannotated_type) (choice unordered (ref identifier) (ref reserved_identifier))) (concept grammar.type-pattern))
(rule record_pattern normal (seq (choice unordered (ref identifier) (ref reserved_identifier) (ref generic_type)) (ref record_pattern_body)) (concept grammar.record-pattern))
(rule record_pattern_body normal (seq (literal %28) (optional (seq (choice unordered (ref record_pattern_component) (ref record_pattern)) (repeat0 (seq (literal %2C) (choice unordered (ref record_pattern_component) (ref record_pattern)))))) (literal %29)) (concept grammar.record-pattern-body))
(rule record_pattern_component normal (choice unordered (ref underscore_pattern) (seq (ref unannotated_type) (choice unordered (ref identifier) (ref reserved_identifier)))) (concept grammar.record-pattern-component))
(rule underscore_pattern token (seq (literal _) (not (ref word_characters))) (concept grammar.underscore-pattern))
(rule guard normal (seq (token (seq (literal when) (not (ref word_characters)))) (ref expression)) (concept grammar.guard))
(rule statement silent (choice unordered (ref declaration) (ref expression_statement) (ref labeled_statement) (ref if_statement) (ref while_statement) (ref for_statement) (ref enhanced_for_statement) (ref block) (literal %3B) (ref assert_statement) (ref do_statement) (ref break_statement) (ref continue_statement) (ref return_statement) (ref yield_statement) (ref switch_expression) (ref synchronized_statement) (ref local_variable_declaration) (ref throw_statement) (ref try_statement) (ref try_with_resources_statement)) (concept grammar.statement))
(rule block normal (seq (literal %7B) (repeat0 (ref statement)) (literal %7D)) (concept grammar.block))
(rule expression_statement normal (seq (ref expression) (literal %3B)) (concept grammar.expression-statement))
(rule labeled_statement normal (seq (ref identifier) (literal %3A) (ref statement)) (concept grammar.labeled-statement))
(rule assert_statement normal (choice unordered (seq (token (seq (literal assert) (not (ref word_characters)))) (ref expression) (literal %3B)) (seq (token (seq (literal assert) (not (ref word_characters)))) (ref expression) (literal %3A) (ref expression) (literal %3B))) (concept grammar.assert-statement))
(rule do_statement normal (seq (token (seq (literal do) (not (ref word_characters)))) (capture labeled body (ref statement)) (token (seq (literal while) (not (ref word_characters)))) (capture labeled condition (ref parenthesized_expression)) (literal %3B)) (concept grammar.do-statement))
(rule break_statement normal (seq (token (seq (literal break) (not (ref word_characters)))) (optional (ref identifier)) (literal %3B)) (concept grammar.break-statement))
(rule continue_statement normal (seq (token (seq (literal continue) (not (ref word_characters)))) (optional (ref identifier)) (literal %3B)) (concept grammar.continue-statement))
(rule return_statement normal (seq (token (seq (literal return) (not (ref word_characters)))) (optional (ref expression)) (literal %3B)) (concept grammar.return-statement))
(rule yield_statement normal (seq (token (seq (literal yield) (not (ref word_characters)))) (ref expression) (literal %3B)) (concept grammar.yield-statement))
(rule synchronized_statement normal (seq (token (seq (literal synchronized) (not (ref word_characters)))) (ref parenthesized_expression) (capture labeled body (ref block))) (concept grammar.synchronized-statement))
(rule throw_statement normal (seq (token (seq (literal throw) (not (ref word_characters)))) (ref expression) (literal %3B)) (concept grammar.throw-statement))
(rule try_statement normal (seq (token (seq (literal try) (not (ref word_characters)))) (capture labeled body (ref block)) (choice unordered (repeat1 (ref catch_clause)) (seq (repeat0 (ref catch_clause)) (ref finally_clause)))) (concept grammar.try-statement))
(rule catch_clause normal (seq (token (seq (literal catch) (not (ref word_characters)))) (literal %28) (ref catch_formal_parameter) (literal %29) (capture labeled body (ref block))) (concept grammar.catch-clause))
(rule catch_formal_parameter normal (seq (optional (ref modifiers)) (ref catch_type) (ref variable_declarator_identifier)) (concept grammar.catch-formal-parameter))
(rule catch_type normal (seq (ref unannotated_type) (repeat0 (seq (literal %7C) (ref unannotated_type)))) (concept grammar.catch-type))
(rule finally_clause normal (seq (token (seq (literal finally) (not (ref word_characters)))) (ref block)) (concept grammar.finally-clause))
(rule try_with_resources_statement normal (seq (token (seq (literal try) (not (ref word_characters)))) (capture labeled resources (ref resource_specification)) (capture labeled body (ref block)) (repeat0 (ref catch_clause)) (optional (ref finally_clause))) (concept grammar.try-with-resources-statement))
(rule resource_specification normal (seq (literal %28) (seq (ref resource) (repeat0 (seq (literal %3B) (ref resource)))) (optional (literal %3B)) (literal %29)) (concept grammar.resource-specification))
(rule resource normal (choice unordered (seq (optional (ref modifiers)) (capture labeled type (ref unannotated_type)) (ref variable_declarator_identifier) (literal %3D) (capture labeled value (ref expression))) (ref identifier) (ref field_access)) (concept grammar.resource))
(rule if_statement normal (precedence 0 right (seq (token (seq (literal if) (not (ref word_characters)))) (capture labeled condition (ref parenthesized_expression)) (capture labeled consequence (ref statement)) (optional (seq (token (seq (literal else) (not (ref word_characters)))) (capture labeled alternative (ref statement)))))) (concept grammar.if-statement))
(rule while_statement normal (seq (token (seq (literal while) (not (ref word_characters)))) (capture labeled condition (ref parenthesized_expression)) (capture labeled body (ref statement))) (concept grammar.while-statement))
(rule for_statement normal (seq (token (seq (literal for) (not (ref word_characters)))) (literal %28) (choice unordered (capture labeled init (ref local_variable_declaration)) (seq (optional (seq (capture labeled init (ref expression)) (repeat0 (seq (literal %2C) (capture labeled init (ref expression)))))) (literal %3B))) (capture labeled condition (optional (ref expression))) (literal %3B) (optional (seq (capture labeled update (ref expression)) (repeat0 (seq (literal %2C) (capture labeled update (ref expression)))))) (literal %29) (capture labeled body (ref statement))) (concept grammar.for-statement))
(rule enhanced_for_statement normal (seq (token (seq (literal for) (not (ref word_characters)))) (literal %28) (optional (ref modifiers)) (capture labeled type (ref unannotated_type)) (ref variable_declarator_identifier) (literal %3A) (capture labeled value (ref expression)) (literal %29) (capture labeled body (ref statement))) (concept grammar.enhanced-for-statement))
(rule annotation_choice silent (choice unordered (ref marker_annotation) (ref annotation)) (concept grammar.annotation-choice) (source-names (tree-sitter _annotation)))
(rule marker_annotation normal (seq (literal %40) (capture labeled name (ref name))) (concept grammar.marker-annotation))
(rule annotation normal (seq (literal %40) (capture labeled name (ref name)) (capture labeled arguments (ref annotation_argument_list))) (concept grammar.annotation))
(rule annotation_argument_list normal (seq (literal %28) (choice unordered (ref element_value) (optional (seq (ref element_value_pair) (repeat0 (seq (literal %2C) (ref element_value_pair)))))) (literal %29)) (concept grammar.annotation-argument-list))
(rule element_value_pair normal (seq (capture labeled key (choice unordered (ref identifier) (ref reserved_identifier))) (literal %3D) (capture labeled value (ref element_value))) (concept grammar.element-value-pair))
(rule element_value silent (precedence 2 none (choice unordered (ref expression) (ref element_value_array_initializer) (ref annotation_choice))) (concept grammar.element-value) (source-names (tree-sitter _element_value)))
(rule element_value_array_initializer normal (seq (literal %7B) (optional (seq (ref element_value) (repeat0 (seq (literal %2C) (ref element_value))))) (optional (literal %2C)) (literal %7D)) (concept grammar.element-value-array-initializer))
(rule declaration silent (precedence 2 none (choice unordered (ref module_declaration) (ref package_declaration) (ref import_declaration) (ref class_declaration) (ref record_declaration) (ref interface_declaration) (ref annotation_type_declaration) (ref enumeration_declaration))) (concept grammar.declaration))
(rule module_declaration normal (seq (repeat0 (ref annotation_choice)) (optional (token (seq (literal open) (not (ref word_characters))))) (token (seq (literal module) (not (ref word_characters)))) (capture labeled name (ref name)) (capture labeled body (ref module_body))) (concept grammar.module-declaration))
(rule module_body normal (seq (literal %7B) (repeat0 (ref module_directive)) (literal %7D)) (concept grammar.module-body))
(rule module_directive silent (choice unordered (ref requires_module_directive) (ref exports_module_directive) (ref opens_module_directive) (ref uses_module_directive) (ref provides_module_directive)) (concept grammar.module-directive))
(rule requires_module_directive normal (seq (token (seq (literal requires) (not (ref word_characters)))) (repeat0 (capture labeled modifiers (ref requires_modifier))) (capture labeled module (ref name)) (literal %3B)) (concept grammar.requires-module-directive))
(rule requires_modifier normal (choice unordered (token (seq (literal transitive) (not (ref word_characters)))) (token (seq (literal static) (not (ref word_characters))))) (concept grammar.requires-modifier))
(rule exports_module_directive normal (seq (token (seq (literal exports) (not (ref word_characters)))) (capture labeled package (ref name)) (optional (seq (token (seq (literal to) (not (ref word_characters)))) (capture labeled modules (ref name)) (repeat0 (seq (literal %2C) (capture labeled modules (ref name)))))) (literal %3B)) (concept grammar.exports-module-directive))
(rule opens_module_directive normal (seq (token (seq (literal opens) (not (ref word_characters)))) (capture labeled package (ref name)) (optional (seq (token (seq (literal to) (not (ref word_characters)))) (capture labeled modules (ref name)) (repeat0 (seq (literal %2C) (capture labeled modules (ref name)))))) (literal %3B)) (concept grammar.opens-module-directive))
(rule uses_module_directive normal (seq (token (seq (literal uses) (not (ref word_characters)))) (capture labeled type (ref name)) (literal %3B)) (concept grammar.uses-module-directive))
(rule provides_module_directive normal (seq (token (seq (literal provides) (not (ref word_characters)))) (capture labeled provided (ref name)) (token (seq (literal with) (not (ref word_characters)))) (ref name) (repeat0 (seq (literal %2C) (capture labeled provider (ref name)))) (literal %3B)) (concept grammar.provides-module-directive))
(rule package_declaration normal (seq (repeat0 (ref annotation_choice)) (token (seq (literal package) (not (ref word_characters)))) (ref name) (literal %3B)) (concept grammar.package-declaration))
(rule import_declaration normal (seq (token (seq (literal import) (not (ref word_characters)))) (optional (token (seq (literal static) (not (ref word_characters))))) (ref name) (optional (seq (literal .) (ref asterisk))) (literal %3B)) (concept grammar.import-declaration))
(rule asterisk normal (literal %2A) (concept grammar.asterisk))
(rule enumeration_declaration normal (seq (optional (ref modifiers)) (token (seq (literal enum) (not (ref word_characters)))) (capture labeled name (ref identifier)) (capture labeled interfaces (optional (ref super_interfaces))) (capture labeled body (ref enumeration_body))) (concept grammar.enumeration-declaration) (source-names (tree-sitter enum_declaration)))
(rule enumeration_body normal (seq (literal %7B) (optional (seq (ref enumeration_constant) (repeat0 (seq (literal %2C) (ref enumeration_constant))))) (optional (literal %2C)) (optional (ref enumeration_body_declarations)) (literal %7D)) (concept grammar.enumeration-body) (source-names (tree-sitter enum_body)))
(rule enumeration_body_declarations normal (seq (literal %3B) (repeat0 (ref class_body_declaration))) (concept grammar.enumeration-body-declarations) (source-names (tree-sitter enum_body_declarations)))
(rule enumeration_constant normal (seq (optional (ref modifiers)) (capture labeled name (ref identifier)) (capture labeled arguments (optional (ref argument_list))) (capture labeled body (optional (ref class_body)))) (concept grammar.enumeration-constant) (source-names (tree-sitter enum_constant)))
(rule class_declaration normal (seq (optional (ref modifiers)) (token (seq (literal class) (not (ref word_characters)))) (capture labeled name (ref identifier)) (optional (capture labeled type_parameters (ref type_parameters))) (optional (capture labeled superclass (ref superclass))) (optional (capture labeled interfaces (ref super_interfaces))) (optional (capture labeled permits (ref permits))) (capture labeled body (ref class_body))) (concept grammar.class-declaration))
(rule modifiers normal (repeat1 (choice unordered (ref annotation_choice) (token (seq (literal public) (not (ref word_characters)))) (token (seq (literal protected) (not (ref word_characters)))) (token (seq (literal private) (not (ref word_characters)))) (token (seq (literal abstract) (not (ref word_characters)))) (token (seq (literal static) (not (ref word_characters)))) (token (seq (literal final) (not (ref word_characters)))) (token (seq (literal strictfp) (not (ref word_characters)))) (token (seq (literal default) (not (ref word_characters)))) (token (seq (literal synchronized) (not (ref word_characters)))) (token (seq (literal native) (not (ref word_characters)))) (token (seq (literal transient) (not (ref word_characters)))) (token (seq (literal volatile) (not (ref word_characters)))) (token (seq (literal sealed) (not (ref word_characters)))) (literal non-sealed))) (concept grammar.modifier-list))
(rule type_parameters normal (seq (literal %3C) (seq (ref type_parameter) (repeat0 (seq (literal %2C) (ref type_parameter)))) (literal %3E)) (concept grammar.type-parameter-list))
(rule type_parameter normal (seq (repeat0 (ref annotation_choice)) (alias type_identifier (ref identifier)) (optional (ref type_bound))) (concept grammar.type-parameter))
(rule type_bound normal (seq (token (seq (literal extends) (not (ref word_characters)))) (ref type) (repeat0 (seq (literal %26) (ref type)))) (concept grammar.type-bound))
(rule superclass normal (seq (token (seq (literal extends) (not (ref word_characters)))) (ref type)) (concept grammar.superclass))
(rule super_interfaces normal (seq (token (seq (literal implements) (not (ref word_characters)))) (ref type_list)) (concept grammar.super-interfaces))
(rule type_list normal (seq (ref type) (repeat0 (seq (literal %2C) (ref type)))) (concept grammar.type-list))
(rule permits normal (seq (token (seq (literal permits) (not (ref word_characters)))) (ref type_list)) (concept grammar.permits))
(rule class_body normal (seq (literal %7B) (repeat0 (ref class_body_declaration)) (literal %7D)) (concept grammar.class-body))
(rule class_body_declaration silent (choice unordered (ref field_declaration) (ref record_declaration) (ref method_declaration) (ref compact_constructor_declaration) (ref class_declaration) (ref interface_declaration) (ref annotation_type_declaration) (ref enumeration_declaration) (ref block) (ref static_initializer) (ref constructor_declaration) (literal %3B)) (concept grammar.class-body-declaration) (source-names (tree-sitter _class_body_declaration)))
(rule static_initializer normal (seq (token (seq (literal static) (not (ref word_characters)))) (ref block)) (concept grammar.static-initializer))
(rule constructor_declaration normal (seq (optional (ref modifiers)) (ref constructor_declarator) (optional (ref throws)) (capture labeled body (ref constructor_body))) (concept grammar.constructor-declaration))
(rule constructor_declarator silent (seq (capture labeled type_parameters (optional (ref type_parameters))) (capture labeled name (ref identifier)) (capture labeled parameters (ref formal_parameters))) (concept grammar.constructor-declarator) (source-names (tree-sitter _constructor_declarator)))
(rule constructor_body normal (seq (literal %7B) (optional (ref explicit_constructor_invocation)) (repeat0 (ref statement)) (literal %7D)) (concept grammar.constructor-body))
(rule explicit_constructor_invocation normal (seq (choice unordered (seq (capture labeled type_arguments (optional (ref type_arguments))) (capture labeled constructor (choice unordered (ref this) (ref super)))) (seq (capture labeled object (ref primary_expression)) (literal .) (capture labeled type_arguments (optional (ref type_arguments))) (capture labeled constructor (ref super)))) (capture labeled arguments (ref argument_list)) (literal %3B)) (concept grammar.explicit-constructor-invocation))
(rule name silent (choice unordered (ref identifier) (ref reserved_identifier) (ref scoped_identifier)) (concept grammar.name) (source-names (tree-sitter _name)))
(rule scoped_identifier normal (seq (capture labeled scope (ref name)) (literal .) (capture labeled name (ref identifier))) (concept grammar.scoped-identifier))
(rule field_declaration normal (seq (optional (ref modifiers)) (capture labeled type (ref unannotated_type)) (ref variable_declarator_list) (literal %3B)) (concept grammar.field-declaration))
(rule record_declaration normal (seq (optional (ref modifiers)) (token (seq (literal record) (not (ref word_characters)))) (capture labeled name (ref identifier)) (optional (capture labeled type_parameters (ref type_parameters))) (capture labeled parameters (ref formal_parameters)) (optional (capture labeled interfaces (ref super_interfaces))) (capture labeled body (ref class_body))) (concept grammar.record-declaration))
(rule annotation_type_declaration normal (seq (optional (ref modifiers)) (literal %40interface) (capture labeled name (ref identifier)) (capture labeled body (ref annotation_type_body))) (concept grammar.annotation-type-declaration))
(rule annotation_type_body normal (seq (literal %7B) (repeat0 (choice unordered (ref annotation_type_element_declaration) (ref constant_declaration) (ref class_declaration) (ref interface_declaration) (ref enumeration_declaration) (ref annotation_type_declaration) (literal %3B))) (literal %7D)) (concept grammar.annotation-type-body))
(rule annotation_type_element_declaration normal (seq (optional (ref modifiers)) (capture labeled type (ref unannotated_type)) (capture labeled name (choice unordered (ref identifier) (ref reserved_identifier))) (literal %28) (literal %29) (capture labeled dimensions (optional (ref dimensions))) (optional (ref default_value)) (literal %3B)) (concept grammar.annotation-type-element-declaration))
(rule default_value silent (seq (token (seq (literal default) (not (ref word_characters)))) (capture labeled value (ref element_value))) (concept grammar.default-value) (source-names (tree-sitter _default_value)))
(rule interface_declaration normal (seq (optional (ref modifiers)) (token (seq (literal interface) (not (ref word_characters)))) (capture labeled name (ref identifier)) (capture labeled type_parameters (optional (ref type_parameters))) (optional (ref extends_interfaces)) (optional (capture labeled permits (ref permits))) (capture labeled body (ref interface_body))) (concept grammar.interface-declaration))
(rule extends_interfaces normal (seq (token (seq (literal extends) (not (ref word_characters)))) (ref type_list)) (concept grammar.extends-interfaces))
(rule interface_body normal (seq (literal %7B) (repeat0 (choice unordered (ref constant_declaration) (ref enumeration_declaration) (ref method_declaration) (ref class_declaration) (ref interface_declaration) (ref record_declaration) (ref annotation_type_declaration) (literal %3B))) (literal %7D)) (concept grammar.interface-body))
(rule constant_declaration normal (seq (optional (ref modifiers)) (capture labeled type (ref unannotated_type)) (ref variable_declarator_list) (literal %3B)) (concept grammar.constant-declaration))
(rule variable_declarator_list silent (seq (capture labeled declarator (ref variable_declarator)) (repeat0 (seq (literal %2C) (capture labeled declarator (ref variable_declarator))))) (concept grammar.variable-declarator-list) (source-names (tree-sitter _variable_declarator_list)))
(rule variable_declarator normal (seq (ref variable_declarator_identifier) (optional (seq (literal %3D) (capture labeled value (ref variable_initializer))))) (concept grammar.variable-declarator))
(rule variable_declarator_identifier silent (seq (capture labeled name (choice unordered (ref identifier) (ref reserved_identifier) (ref underscore_pattern))) (capture labeled dimensions (optional (ref dimensions)))) (concept grammar.variable-declarator-identifier) (source-names (tree-sitter _variable_declarator_id)))
(rule variable_initializer silent (choice unordered (ref expression) (ref array_initializer)) (concept grammar.variable-initializer) (source-names (tree-sitter _variable_initializer)))
(rule array_initializer normal (seq (literal %7B) (optional (seq (ref variable_initializer) (repeat0 (seq (literal %2C) (ref variable_initializer))))) (optional (literal %2C)) (literal %7D)) (concept grammar.array-initializer))
(rule type silent (choice unordered (ref unannotated_type) (ref annotated_type)) (concept grammar.type) (source-names (tree-sitter _type)))
(rule unannotated_type silent (choice unordered (ref simple_type) (ref array_type)) (concept grammar.unannotated-type) (source-names (tree-sitter _unannotated_type)))
(rule simple_type silent (choice unordered (ref void_type) (ref integral_type) (ref floating_point_type) (ref boolean_type) (alias type_identifier (ref identifier)) (ref scoped_type_identifier) (ref generic_type)) (concept grammar.simple-type) (source-names (tree-sitter _simple_type)))
(rule annotated_type normal (seq (repeat1 (ref annotation_choice)) (ref unannotated_type)) (concept grammar.annotated-type))
(rule scoped_type_identifier normal (seq (choice unordered (alias type_identifier (ref identifier)) (ref scoped_type_identifier) (ref generic_type)) (literal .) (repeat0 (ref annotation_choice)) (alias type_identifier (ref identifier))) (concept grammar.scoped-type-identifier))
(rule generic_type normal (dynamicPrecedence 10 (seq (choice unordered (alias type_identifier (ref identifier)) (ref scoped_type_identifier)) (ref type_arguments))) (concept grammar.generic-type))
(rule array_type normal (seq (capture labeled element (ref unannotated_type)) (capture labeled dimensions (ref dimensions))) (concept grammar.array-type))
(rule integral_type normal (choice unordered (token (seq (literal byte) (not (ref word_characters)))) (token (seq (literal short) (not (ref word_characters)))) (token (seq (literal int) (not (ref word_characters)))) (token (seq (literal long) (not (ref word_characters)))) (token (seq (literal char) (not (ref word_characters))))) (concept grammar.integral-type))
(rule floating_point_type normal (choice unordered (token (seq (literal float) (not (ref word_characters)))) (token (seq (literal double) (not (ref word_characters))))) (concept grammar.floating-point-type))
(rule boolean_type token (seq (literal boolean) (not (ref word_characters))) (concept grammar.boolean-type))
(rule void_type token (seq (literal void) (not (ref word_characters))) (concept grammar.void-type))
(rule method_header silent (seq (optional (seq (capture labeled type_parameters (ref type_parameters)) (repeat0 (ref annotation_choice)))) (capture labeled type (ref unannotated_type)) (ref method_declarator) (optional (ref throws))) (concept grammar.method-header) (source-names (tree-sitter _method_header)))
(rule method_declarator silent (seq (capture labeled name (choice unordered (ref identifier) (ref reserved_identifier))) (capture labeled parameters (ref formal_parameters)) (capture labeled dimensions (optional (ref dimensions)))) (concept grammar.method-declarator) (source-names (tree-sitter _method_declarator)))
(rule formal_parameters normal (seq (literal %28) (choice unordered (ref receiver_parameter) (seq (optional (seq (ref receiver_parameter) (literal %2C))) (optional (seq (choice unordered (ref formal_parameter) (ref spread_parameter)) (repeat0 (seq (literal %2C) (choice unordered (ref formal_parameter) (ref spread_parameter)))))))) (literal %29)) (concept grammar.formal-parameter-list))
(rule formal_parameter normal (seq (optional (ref modifiers)) (capture labeled type (ref unannotated_type)) (ref variable_declarator_identifier)) (concept grammar.formal-parameter))
(rule receiver_parameter normal (seq (repeat0 (ref annotation_choice)) (ref unannotated_type) (repeat0 (seq (ref identifier) (literal .))) (ref this)) (concept grammar.receiver-parameter))
(rule spread_parameter normal (seq (optional (ref modifiers)) (ref unannotated_type) (literal ...) (repeat0 (ref annotation_choice)) (ref variable_declarator)) (concept grammar.spread-parameter))
(rule throws normal (seq (token (seq (literal throws) (not (ref word_characters)))) (seq (ref type) (repeat0 (seq (literal %2C) (ref type))))) (concept grammar.throws))
(rule local_variable_declaration normal (seq (optional (ref modifiers)) (capture labeled type (ref unannotated_type)) (ref variable_declarator_list) (literal %3B)) (concept grammar.local-variable-declaration))
(rule method_declaration normal (seq (optional (ref modifiers)) (ref method_header) (choice unordered (capture labeled body (ref block)) (literal %3B))) (concept grammar.method-declaration))
(rule compact_constructor_declaration normal (seq (optional (ref modifiers)) (capture labeled name (ref identifier)) (capture labeled body (ref block))) (concept grammar.compact-constructor-declaration))
(rule reserved_identifier silent (choice unordered (precedence -3 none (alias identifier (choice unordered (token (seq (literal open) (not (ref word_characters)))) (token (seq (literal module) (not (ref word_characters)))) (token (seq (literal record) (not (ref word_characters)))) (token (seq (literal with) (not (ref word_characters)))) (token (seq (literal sealed) (not (ref word_characters))))))) (alias identifier (token (seq (literal yield) (not (ref word_characters)))))) (concept grammar.reserved-identifier) (source-names (tree-sitter _reserved_identifier)))
(rule this token (seq (literal this) (not (ref word_characters))) (concept grammar.this))
(rule super token (seq (literal super) (not (ref word_characters))) (concept grammar.super))
(rule identifier token (seq (class plain (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl) (char _) (char %24)) (repeat0 (class plain (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl) (category Mn) (category Mc) (category Nd) (category Pc) (char %C2%A2) (char _) (char %24)))) (concept grammar.identifier))
(rule line_comment token (lexicalPrecedence 0 (seq (literal %2F%2F) (repeat0 (class negated (char %0A))))) (concept grammar.line-comment))
(rule block_comment token (lexicalPrecedence 0 (seq (literal %2F%2A) (seq (repeat0 (class negated (char %2A))) (repeat1 (literal %2A)) (repeat0 (seq (class negated (char %2F) (char %2A)) (repeat0 (class negated (char %2A))) (repeat1 (literal %2A))))) (literal %2F))) (concept grammar.block-comment))
(rule word_characters token (seq (class plain (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl) (char _) (char %24)) (repeat0 (class plain (category Lu) (category Ll) (category Lt) (category Lm) (category Lo) (category Nl) (category Mn) (category Mc) (category Nd) (category Pc) (char %C2%A2) (char _) (char %24)))) (concept grammar.word-characters))