Closed berchn closed 1 year ago
The optionality should be removed here, but I think it might require additional handling to ensure that EOF inserts a final newline (terminator): https://github.com/tree-sitter/tree-sitter-go/blob/07d722831382a043b16547b6d9202f3da07f3cb3/grammar.js#L107
I suspect in practice it's less trouble to make the parsers overgenerous in what they accept than to have to analyze the dark corners perfectly (where compilers often have bugs too).
source_file
allowsBLANK
to follow_top_level_declaration
insrc/grammar.json
. This is resulting in an AST that doesn't appear to be valid. The following code parses without error or the addition of any zero-width tokens, but it does not compile:This is due to the
optional(terminator)
in the relevant section of thesource_file
rule ingrammar.js
. Is this intended?