tree-sitter-c
tree-sitter-c copied to clipboard
Add else_clause
This would fix problems like this: https://github.com/nvim-treesitter/nvim-treesitter-context/issues/72
For info, this else_clause already exists in treesitter's JS, Python and Rust parser (did not check other languages).
E.g.:
if (true) {
foo();
} else if (true) {
bar();
} else {
foobar();
}
Old parse was:
(translation_unit [0, 0] - [7, 0]
(if_statement [0, 0] - [6, 1]
condition: (parenthesized_expression [0, 3] - [0, 9]
(true [0, 4] - [0, 8]))
consequence: (compound_statement [0, 10] - [2, 1]
(expression_statement [1, 2] - [1, 8]
(call_expression [1, 2] - [1, 7]
function: (identifier [1, 2] - [1, 5])
arguments: (argument_list [1, 5] - [1, 7]))))
alternative: (if_statement [2, 7] - [6, 1]
condition: (parenthesized_expression [2, 10] - [2, 16]
(true [2, 11] - [2, 15]))
consequence: (compound_statement [2, 17] - [4, 1]
(expression_statement [3, 2] - [3, 8]
(call_expression [3, 2] - [3, 7]
function: (identifier [3, 2] - [3, 5])
arguments: (argument_list [3, 5] - [3, 7]))))
alternative: (compound_statement [4, 7] - [6, 1]
(expression_statement [5, 2] - [5, 11]
(call_expression [5, 2] - [5, 10]
function: (identifier [5, 2] - [5, 8])
arguments: (argument_list [5, 8] - [5, 10])))))))
New parse is:
(translation_unit [0, 0] - [7, 0]
(if_statement [0, 0] - [6, 1]
condition: (parenthesized_expression [0, 3] - [0, 9]
(true [0, 4] - [0, 8]))
consequence: (compound_statement [0, 10] - [2, 1]
(expression_statement [1, 2] - [1, 8]
(call_expression [1, 2] - [1, 7]
function: (identifier [1, 2] - [1, 5])
arguments: (argument_list [1, 5] - [1, 7]))))
alternative: (else_clause [2, 2] - [6, 1]
(if_statement [2, 7] - [6, 1]
condition: (parenthesized_expression [2, 10] - [2, 16]
(true [2, 11] - [2, 15]))
consequence: (compound_statement [2, 17] - [4, 1]
(expression_statement [3, 2] - [3, 8]
(call_expression [3, 2] - [3, 7]
function: (identifier [3, 2] - [3, 5])
arguments: (argument_list [3, 5] - [3, 7]))))
alternative: (else_clause [4, 2] - [6, 1]
(compound_statement [4, 7] - [6, 1]
(expression_statement [5, 2] - [5, 11]
(call_expression [5, 2] - [5, 10]
function: (identifier [5, 2] - [5, 8])
arguments: (argument_list [5, 8] - [5, 10])))))))))
@jdrouhard any idea what is this appveyor thing? Why this tree-sitter repo uses a different kind of CI?