Currently our grammar has a very long list of conflicts declarations. These were all stuffed there semi-automatically to get the grammar to compile in the simplest way possible.
However, many of these are likely wrong. For each entry, the correct fix can be any one of:
a conflicts declaration (i.e. what we have now)
a prec call to indicate precedence
a prec.left or prec.right call to indicate associativity
a fix in the official language spec, if the root of the problem is there.
In any case, each fix should be associated with a test (or several) which verifies that our tree-sitter grammar parses code correctly in this circumstance.
Currently, there are the following unresolved conflict clauses:
Currently our grammar has a very long list of
conflicts
declarations. These were all stuffed there semi-automatically to get the grammar to compile in the simplest way possible.However, many of these are likely wrong. For each entry, the correct fix can be any one of:
conflicts
declaration (i.e. what we have now)prec
call to indicate precedenceprec.left
orprec.right
call to indicate associativityIn any case, each fix should be associated with a test (or several) which verifies that our tree-sitter grammar parses code correctly in this circumstance.
Currently, there are the following unresolved conflict clauses:
[$.qualified_identifier],
[$.storage_class, $.attribute],
[$.storage_class, $.enum_declaration],
[$.storage_class, $.function_attribute_kwd],
[$.storage_class, $.type_ctor],
[$.storage_class, $.type_ctor, $.attribute],
[$.storage_class, $.attribute, $.synchronized_statement],
[$.attribute, $.static_destructor],
[$.attribute, $.static_constructor],
[$.attribute, $.synchronized_statement],
[$._decl_def, $._declaration],
[$.alias_assignment, $.qualified_identifier],
[$.template_instance, $.mixin_qualified_identifier],
[$.auto_assignment, $.qualified_identifier, $.auto_func_declaration],
[$.var_declarator, $.func_declarator],
[$.primary_expression, $.template_instance],
[$.type_ctor, $.variadic_arguments_attribute],
[$.in_out, $.variadic_arguments_attribute],
[$.parameter_attributes],
[$.storage_class, $.synchronized_statement],
[$._declaration, $._non_empty_statement_no_case_no_default], // ???
[$.qualified_identifier, $.template_sequence_parameter],
[$.qualified_identifier, $.template_type_parameter],
[$.qualified_identifier, $.template_instance],
[$.unary_expression, $.parameter],
[$.new_expression],
[$.type],
[$.attribute, $.return_statement],
[$.primary_expression, $.postblit, $.constructor, $.constructor_template],
[$._decl_def, $.declaration_statement],
[$._decl_def, $._non_empty_statement_no_case_no_default],
[$.foreach_type_list, $.range_foreach], // TODO fix grammar
[$.foreach_type_attributes],
[$.parameter, $.template_value_parameter],
[$.conditional_declaration], // TODO else precedence
[$.or_or_expression, $.and_and_expression], // TODO precedence
[$.and_and_expression, $.or_expression], // TODO precedence
[$.or_expression, $.xor_expression],
[$.xor_expression, $.and_expression],
[$._cmp_expression, $.rel_expression, $.shift_expression],
[$._cmp_expression, $.rel_expression],
[$._cmp_expression, $.identity_expression, $.in_expression],
[$._cmp_expression, $.equal_expression],
[$._cmp_expression, $.in_expression],
[$._cmp_expression, $.identity_expression],
[$.shift_expression, $.add_expression],
[$.shift_expression, $.cat_expression],
[$.add_expression, $.mul_expression],
[$._maybe_pow_expression, $.postfix_expression],
[$._maybe_pow_expression, $.index_expression, $.slice_expression],
[$._maybe_pow_expression, $.pow_expression],
[$.super_class_or_interface, $.interface],
[$.postfix_expression, $.template_instance],
[$.argument_list, $.slice],
[$.primary_expression, $.symbol_tail],
[$.type_suffix, $.unary_expression],
[$.specified_function_body, $.missing_function_body],
[$.primary_expression, $.destructor],
[$.declaration_block, $.block_statement],
[$.parameter_with_member_attributes, $.deallocator],
[$.conditional_statement],
[$.static_constructor, $.missing_function_body],
[$.postblit, $.missing_function_body],
[$.array_initializer, $.array_literal],
[$.exp_initializer, $.argument_list],
[$.array_member_initialization, $.key_expression],
[$.struct_initializer, $.block_statement],
[$.mixin_type, $.mixin_expression],
[$.qualified_identifier, $.symbol_tail],
[$.asm_rel_exp, $.asm_shift_exp],
[$.mixin_expression, $.mixin_statement],
[$.primary_expression, $.synchronized_statement],
[$.try_statement],
[$.type_suffix, $.array_literal],
[$.type_suffix, $.argument_list],
[$.shared_static_constructor, $.missing_function_body],
[$.static_destructor, $.missing_function_body],
[$.parameter, $.template_value_parameter_default],
[$.unary_expression, $.template_instance],
[$.rel_expression, $.shift_expression],
[$.equal_expression, $.shift_expression],
[$.in_expression, $.shift_expression],
[$.identity_expression, $.shift_expression],
[$.cat_expression, $.mul_expression],
[$.slice],
[$.asm_log_or_exp, $.asm_log_and_exp],
[$.asm_log_and_exp, $.asm_or_exp],
[$.asm_or_exp, $.asm_xor_exp],
[$.asm_xor_exp, $.asm_and_exp],
[$.asm_and_exp, $.asm_equal_exp],
[$.asm_equal_exp, $.asm_rel_exp],
[$.asm_shift_exp, $.asm_add_exp],
[$.asm_add_exp, $.asm_mul_exp],
[$.asm_mul_exp, $.asm_br_exp],
[$.mixin_declaration, $.mixin_expression, $.mixin_statement],
[$.shared_static_destructor, $.missing_function_body],
[$.if_statement],
[$.mixin_declaration, $.mixin_statement],
[$.alt_declarator_suffix, $.qualified_identifier],
[$.storage_classes],
[$.type_ctors],
[$.function_contracts],
[$.decl_defs],
[$.type_suffixes],
[$.statement_list_no_case_no_default],
[$.catches],
[$.pragma_statement, $.empty_statement],
[$.empty_declaration, $.empty_statement],
[$.static_foreach_declaration],
[$.debug_condition],
[$.scope_block_statement, $.function_literal_body],
[$.labeled_statement],
[$._scope_statement, $.function_literal_body],
[$._no_scope_statement, $.function_literal_body],
[$._no_scope_non_empty_statement, $.function_literal_body],
[$.struct_member_initializer, $.labeled_statement],
[$.packages],
[$.qualified_identifier, $.primary_expression],
[$.basic_type, $.primary_expression],
[$.qualified_identifier, $.primary_expression, $.symbol_tail],
[$._maybe_assign_expression, $.assign_expression],
[$._maybe_conditional_expression, $.or_or_expression],
[$._maybe_conditional_expression, $.conditional_expression],
[$._maybe_or_or_expression, $.and_and_expression],
[$._maybe_and_and_expression, $.or_expression],
[$._maybe_or_expression, $.xor_expression],
[$._maybe_xor_expression, $.and_expression],
[$._maybe_shift_expression, $.add_expression],
[$._maybe_shift_expression, $.cat_expression],
[$.exp_initializer, $._maybe_comma_expression],
[$._maybe_asm_rel_exp, $.asm_shift_exp],
[$._maybe_asm_exp, $.asm_log_or_exp],
[$._maybe_asm_exp, $.asm_exp],
[$._maybe_asm_log_or_exp, $.asm_log_and_exp],
[$._maybe_asm_log_and_exp, $.asm_or_exp],
[$._maybe_asm_or_exp, $.asm_xor_exp],
[$._maybe_asm_xor_exp, $.asm_and_exp],
[$._maybe_asm_and_exp, $.asm_equal_exp],
[$._maybe_asm_equal_exp, $.asm_rel_exp],
[$._maybe_asm_shift_exp, $.asm_add_exp],
[$._maybe_asm_add_exp, $.asm_mul_exp],
[$._maybe_asm_mul_exp, $.asm_br_exp],
[$.storage_class, $.attribute, $.shared_static_constructor, $.shared_static_destructor],
[$.import_declaration, $.attribute],
[$._maybe_storage_class, $._maybe_at_attribute],
[$._maybe_storage_class, $._maybe_attribute],
[$._module_attribute, $._maybe_attribute],
[$._module_attribute, $._maybe_at_attribute],
[$._maybe_basic_type, $.primary_expression],
[$.type_ctors, $._maybe_in_out],
[$.enum_members, $._maybe_anonymous_enum_member],
[$._maybe_basic_type, $.basic_type],
[$._maybe_attribute, $.pragma_statement],
[$._decl_def, $._declaration, $._non_empty_statement_no_case_no_default],
[$.var_declarator_identifier, $.alt_declarator_identifier],
[$._maybe_add_expression, $.mul_expression],
[$.primary_expression, $.with_statement, $.symbol_tail],
[$.alt_declarator_inner, $.qualified_identifier, $.primary_expression],
[$.alt_declarator_inner, $.primary_expression],
[$.alt_declarator, $.qualified_identifier, $.primary_expression],
[$.primary_expression, $.template_value_parameter_default],
[$.asm_primary_exp],