soml-parser/lib/salama-reader.rb
2015-09-19 16:25:42 +03:00

23 lines
381 B
Ruby

require 'parslet'
require 'parser/salama'
require "ast"
require 'parser/transform'
AST::Node.class_eval do
def [](name)
puts self.inspect
children.each do |child|
if child.is_a?(AST::Node)
#puts child.type
if (child.type == name)
return child.children
end
else
#puts child.class
end
end
nil
end
end