soml-parser/lib/salama-reader.rb

23 lines
379 B
Ruby
Raw Normal View History

2014-06-04 19:51:25 +02:00
require 'parslet'
2014-07-29 17:36:18 +02:00
require 'parser/salama'
2015-09-19 13:53:59 +02:00
require "ast"
2014-06-04 19:51:25 +02:00
require 'parser/transform'
2015-09-19 13:53:59 +02:00
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