lib/antelope/generator/ruby.rb in antelope-0.1.7 vs lib/antelope/generator/ruby.rb in antelope-0.1.8

- old
+ new

@@ -1,38 +1,40 @@ # encoding: utf-8 require "pp" module Antelope - class Generator + module Generator # Generates a ruby parser. - class Ruby < Generator + class Ruby < Base + register_as "ruby" + # Creates an action table for the parser. # # @return [String] def generate_action_table out = "" - PP.pp(mods[:tableizer].table, out) + PP.pp(table, out) out end # Outputs an array of all of the productions. # # @return [String] def generate_productions_list out = "[" - grammar.all_productions.each do |production| - out << - "[" << - production.label.name.inspect << - ", " << - production.items.size.inspect << + productions.each do |(label, size, block)| + out << + "[" << + label.name.inspect << + ", " << + size.inspect << ", " - block = if production.block.empty? + block = if block.empty? "proc { |_| _ }" else "proc #{production.block}" end