Subject: | here-docs break the compiler |
When some source has what looks like a here-doc (<<) in it, this is seen
by the filter as \x1c\x00\x00\x00\x00\x1c instead of <<. This causes the
filter not to change this, and perl then sees a here-doc and tries to
match it. Often this will cause compilation issues.
Attached is a patch that fixes the here-doc matching, so that it is
treated as << and filtered out.
To test, the example program heredoc.pl will output a single character.
Without the patch this will be \x01, and with the patch this will be \x02.
Cheers,
Hugh
Subject: | heredoc.pl |
use Acme::Brainfuck;
<<+
+.
Subject: | heredoc.patch |
--- /usr/share/perl5/Acme/Brainfuck.pm 2012-12-09 15:47:07.438819407 +1300
+++ /usr/local/share/perl/5.10.1/Acme/Brainfuck.pm 2012-12-09 15:46:32.854308231 +1300
@@ -101,6 +101,8 @@
{
my $ret = $_;
my $loopcount = 0;
+ # here-docs (<<)
+ $ret =~ s/\x1c\x00\x00\x00\x00\x1c/>>/g;
while ($ret =~ /\s ([\Q$ops\E]+) \s/gsx)
{
my $code = $1;