develooper Front page | perl.perl5.porters | Postings from February 2000

Re: proposed perlpod.pod patch

Thread Previous | Thread Next
From:
Brad Appleton
Date:
February 4, 2000 15:06
Subject:
Re: proposed perlpod.pod patch
Message ID:
200002042306.RAA22313@agogic.cig.mot.com
On Fri, Feb 04, 2000 at 05:17:20PM -0500, Ronald J Kimball wrote:
> However, I'm curious about why a newline isn't allowed

Cuz then it entails non-trivial changes to me code ;-) Otehrwise its a
very easy change to make. I have to keep track of newlines for diagnostic
purposes as each paragraph is in the process of being parsed (so the
pod2xxx translators can give meaningful error messages identifying the
exact line of input, without having to track it themselves since they
aren't doing the parsing - just the translation).

If I have to allow newlines immediately after << or before >> then I
have to do some extra juggling to count them and put them back on the
token stack (which would also be slightly more of a performance hit for
every newlne encountered).

> following C<<.  Does that mean that this would be legal:
> 
> C<< 
>    if ($x < $y) {
>      print "Hello!\n";
>    }
> >>
> 
> But this wouldn't:
> 
> C<<
>    if ($x <$y) {
>      print "Hello!\n";
>    }
> >>
> 
> ?

Looks to me like neither of the above would be legal. Note that the
"($x < $y)" versus "($x <$y)" makes no difference (both are just fine).
But its not enough to have non-newline whitespace after the '<<' it also
has to be *before* the '>>'. So you could do:

 C<< 
    if ($x < $y) {
      print "Hello!\n";
    }
  >>

But it won't work without the space before the '>>'. Also not that C<...>
doesn't magically enter verbatim mode - so even though you used newlines
and indentation inside the C<< ... >> chances are they would be completely
disregarded by pod2xxxx and might even all end up on the same line
(which is why if the formatting (not the fontstyle, but the formatting)
is important, especially with respect to preserving newlines, you
can't rely on any of [IBCF]<< ... >> to do that for you.

If the consensus is that the newline limitation must be removed for
the [A-Z]<<\s+...\s+>> case I can do that, but it will cost a little
bit in performance. I can see how keeping the limitation could bite
those of us that use an editor or other tool to autoformat/wrap textlines

-- 
Brad Appleton <bradapp@enteract.com> http://www.enteract.com/~bradapp/
  "And miles to go before I sleep." -- Robert Frost

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About