Test case (taken from user_interaction.rb from Ruby distribution):
module UserInteraction
include DefaultUserInteraction
[
:choose_from_list, :ask, :ask_yes_no, :say, :alert, :alert_warning,
:alert_error, :terminate_interaction!, :terminate_interaction
].each do |methname|
class_eval %{
def #{methname}(*args)
ui.#{methname}(*args)
end
}
end
end
"#{methname}" is incorrectly treated as comment (it is not).
Logged In: YES
user_id=12579
Originator: NO
Since I don't use Ruby, I won't be working on this myself.
This is not a bug in handling #{, its a bug in handling %{. I don't have a compile environment for scintilla, so I can't test this, but I'm fairly certain the fix is just:
$ diff LexRuby.cxx LexRuby.cxx.fix2093767
980a981
> Quote.New();
Every instance of Quote.Open() is preceded by Quote.New() except in this %{ case. Should I push a patch? Haven't done that to scintilla yet and I don't have a compiler or test cases to verify.
The patch made no difference to the example for me. Patches are easier to correctly apply when they contain some context.
Sorry that patch only fixed this bug in one of two cases. I have a better and much lengthier patch that fixes this as well as part 1) of https://sourceforge.net/tracker/index.php?func=detail&aid=3058496&group_id=2439&atid=102439 and the error mentioned in LexRuby.cxx line 1468.
I am unfamiliar with submitting patches to a project on Sourceforge. How do I submit such a patch? This patch is about 70 lines in diff format.
Create an issue and you can put the patch or the whole file in the 'Attached File' section. Otherwise stick it on the web somewhere and post an URL.
I'm not all up to speed on the sourceforge development/bugfix process. I've uploaded my fix to
http://s3.amazonaws.com/13800/page_attachments/13/LexRuby.cxx
and zipped up at
http://s3.amazonaws.com/13800/page_attachments/14/LexRuby.zip
(I think I saw that zipped patches were preferred.) I also wrote a post about this goofy syntax that should be highlighted and folded correctly wtih this patch (including the syntax in the Details above) at
http://fwiw.heroku.com/articles/2010/10/10/ruby-bizarre-and-correct-ruby-syntax/
The patch also fixes part 1) of
https://sourceforge.net/tracker/index.php?func=detail&aid=3058496&group_id=2439&atid=102439 like so:
1.2 #=> should be highlighted as a number
1..2 #=> "1" and "2" are numbers, the dots are default
1...2 #=> "1" and "2" are numbers, the dots are default
(patch taken from Perl's lexer which lexes this correctly.)
also the problem mentioned in LexRuby.cxx line 1468:
foo = 1 \ if bar #=> "if" should be demoted!
foo = \ if bar then 1 else 2 end #=> "if" should not be demoted!
Is there a link/guide to the sourceforge or scintilla bugfix process? When you say "Create an issue", do you mean create a Bug? I only see creating Bugs and Feature Requests...
Sorry, that last comment was me, logged out. And the fix regarding demoted is better expressed:
foo = 1 \ if bar #=> "if" should be demoted!
foo = \ if bar #=> "if" should not be demoted!
1
else
2
end
Committed.
There is no defined Scintilla bugfix process.
To help people trying to work on this code, it is better to split patches into individual fixes. That way they can more easily back out any fix that causes problems. Therefore, the patch was committed in three pieces.
Thanks nyamatongwe. Sorry about patching multiple fixes in one go, I'm sure that could get hairy if problems arise.
Since this only fixed one part of https://sourceforge.net/tracker/index.php?func=detail&aid=3058496&group_id=2439&atid=102439, I didn't post anything in the comments there, but I plan on patching other problems in the Ruby lexer that are enumerated in that bug. I will continue those patches individually, and by commenting on that bug.