[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FR-devel] Introduction / Folding and Smart Indent
From: |
Brian Denny |
Subject: |
Re: [FR-devel] Introduction / Folding and Smart Indent |
Date: |
Mon, 6 May 2002 14:14:52 -0700 (PDT) |
> Give a look to my mail on folding and smart indent. See if you have other
> ideas. What is needed here is basically a small parser that identify the
> code structure. It has the advantage of being fairly easy to unit test.
i looked at your e-mail and tried it out in Practical Ruby. Very cool how
much is accomplished by such a simple algorithm!
i noticed that "begin/rescue" and "elsif" were missing. i believe this
can be handled the same way as the other keywords? (diff follows this e-mail)
i suppose the next step would be to handle:
[1, 2, 3].each do |n|
puts n
end
... which i guess is a matter of dealing with keywords that don't begin
the line.
i imagine that some of the other smart editing features may require that we
actually run the document through a full-blown ruby parser. do you think
it would be advantageous to use the resulting parse tree for smart indent
and folding as well?
-brian
$ diff EditControl.rb.orig EditControl.rb
205c205
< %w( end else ).include?( firstKeyWord )
---
> %w( end else elsif rescue ).include?( firstKeyWord )
213c213
< %w( module class def for while do if else ).include?( firstKeyWord )
---
> %w( module class def for while do if else begin elsif rescue ).include?(
> firstKeyWord )