class Antelope::Generator::Info
Generates an output file, mainly for debugging. Included always as a generator for a grammar.
Public Class Methods
new(*)
click to toggle source
Defines singleton method for every mod that the grammar passed to the generator.
@see Generator#initialize
Calls superclass method
Antelope::Generator::Base::new
# File lib/antelope/generator/info.rb, line 16 def initialize(*) super mods.each do |k, v| define_singleton_method (k) { v } end end
Public Instance Methods
generate()
click to toggle source
Actually performs the generation. Uses the template in output.erb, and generates the file ‘<file>.output`.
@return [void]
# File lib/antelope/generator/info.rb, line 42 def generate template "info", "#{file}.inf" end
unused_symbols()
click to toggle source
# File lib/antelope/generator/info.rb, line 23 def unused_symbols @_unused_symbols ||= begin used = grammar.all_productions.map(&:items).flatten.uniq all = grammar.symbols.map do |s| if Symbol === s grammar.find_token(s) else s end end all - used - [grammar.find_token(:"$start")] end end