[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiline comments

From: Quentin Spencer
Subject: Re: multiline comments
Date: Fri, 15 Apr 2005 10:42:00 -0500
User-agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324)

John W. Eaton wrote:

 * Do these comments nest?  Do you get this behavior:

     %{ 1
     %{ 2
     %} matches 2
     %} matches 1


     %{ 1
     %{ 2
     %} matches 1
     %} error, warning, or just ignored (it is a valid comment)
OK, I did some tests to see how it all behaves. The first thing I discovered is that
%{ text here
is not a valid block comment; the characters "%{" must appear on a line by themselves (white space before or after is OK). It also appears that the comments do nest. I tested the following code with no errors:

%{ block-commented text
   nested block-commented text
 is this still block-commented?

Deleting the final %} gives the error:
"Unterminated %{ block. Use %} to terminate."

Yes, if(0) endif is the more common way of faking block comments.  The
disadvantage is that the text inside the if(0) endif block must be
valid code.  In a block comment, you could have anything except "%}"
at the beginning of a line.
Yes, I've noticed that as well.

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]