public
Description: A Ruby-based parsing DSL based on parsing expression grammars.
Homepage: http://treetop.rubyforge.org
Clone URL: git://github.com/nathansobo/treetop.git
rename load_string to load_from_string, ruby_source_string to 
ruby_source_from_string
per halorgium's suggestion
hagabaka (author)
Mon May 26 10:23:45 -0700 2008
commit  1dc77b3ebf41f2c4fe1274dfe60ea6aaaacd71fd
tree    44f02813aea5e59becf5c83921e2275f2616d4fd
parent  f55034d35fa1460282b33a2da6330dee3fca4458
...
9
10
11
12
 
13
14
15
16
 
17
18
19
...
28
29
30
31
 
32
33
34
35
36
 
37
38
 
39
40
...
9
10
11
 
12
13
14
15
 
16
17
18
19
...
28
29
30
 
31
32
33
34
35
 
36
37
 
38
39
40
0
@@ -9,11 +9,11 @@ module Treetop
0
 
0
       # compile a treetop file into ruby
0
       def ruby_source(source_path)
0
- ruby_source_string(File.read(source_path))
0
+ ruby_source_from_string(File.read(source_path))
0
       end
0
 
0
       # compile a string containing treetop source into ruby
0
- def ruby_source_string(s)
0
+ def ruby_source_from_string(s)
0
         parser = MetagrammarParser.new
0
         result = parser.parse(s)
0
         unless result
0
@@ -28,13 +28,13 @@ module Treetop
0
   def self.load(path)
0
     adjusted_path = path =~ /\.(treetop|tt)\Z/ ? path : path + '.treetop'
0
     File.open(adjusted_path) do |source_file|
0
- load_string(source_file.read)
0
+ load_from_string(source_file.read)
0
     end
0
   end
0
 
0
   # compile a treetop source string and load it
0
- def self.load_string(s)
0
+ def self.load_from_string(s)
0
     compiler = Treetop::Compiler::GrammarCompiler.new
0
- Object.class_eval(compiler.ruby_source_string(s))
0
+ Object.class_eval(compiler.ruby_source_from_string(s))
0
   end
0
 end
...
40
41
42
43
44
 
 
45
46
47
48
 
 
49
50
51
...
40
41
42
 
 
43
44
45
46
 
 
47
48
49
50
51
0
@@ -40,12 +40,12 @@ describe Compiler::GrammarCompiler do
0
     compiler.ruby_source(source_path_with_treetop_extension).should_not be_nil
0
   end
0
   
0
- specify "ruby_source_string compiles a grammar stored in string" do
0
- compiler.ruby_source_string(File.read(source_path_with_treetop_extension)).should_not be_nil
0
+ specify "ruby_source_from_string compiles a grammar stored in string" do
0
+ compiler.ruby_source_from_string(File.read(source_path_with_treetop_extension)).should_not be_nil
0
   end
0
 
0
- specify "Treetop.load_string compiles and evaluates a source grammar stored in string" do
0
- Treetop.load_string File.read(source_path_with_treetop_extension)
0
+ specify "Treetop.load_from_string compiles and evaluates a source grammar stored in string" do
0
+ Treetop.load_from_string File.read(source_path_with_treetop_extension)
0
     Test::GrammarParser.new.parse('foo').should_not be_nil
0
   end
0
 

Comments

    No one has commented yet.