I haven't read the rest of the thread yet, but is this hunk not buggy?
yylex() is side-effecting, so the two calls to yylex() do not do what
the comment suggests.
> *** 2083,2091 ****
> check_FROM = false;
> }
>
> ! /* check FROM keyword after direction's specification */
> ! if (check_FROM && yylex() != K_FROM)
> ! yyerror("expected \"FROM\"");
>
> return fetch;
> }
> --- 2089,2097 ----
> check_FROM = false;
> }
>
> ! /* check FROM or IN keyword after direction's specification */
> ! if (check_FROM && (yylex() != K_FROM && yylex() != K_IN))
> ! yyerror("expected \"FROM/IN\"");
>
> return fetch;
-Neil