eatkins / tree-sitter-ebnf-generator

Convert an EBNF grammar to the tree-sitter dsl
GNU General Public License v3.0
24 stars 2 forks source link

The inline array doesn't check for duplicate or non existing values #10

Closed mingodad closed 3 years ago

mingodad commented 3 years ago

Trying to convert the "src/grammar.json" to SQL (https://github.com/mingodad/plgh/blob/main/json2sql.js) on the grammars listed here https://github.com/mingodad/plgh I found some grammars that have duplicate entries or non defined entries in the inline array and tree-sitter doesn't alert the user about it and silently go ahead.

For example when an entry in the inline array is not defined anywhere or duplicated we have this in the "src/grammar.json" (https://github.com/tree-sitter/tree-sitter-haskell) see ReferenceError and the duplicated _qtycon:

  "inline": [
    "_number",
...
    "ReferenceError",
    "ReferenceError",
    "_qtycon",
    "_gtycon",
    "ReferenceError",
..
    "_tyfam_pat_infix"
  ],
  "supertypes": []
mingodad commented 3 years ago

My bad this is for tree-sitter, sorry !