Ruby lang spec

This forum should be used for all code folding problems, questions or suggestions. You can also use this forum to request folding support for a new language.
Post Reply
jcso01
Posts: 6
Joined: Tue Sep 14, 2004 6:55 am

Ruby lang spec

Post by jcso01 »

Hi:
I send the definition for the ruby language

Code: Select all

    Extension: .rb .rbw .rbs
 Line Comment: #
Block Comment: =begin =end
        Begin: begin
          End: end
        Begin: class
          End: end
        Begin: def
          End: end
        Begin: if
          End: end
        Begin: do
          End: end
        Begin: {
          End: }
  Sample Code:
  class Example
      def method_example

        if marked == 1
          top   = get_marked_top()
        end  #if

        lines=gets

        lines.for_each do |i|
          puts i
        end  #do

        lines.for_each{|i|
          puts i
        }  #braces

      end
  end
Cheers
JcSO
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

The code folding for Ruby has been implemented and the new xFolder.dll can be found here: http://www.zeusedit.com/z300/zfolder.zip

To use this zip file, make sure Zeus is not running, go to the Zeus installation directory, make a backup copy of the current xFolder.dll file and replace the dll with the one contained in this zip file.

You may also need to enable the Display line folds margin option found in the Ruby Document Type.

The following Ruby sample code was used to test the folding:

Code: Select all

# Sample Ruby Code
=begin
This is a block comment. This example class uses
the line comments and the if, do and def keywords
=end
class Example
    # the if do def case
    def method_example

      if marked == 1
        top   = get_marked_top()
      end  #if

      lines=gets

      lines.for_each do |i|
        puts i
      end  #do

      lines.for_each{|i|
        puts i
      }  #braces

    end
end
If you find any problems with this new dll just post a reply to this topic.

Cheers Jussi
Last edited by jussij on Tue Mar 01, 2005 5:40 am, edited 1 time in total.
DanNeufeldt

Post by DanNeufeldt »

Hey jussij, I'm probably doing something wrong, but the ruby folding is not working for me. I downloaded the new xfolder.rb, copied it to the zeus directory and started Zeus. Line folds margin is turned on.

I can't think of much other info to give you. I've changed all the color settings and added a few keywords, but that doesnt seem like it should make a difference.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Dan,

I downloaded the xFolder.zip file and sure enough, as you say it did not fold, so I guess the mistake is mine :(

I not sure how that happend but in any case I have uploaded another xFolder.zip file and this time I even tested the link to make sure it also folds the correctly.

Thank you for pointing out my mistake :oops:

Cheers Jussi
DanNeufeldt

Post by DanNeufeldt »

Ok, I definitely must be doing something wrong now as it is still not working. Is there something I might have changed that would cause this to not work?
DanNeufeldt

Post by DanNeufeldt »

Oh, I forgot to mention that is working for C++ files, just not ruby. I haven't tested any other languages yet.
Dan Neufeldt

Post by Dan Neufeldt »

Here's something that may help.
I have another langauge that I write in a lot, and it has a syntax similar to Perl or C.

The extension for this language is .mel.

If I switch the association for .mel files from the highlighter I have for it to perl or C/C++, the folding does not carry over for Mel files.
However, if I start a new .pl file and begin writing mel code, the folding works. I don't know if this is related, i tried 3 different ruby extensions (rb, rbw, rbs) and no folding happened with any.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Dan,

There is definitely something very stange going on :?

When I test the xfolder.dll straight from the zip file the folding works fine. But if I then upload the exact same zip file to the web site then download the file and repeat the test the folding no longer works :(

What is even more bizzare is if I delete the zip entirely from the web site, somehow I can still download the zip file even though the file no longer exists. I am not exactly sure why this would be possible, but it looks like the zip file is being cached by the web hosting provider and the cached version is the older version.

So to get around this problem I have uploaded the dll to the http://www.zeusedit.com/z300/zfolder.zip file. I did two download tests on this new file and it now seems to work. This is the first time I have so much trouble uploading a simple zip file so I hope you also have similar success.
If I switch the association for .mel files from the highlighter I have for it to perl or C/C++, the folding does not carry over for Mel files.

For this initial work with folding, it was decided that for now the mapping of folding style to file extension would be hard coded. Because the .mel file extension has not been mapped there is no folding available for this extension.

But in the preperation of the new zfolder.zip a mapping for the .mel extension was also added (it is now mapped to the Perl folding style) so you should hopefully find the mel folding also works.

Cheers Jussi
Guest

Post by Guest »

Awesome, it works perfectly. This is so great having folding for Ruby and Mel.

Mel is the embedded language for Alias' Maya software (3d package), I've been using Maya and Mel for about 2 years now, and this is the first time I've been able to use an editor that is fully customizable so it can fit with a fairly unknown language, and has code folding as well.

Zeus is awesome, thanks a ton!
DanNeufeldt

Post by DanNeufeldt »

Ok, I hate to bring this up after you just added mel support and everything, but the definition for the ruby language was not complete so whenever you get the chance.

here is a more complete version:

Code: Select all

Extension: .rb .rbw .rbs
Line Comment: #
Block Comment: =begin =end
	Begin: begin
		End: end
	Begin: class
		End: end
	Begin: module
		End: end
	Begin: def
		End: end
	Begin: if
		End: end
	Begin: do
		End: end
	Begin: {
		End: }
	Begin: while
		End: end
	Begin: for
		End: end

module Ex
	class Example
		def method_example
			if true
				false
			end #if
			l = lambda{
				while true
					break
				end #while
			} #braces
		end
	end
end

the only changes are the addition of the while and for loops, and the module keyword.

Thanks again,[/b]
Guest

Post by Guest »

updates to lang spec, as I remembered a couple other loops and statments

Code: Select all

Extension: .rb .rbw .rbs
Line Comment: #
Block Comment: =begin =end
   Begin: begin
      End: end
   Begin: class
      End: end
   Begin: module
      End: end
   Begin: def
      End: end
   Begin: if
      End: end
   Begin: do
      End: end
   Begin: {
      End: }
   Begin: while
      End: end
   Begin: for
      End: end
	Begin: until
		End: end
	Begin: unless
		End: end

module Ex
   class Example
      def method_example
         if true
            false
         end #if
         l = lambda{
            while true
               break
            end #while
         } #braces
      end
   end
end 
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

A new http://www.zeusedit.com/z300/zfolder.zip file has been uploaded. This dll implements folding based on the newer ruby language specification of the previous post.

Jussi
Post Reply