It seems like you have put
_argcount=0;
_args[0]=NULL;
at the top of the rules section in hopes that these statements would be executed at the beginning of yylex()
. And you've noticed that they aren't executed (it keeps appending to the previous values because _argcount
never goes back to 0).
The obvious thing to do is move those statements into getln()
just before the yylex()
.
What you have now is a lexer that will ignore the string _argcount=0;
in the input because it will match that pattern and there's no action to go with it. The second line is even cooler since the [0]
is a character class. It makes the lexer ignore the string _args0=NULL;