Forums

Single line doc strings

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Single line doc strings

Postby Charles » Wed Nov 12, 2008 2:18 am

Now implemented.

class X
def foo
""" Blah blah blah. """
pass

ticket:43
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Single line doc strings

Postby eric.sellon » Wed May 27, 2009 9:37 pm

I'm using the April 30, 2009 release and it forces me to put the opening and closing """ for the doc string on separate lines (and the actual content on the line between). Did this feature get broken? Or is Cobra just grumpy because I'm using Mono ;)
eric.sellon
 
Posts: 24

Re: Single line doc strings

Postby Charles » Thu May 28, 2009 12:26 am

I just tested on Mono on Mac and it works fine for me. Plus we have a test case for this.

I'm using the very latest so I suppose it could be broken in that release, although it seems unlikely. What error message or other behavior do you get? Perhaps include the output of "cobra -v:2 foo.cobra". Also what version of Mono? I'm on 2.4.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Single line doc strings

Postby eric.sellon » Thu May 28, 2009 3:36 pm

Never mind.... It's not a problem with the cobra.exe that I built off of trunk.... The August release is generating: error: Expecting EOL, but got ""Hi"" (STRING_DOUBLE) instead.

But I guess it doesn't matter since the current revision isn't having an issue.
eric.sellon
 
Posts: 24

Re: Single line doc strings

Postby Charles » Sat May 30, 2009 7:18 pm

Did you really mean "August release"?

There is no "Hi" in your example above. Can I get the exact file you are using? Because I just installed Cobra 2009-04-30 and I don't get any error for a single line doc string. I'm curious about this. Maybe you can attach it.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Single line doc strings

Postby eric.sellon » Sun May 31, 2009 6:52 pm

Yeah, it's the August release. You'll be breaking this feature in a couple of months. ;)
I meant the April release as it is what I have installed.

Code listing that I just made to recreate the problem follows
Code: Select all
#"""This is a test program"""

class Program
    def main is shared
        """Hi"""
        print "Hi"


The generated error is: error: test.cobra(5,11): error: Expecting EOL, but got ""Hi"" (STRING_DOUBLE) instead.
If the first line is uncommented, the error is: error: test.cobra(1, 1): error: Expecting use, assembly, namespace, class, interface or enum, but got """" (STRING_DOUBLE).

I am running Mono version 2.0.1 on Ubuntu version 9.04
eric.sellon
 
Posts: 24

Re: Single line doc strings

Postby Charles » Mon Jun 01, 2009 8:00 pm

Wow, I still don't get any errors using Cobra 2009-04-30 on Mono on Mac. Besides the operating system, the really big difference is that I'm on Mono 2.4.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Single line doc strings

Postby eric.sellon » Tue Jun 02, 2009 9:39 pm

Huh. Very strange. I redownloaded the April release and extracted it. Built the compiler and ran it on the test, no problems. Even tried the exe in the Snapshot directory, no problem. Ran install-from-workspace and then ran the installed one and no problems.

So why did I have the problem in the first place? No idea. I can't recreate it now.
eric.sellon
 
Posts: 24

Re: Single line doc strings

Postby Charles » Tue Jun 02, 2009 10:28 pm

I know why. Take a closer look at the error message. It has four double quotes. So there was an extra "" at some point.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 59 guests