[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
Re: [zzdev] Re: [zzdev] zob2java problems on Mac
- To: Benjamin Fallenstein <b.fallenstein@xxxxxx>
- Subject: Re: [zzdev] Re: [zzdev] zob2java problems on Mac
- From: Tuomas Lukka <lukka@xxxxxxxxxxx>
- Date: Fri, 4 Aug 2000 18:22:00 +0300 (EETDST)
- Cc: zzdev@xxxxxxxxxx
- In-reply-to: <398AD296.B503AB0F@xxxxxx>
> Wow, now I'm learning Perl...
>
> I've isolated the bug. And it has apparently nothing to do with
> newlines. In the code:
>
> > while ($level > 0) {
> > die "Unbalanced braces" if $str eq "";
> > $str =~ /^([^{}]*)([{}])(.*)$/s;
> > if ($2 eq "{") { ++$level; }
> > if ($2 eq "}") { --$level; }
> > $str = $3;
> > $rv = $rv . $1 . $2;
> > }
>
> in parse_balanced, the value of $1 and $2 changes (in MacPerl) when
> doing $str = $3, and this has disastrous effects. My simple patch looks
> like this:
>
> > while ($level > 0) {
> > die "Unbalanced braces" if $str eq "";
> > $str =~ /^([^{}]*)([{}])(.*)$/s;
> > my ($first, $second) = ($1, $2);
> > if ($2 eq "{") { ++$level; }
> > if ($2 eq "}") { --$level; }
> > $str = $3;
> > $rv = $rv . $first . $second;
> > }
>
> ... and outputs the right thing. If this isn't somehow frowned upon, or
> stupid (remember, I don't *really* know what I'm doing ;) ), could you
> change it in the repository? It *should* work on others than MacPerl, right?
Which version of Perl is you MacPerl? If it's the same as the most recent
Perl version, then a bug report would be in order. I remember seeing this
in a Perl version some years ago.
I've committed the change.
Tuomas