UserNobody14 / tree-sitter-dart

Attempt to make a tree-sitter grammar for dart
MIT License
62 stars 40 forks source link

Mark the rule '_if_null_expression' explicitly as inline #32

Closed mjambon closed 2 years ago

mjambon commented 2 years ago

This marks the rule _if_null_expression explicitly as inline so as to not rely on tree-sitter auto-inlining it. We run into a problem when we unhide (automatically) the rule by removing the leading underscore. This causes the rule to no longer be inlined, resulting in the following conflict:

dart: Importing initial 'grammar.json'.
dart: Simplifying 'grammar.json' for ocaml-tree-sitter.
dart: Recovering informational JS grammars from JSON.
dart: Generating definitive 'parser.c'.
Unresolved conflict for symbol sequence:

  real_expression  if_null_expression__repeat1  •  '??'  …

Possible interpretations:

  1:  real_expression  (if_null_expression_  if_null_expression__repeat1)  •  '??'  …
  2:  real_expression  (if_null_expression__repeat1  if_null_expression__repeat1  •  if_null_expression__repeat1)

Possible resolutions:

  1:  Specify a left or right associativity in `if_null_expression_`
  2:  Add a conflict for these rules: `if_null_expression_`

The issue is tracked here: https://github.com/tree-sitter/tree-sitter/issues/1683

aryx commented 2 years ago

ping @UserNobody14 Could we merge this? This is useful to add support for Dart in semgrep.