tree-sitter-grammars / tree-sitter-odin

Odin grammar for tree-sitter
MIT License
19 stars 4 forks source link

bug: "if ... do ... else do ..." not parsed correctly #16

Closed terickson001 closed 6 months ago

terickson001 commented 6 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

The following code causes an error in the parser.

package main

main :: proc() {
    if true do bar()
    else do baz()
}

Steps To Reproduce/Bad Parse Tree

(package_declaration) ; [1:1 - 12]
 (identifier) ; [1:9 - 12]
(procedure_declaration) ; [3:1 - 6:1]
 (identifier) ; [3:1 - 4]
 (procedure) ; [3:9 - 6:1]
  (parameters) ; [3:13 - 14]
  (block) ; [3:16 - 6:1]
   (if_statement) ; [4:2 - 5:14]
    condition: (boolean) ; [4:5 - 8]
     (call_expression) ; [4:13 - 17]
      function: (identifier) ; [4:13 - 15]
     (identifier) ; [5:7 - 8]
    consequence: (call_expression) ; [5:10 - 14]
     function: (identifier) ; [5:10 - 12]

Expected Behavior/Parse Tree

I expected the parse tree to contain 2 consequences and an else_clause

Repro

No response

amaanq commented 6 months ago

thanks, this is now fixed