Page 1 of 1

Single line doc strings

PostPosted: Wed Nov 12, 2008 2:18 am
by Charles
Now implemented.

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

ticket:43

Re: Single line doc strings

PostPosted: Wed May 27, 2009 9:37 pm
by eric.sellon
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 ;)

Re: Single line doc strings

PostPosted: Thu May 28, 2009 12:26 am
by Charles
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.

Re: Single line doc strings

PostPosted: Thu May 28, 2009 3:36 pm
by eric.sellon
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.

Re: Single line doc strings

PostPosted: Sat May 30, 2009 7:18 pm
by Charles
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.

Re: Single line doc strings

PostPosted: Sun May 31, 2009 6:52 pm
by eric.sellon
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

Re: Single line doc strings

PostPosted: Mon Jun 01, 2009 8:00 pm
by Charles
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.

Re: Single line doc strings

PostPosted: Tue Jun 02, 2009 9:39 pm
by eric.sellon
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.

Re: Single line doc strings

PostPosted: Tue Jun 02, 2009 10:28 pm
by Charles
I know why. Take a closer look at the error message. It has four double quotes. So there was an extra "" at some point.