class LL::CodeGenerator
The CodeGenerator
class takes a {LL::CompiledConfiguration} instance and turns it into a block of Ruby source code that can be used as an actual LL(1) parser.
Constants
- TEMPLATE
The ERB template to use for code generation.
@return [String]
Public Instance Methods
generate(config, add_requires = true)
click to toggle source
@param [LL::CompiledConfiguration] config @param [TrueClass|FalseClass] add_requires @return [String]
# File lib/ll/code_generator.rb, line 20 def generate(config, add_requires = true) context = ERBContext.new( :config => config, :add_requires => add_requires ) template = File.read(TEMPLATE) erb = ERB.new(template, nil, '-').result(context.get_binding) return erb end