Skip to content

Commit

Permalink
Manually inline _locally_permitted_modifiers
Browse files Browse the repository at this point in the history
See semgrep/ocaml-tree-sitter-semgrep#286

When generating a simplified grammar, the `ocaml-tree-sitter` code
generator forces all hidden nodes to be visible. It appears that hidden
nodes automatically get marked as `inline`, and that without that
auto-inlining, the `_locally_permitted_modifiers` rule causes a
conflict.

Rather than making the semgrep folks work around their conflict, we just
check the `inline` declaration into the grammar itself so that it sticks
around in the simplified grammar.
  • Loading branch information
alex-pinkus committed Mar 9, 2022
1 parent 5c10525 commit ede22f6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ module.exports = grammar({
$._as_bang_custom,
$._async_keyword_custom,
],
inline: ($) => [$._locally_permitted_modifiers],
rules: {
////////////////////////////////
// File Structure
Expand Down

0 comments on commit ede22f6

Please sign in to comment.