help-octave
[Top][All Lists]
Advanced

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

Re: Block comments inside block comments


From: Bård Skaflestad
Subject: Re: Block comments inside block comments
Date: Tue, 16 Mar 2010 13:49:28 +0100

On Tue, 2010-03-16 at 13:26 +0100, David Grundberg wrote:
> Carnë Draug wrote:
> > Hi
> >
> > I just realized that when inside a block comment, octave still notices
> > the start of another block comment. If this happens, then it's needed
> > to close it again. Not sure if I'm clear so here's an example what I
> > mean
> >
> > printf ("Not comment 1\n");
> > #{
> >    printf ("Comment 1\n");
> >    #{
> >    printf ("Comment 2\n");
> > #}
> > printf ("I'd have guessed NOT a comment but it is a comment and gives
> > warning of unclosed block comment\n");
> >
> > Is this a feature or a bug? My idea on how comments work is that
> > everything is ignored until the end of the comment (end of the line,
> > in one line comments, or end of block character) but I may be wrong.
> >
> That depends on the language, ML has recursive block comments as an 
> example. However, most imperative languages have block comments that can 
> be found with a regular expression (i.e. not recursive). How does matlab 
> interpret %{ }% comments?

That would be %{ %} comments, but I won't split hairs.  In MATLAB the
%{,%} block comment delimiters do nest (unlike the /* ... */ block
comment delimiters in C or C++).  In other words,

    %{
       This is within the outer block comment
       %{
          This is within the inner block comment
       %}
       This is still within the outer block comment
    %}


Best regards,
-- 
Bård Skaflestad                            <address@hidden>
SINTEF ICT, Applied mathematics




reply via email to

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