gazayas / masamune-ast

A covenience wrapper around Prism, a Ruby source code parser
MIT License
13 stars 1 forks source link

Extract AST nodes into classes #10

Closed gazayas closed 1 year ago

gazayas commented 1 year ago

This pull request introduces the following classes:

  1. Masamune::AbstractSyntaxTree::Node
  2. Masamune::AbstractSyntaxTree::DataNode
  3. Masamune::AbstractSyntaxTree::NodeRegistry

Extracting this information from Masamune::AbstractSyntaxTree will help to understand what types of nodes exist within the tree and how different types are handled since they each have their own structure. The search function is pretty cluttered right now too, so I'm hoping it will be easier to read after finishing this pull request.

gazayas commented 1 year ago

There's a lot here, but I'm really happy with how it's turning out. The original search method was an absolute mess, but I was still getting familiar with the types of nodes that exist and how to retrieve data nodes from them so I don't mind too much.

Things are a lot easier to manage now, so I can focus on the type of data I want to return. After things are settled with that, the next step is to move on to the code replacement class, and then the plan is to actually use this gem in an actual project.