Open
Description
Did you check the tree-sitter docs?
- I have read all the tree-sitter docs if it relates to using the parser
Is your feature request related to a problem? Please describe.
Currently, when defining a macro with a trailing backslash \
at the end of the last line, the parse tree extends the preproc_arg
end position to the next line.
For example, given:
#define ADD(x, y) \
((x) + (y)) \
The parse tree is:
translation_unit [0, 0] - [2, 0]
preproc_function_def [0, 0] - [2, 0]
#define [0, 0] - [0, 7]
name: identifier [0, 8] - [0, 11]
parameters: preproc_params [0, 11] - [0, 17]
( [0, 11] - [0, 12]
identifier [0, 12] - [0, 13]
, [0, 13] - [0, 14]
identifier [0, 15] - [0, 16]
) [0, 16] - [0, 17]
value: preproc_arg [1, 4] - [2, 0] // Ends at position [2, 0]
Describe the solution you'd like
I was instead wondering if it would be possible to ensure that, in the parse tree, even with a \
at the end of the last line of the macro, the final position of the preproc_arg
node matches the following case:
#define ADD(x, y) \
((x) + (y))
Where the resulting parse tree is:
translation_unit [0, 0] - [2, 0]
preproc_function_def [0, 0] - [2, 0]
#define [0, 0] - [0, 7]
name: identifier [0, 8] - [0, 11]
parameters: preproc_params [0, 11] - [0, 17]
( [0, 11] - [0, 12]
identifier [0, 12] - [0, 13]
, [0, 13] - [0, 14]
identifier [0, 15] - [0, 16]
) [0, 16] - [0, 17]
value: preproc_arg [1, 4] - [1, 16] // Ends at position [1, 16]