W
Wolfgang Nádasi-Donner
Some weeks ago I sent a message here, "Onigurama - Problem with Subexpression Call", sent on Montag, 27. Juni
2005 23:22 - unfortunately there was no comment from someone. So I try to ask the major part again.
If I'm correcly informed, the Regular Expression Engine used by Ruby will be Onigurama, starting in Ruby 1.9.
Where is the right place to sent Problem Reports or Change Recommendations against Onigurama? The Engine
itself is not only used in the Ruby environment, so I don't know what to do with Problems that have to be
addressed to Onigurama in the Ruby environment.
***** Problem Report *****
Onigurama does not recognize left recursion correctly.
As I wrote in my earlier message
-----------------------------------------------------------
orgstring= "5-((3+4)*5)+6+xx"
pattern = /^(?<bal>[^()]*(\(\g<bal>\)[^()]*)*)$/
puts "\nMuster: #{pattern.inspect}\nString: '#{orgstring}'"
if (res = orgstring.match(pattern)) then
puts "Match: '#{res}'"
else
puts "+++++ No Match"
end
-----------------------------------------------------------
produces the Error Message
-----------------------------------------------------------
never ending recursion: /^(?<bal>[^()]*(\(\g<bal>\)[^()]*)*)$/
-----------------------------------------------------------
which is definitely wrong. After using a useless alternative in this expression it works fine
-----------------------------------------------------------
orgstring= "5-((3+4)*5)+6+xx"
pattern = /^(?<bal>[^()]*((x|(\(\g<bal>\)))[^()]*)*)$/
puts "\nMuster: #{pattern.inspect}\nString: '#{orgstring}'"
if (res = orgstring.match(pattern)) then
puts "Match: '#{res}'"
else
puts "+++++ No Match"
end
2005 23:22 - unfortunately there was no comment from someone. So I try to ask the major part again.
If I'm correcly informed, the Regular Expression Engine used by Ruby will be Onigurama, starting in Ruby 1.9.
Where is the right place to sent Problem Reports or Change Recommendations against Onigurama? The Engine
itself is not only used in the Ruby environment, so I don't know what to do with Problems that have to be
addressed to Onigurama in the Ruby environment.
***** Problem Report *****
Onigurama does not recognize left recursion correctly.
As I wrote in my earlier message
-----------------------------------------------------------
orgstring= "5-((3+4)*5)+6+xx"
pattern = /^(?<bal>[^()]*(\(\g<bal>\)[^()]*)*)$/
puts "\nMuster: #{pattern.inspect}\nString: '#{orgstring}'"
if (res = orgstring.match(pattern)) then
puts "Match: '#{res}'"
else
puts "+++++ No Match"
end
-----------------------------------------------------------
produces the Error Message
-----------------------------------------------------------
never ending recursion: /^(?<bal>[^()]*(\(\g<bal>\)[^()]*)*)$/
-----------------------------------------------------------
which is definitely wrong. After using a useless alternative in this expression it works fine
-----------------------------------------------------------
orgstring= "5-((3+4)*5)+6+xx"
pattern = /^(?<bal>[^()]*((x|(\(\g<bal>\)))[^()]*)*)$/
puts "\nMuster: #{pattern.inspect}\nString: '#{orgstring}'"
if (res = orgstring.match(pattern)) then
puts "Match: '#{res}'"
else
puts "+++++ No Match"
end