This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c:S_scan_heredoc: Put stream-based parser in else block
authorFather Chrysostomos <sprout@cpan.org>
Wed, 29 Aug 2012 15:41:41 +0000 (08:41 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 01:18:07 +0000 (18:18 -0700)
commita7922135a13574b7c0cd4fa4acc00114f1197ab9
tree0854ae3ca747b2e6a3416b534b2cb17569e12304
parent956be2d47c8be1238119303e892c672d5de736ad
toke.c:S_scan_heredoc: Put stream-based parser in else block

We currently have the code laid out like this:

    if (peek) {
        ... peek inside the parent linestr buffer
    }
    else if (eval) {
        ... grab the heredoc body from linestr ...
    }
    else
        start with an empty string for the heredoc body

    ... parse the body of the heredoc from the input stream ...

The final bit is inside a while loop whose condition is never true
after either of the first two branches of the if/else has executed.
But the code is very hard to read, and it is difficult to fix bugs, as
code cannot be added before the while loop, and the while loop condi-
tion cannot change, without affecting heredocs in string eval.

So put the final parser inside the else.  Future commits will
depend on this.
toke.c