tree-sitter-python
tree-sitter-python copied to clipboard
Tab is treated as 8 spaces
Bug in source code:
https://github.com/tree-sitter/tree-sitter-python/blob/24b530ca158d2782ea9046e756057a412e16b52f/src/scanner.cc#L242
Minimal example: test-indent.txt
> tree-sitter parse ../test-indent.txt
(module [0, 0] - [3, 0]
(function_definition [0, 0] - [2, 39]
name: (identifier [0, 4] - [0, 9])
parameters: (parameters [0, 9] - [0, 11])
body: (block [1, 8] - [2, 39]
(expression_statement [1, 8] - [1, 49]
(call [1, 8] - [1, 49]
function: (identifier [1, 8] - [1, 13])
arguments: (argument_list [1, 13] - [1, 49]
(string [1, 14] - [1, 48]))))
(expression_statement [2, 1] - [2, 39]
(call [2, 1] - [2, 39]
function: (identifier [2, 1] - [2, 6])
arguments: (argument_list [2, 6] - [2, 39]
(string [2, 7] - [2, 38])))))))
Python 3 disallow mixed use of spaces and tabs for indentation, so I think the above file should not give a valid result.