usagi-coffee / tree-sitter-abl

OpenEdge ABL grammar for tree-sitter
MIT License
5 stars 1 forks source link

Change request to improve FOR statement structure #58

Closed PauliusKu closed 2 weeks ago

PauliusKu commented 2 weeks ago

Currently we have this FOR statement structure:

for_statement
--- EACH
--- identifier
--- where_clause
...
--- body
------ abl_statement
...

We ran into problems when trying to implement code formatting logic for this structure. The main issue is that header nodes are under the same level as body node. As body starts with the first statement inside it, and not with : symbol, for formatting proposes we have to use whole range of for_statement node. And this leads to further issues when trying to create formatting algorithm.

The best solution for us would be to have additional node (e.g. for_header). Something like this:

for_statement
--- for_header
------ EACH
------ identifier
------ where_clause
...
--- body
------ abl_statement
...
jkbz64 commented 2 weeks ago

Would reworking body element to include ':' character instead work for you?

PauliusKu commented 2 weeks ago

Yes, that would be fine.

jkbz64 commented 2 weeks ago

Should be fixed with b1f5901