Skip to content

AST: starting visiting comments#13421

Merged
MarcusDenker merged 9 commits intopharo-project:Pharo12from
privat:visit-comments
Apr 14, 2023
Merged

AST: starting visiting comments#13421
MarcusDenker merged 9 commits intopharo-project:Pharo12from
privat:visit-comments

Conversation

@privat
Copy link
Contributor

@privat privat commented Apr 12, 2023

Tries to make comments, first-class citizens of the AST. Or at least second-class citizens... Still better than the cargo hold.

This includes:

  • new method childrenAndComments to have both (direct) children and (direct) comments
  • nodesDo: (and related) visit comments
  • nodeForOffset: can return a comment node
  • add visitCommentNode: to the RBProgramNodeVisitor.

The first three should be safe since clients using them cannot expect specific nodes and just select what they need.
The last one should also be safe because comments are not automatically visited (yet!), but it might allow custom clients to use the hook for custom visit.

The API of RBProgramNodeVisitor need love, but there are a lot of clients, so it's not simple to improve it.
Maybe a simpler approach could be having a second visitor, then switch clients one by one.

@jecisc
Copy link
Member

jecisc commented Apr 12, 2023

YES! \0/

This is on my todo list since 4 years now (but not enough time…). Thank you :)

@privat privat changed the base branch from Pharo12 to Pharo11 April 13, 2023 13:08
@privat privat changed the base branch from Pharo11 to Pharo12 April 13, 2023 13:08
@privat privat changed the base branch from Pharo12 to Pharo11 April 13, 2023 17:40
@privat privat changed the base branch from Pharo11 to Pharo12 April 13, 2023 17:40
@MarcusDenker MarcusDenker merged commit 8d5febe into pharo-project:Pharo12 Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants