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 c...@case.edu http://tiswww.cwru.edu/~chet/