spec/sample_xel_spec.rb in raabro-1.0.0 vs spec/sample_xel_spec.rb in raabro-1.0.1

- old
+ new

@@ -22,11 +22,12 @@ def funame(i); rex(:funame, i, /[A-Z][A-Z0-9]*/); end def fun(i); seq(:fun, i, :funame, :args); end def exp(i); alt(:exp, i, :fun, :num); end - # entry point .parse + #alias root exp + # not necessary since Raabro takes the last defined parser as the root def rewrite(tree) case tree.name when :exp @@ -37,18 +38,9 @@ [ tree.children[0].string ] + tree.children[1].children.collect { |e| rewrite(e) } else fail ArgumentError.new("cannot rewrite #{tree.to_a.inspect}") end - end - - def parse(input) - - t = all(nil, Raabro::Input.new(input, :prune => true), :exp) - - return nil if t.result != 1 - - rewrite(t.children.first.shrink!) end end describe Raabro do