lib/treetop/compiler/grammar_compiler.rb in treetop-1.2.5 vs lib/treetop/compiler/grammar_compiler.rb in treetop-1.2.6

- old
+ new

@@ -26,10 +26,12 @@ # compile a treetop source file and load it def self.load(path) adjusted_path = path =~ /\.(treetop|tt)\Z/ ? path : path + '.treetop' File.open(adjusted_path) do |source_file| - load_from_string(source_file.read) + source = source_file.read + source.gsub!(/\b__FILE__\b/, %Q{"#{adjusted_path}"}) + load_from_string(source) end end # compile a treetop source string and load it def self.load_from_string(s)