#719 Ruby Lexer Incorrectly handle #{...}

Bug
closed-fixed
Neil Hodgson
Scintilla (788)
3
2011-05-25
2008-09-04
jianpingw
No

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).

Discussion

1 2 > >> (Page 1 of 2)
  • Neil Hodgson
    Neil Hodgson
    2008-09-05

    Logged In: YES
    user_id=12579
    Originator: NO

    Since I don't use Ruby, I won't be working on this myself.

     
  • Neil Hodgson
    Neil Hodgson
    2008-09-05

    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
    • status: open --> open-accepted
     
  • Sam Rawlins
    Sam Rawlins
    2010-10-07

    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.

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-10

    The patch made no difference to the example for me. Patches are easier to correctly apply when they contain some context.

     
  • Sam Rawlins
    Sam Rawlins
    2010-10-11

    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.

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-11

    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.

     
  • Sam Rawlins
    Sam Rawlins
    2010-10-12

    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

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-20

    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.

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-20

    • status: open-accepted --> open-fixed
     
1 2 > >> (Page 1 of 2)