Before, running Masamune::AbstractSyntaxTree.new("x = 1").variables would return this:
[[[1, 0], "x"]]
This isn't very descriptive, so I decided to change this to the following:
[{position: [1, 0], token: "x"}]
Since it's a hash inside an array it's easier to look it, and it should be easier to read since each piece of data has a key attached to it.
Why I'm not returning Masamune::AbstractSyntaxTree::DataNode objects
I want to add an option to return Masamune::AbstractSyntaxTree::DataNode objects when performing a search like msmn.variables, but since these objects tend to have a lot of information, I thought it would be beneficial to just return a list of hashes. I have made a note here to implement this though in case we want it in the future.
Before, running
Masamune::AbstractSyntaxTree.new("x = 1").variables
would return this:This isn't very descriptive, so I decided to change this to the following:
Since it's a hash inside an array it's easier to look it, and it should be easier to read since each piece of data has a key attached to it.
Why I'm not returning
Masamune::AbstractSyntaxTree::DataNode
objectsI want to add an option to return
Masamune::AbstractSyntaxTree::DataNode
objects when performing a search likemsmn.variables
, but since these objects tend to have a lot of information, I thought it would be beneficial to just return a list of hashes. I have made a note here to implement this though in case we want it in the future.