bug-bash
[Top][All Lists]
Advanced

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

Re: Incorrect LINENO with exported nested functions with loops


From: Chet Ramey
Subject: Re: Incorrect LINENO with exported nested functions with loops
Date: Sun, 10 Oct 2021 14:30:46 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.1.2

On 10/9/21 3:47 PM, Chet Ramey wrote:

The FOR token is
what causes the parser to increment word_top. The ARITH_FOR_EXPRS token
parses just one part of that production (the ((...;...;...)) part). It's
true that the function that parses the stuff between the double parens
doesn't use word_lineno[word_top], and maybe it should, but having
incremented word_top after seeing FOR, the action should decrement it after
parsing the complete statement.

Thanks for pointing me in the right direction. The issue was indeed that
parse_dparen wasn't using word_lineno[word_top] -- in fact, as you
suspected, it wasn't being set properly. Making sure it was set correctly
so the assumptions made elsewhere aren't violated (i.e., every use of FOR
causes word_top to be incremented) is the way to go. My fix is slightly
different from yours, but yours works as well.

Chet



--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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