Class: LL::CodeGenerator
- Inherits:
-
Object
- Object
- LL::CodeGenerator
- Defined in:
- lib/ll/code_generator.rb
Overview
The CodeGenerator class takes a CompiledConfiguration instance and turns it into a block of Ruby source code that can be used as an actual LL(1) parser.
Constant Summary
- TEMPLATE =
The ERB template to use for code generation.
File.('../driver_template.erb', __FILE__)
Instance Method Summary (collapse)
Instance Method Details
- (String) generate(config, add_requires = true)
20 21 22 23 24 25 26 27 28 29 30 |
# 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 |