File: generate_metagrammar.rb

package info (click to toggle)
ruby-treetop 1.6.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 956 kB
  • sloc: ruby: 8,918; makefile: 5
file content (13 lines) | stat: -rw-r--r-- 470 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env ruby

require 'rubygems'
require File.expand_path('../../lib/treetop/bootstrap_gen_1_metagrammar', __FILE__)

GENERATED_METAGRAMMAR_PATH = File.expand_path('../../lib/treetop/compiler/metagrammar.rb')

File.open(METAGRAMMAR_PATH) do |source_file|
  File.open(GENERATED_METAGRAMMAR_PATH, 'w') do |target_file|
    generated_source = Treetop::Compiler::MetagrammarParser.new.parse(source_file.read).compile
    target_file.write(generated_source)
  end
end