On 10/7/21 5:06 PM, Tom Coleman wrote:
You are correct that FOR loops increment the word_top variable in the
read_token_word function, but, ARITH_FOR_EXPRS loops do not. They are
treated separately and do not increment the word_top variable from what I
can see.
#define FOR 265
#define ARITH_FOR_EXPRS 286
The entire grammar production we're talking about here -- the one you're
modifying -- is
arith_for_command: FOR ARITH_FOR_EXPRS list_terminator newline_list DO
compound_list DONE
(for example; there are other rules in that production). 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.
--
``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/