Hi Peng,

> Le 8 févr. 2019 à 02:01, Peng Yu <pengyu...@gmail.com> a écrit :
> 
> [...]
> For example, to deal with heredoc in bash, the grammar rule will change the
> variable `need_here_doc` via `push_heredoc()`.
> 
> ```
>    |   LESS_LESS WORD
>            {
>              source.dest = 0;
>              redir.filename = $2;
>              $$ = make_redirection (source, r_reading_until, redir, 0);
>              push_heredoc ($$);
>            }
> [...]
> `need_here_doc` is used in `read_token()`, which is called by
> `yylex()`. This makes the behavior of `yylex()` non-automomous.
> 
> It seems to me that the parsing code could be made simpler by making
> the parser reentrant. So there can be a parser parses anything not
> heredoc and another parser just parse heredoc. And there should
> different lexers for non-heredoc and heredoc. Is it so?

I'm a bit confused here: did you really mean "another parser", or did
you mean "another scanner"?  If you do mean "another parser", I'm not
sure how you would coordinate the several layers.
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to