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
Fixed / inside of a char class generating a bad regex
Nathan Sobo (author)
Fri Feb 01 10:12:45 -0800 2008
commit  386c475d75d55eaac8f28c27d59bcaed01f5fe47
tree    9899ae65e7c9ed44420cba2ae40050af412339f7
parent  98df05870a656da0a9cd93431cc46223d3375d21
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@ module Treetop
0
       def compile(address, builder, parent_expression = nil)
0
         super
0
         
0
- builder.if__ "input.index(/#{text_value}/, index) == index" do
0
+ builder.if__ "input.index(/#{text_value.gsub('/', '\/')}/, index) == index" do
0
           assign_result "(#{node_class_name}).new(input, index...(index + 1))"
0
           extend_result_with_inline_module
0
           builder << "@index += 1"
...
45
46
47
 
 
 
 
 
 
 
 
48
49
...
45
46
47
48
49
50
51
52
53
54
55
56
57
0
@@ -45,4 +45,12 @@ module CharacterClassSpec
0
       parse('"').should_not be_nil
0
     end
0
   end
0
+
0
+ describe "A character class containing a /" do
0
+ testing_expression "[/]"
0
+
0
+ it "matches a /" do
0
+ parse("/").should_not be_nil
0
+ end
0
+ end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.