Re: Is it always possible to make a non-reentrant parser reentrant?

2019-02-08 Thread Peng Yu
Hi Simon, > Normally, you'd use lexer states to activate/deactivate rules. The > primitive approach would be > > %x INITIAL HEREDOC I see %x is from flex. Bash can support nested heredoc. How can it be implemented in flex? > and then prefixing all matches with or . > > The main problem there is

Re: Is it always possible to make a non-reentrant parser reentrant?

2019-02-08 Thread Simon Richter
Hi, On 08.02.19 02:01, Peng Yu wrote: > 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

Re: Is it always possible to make a non-reentrant parser reentrant?

2019-02-08 Thread Peng Yu
On Thu, Feb 7, 2019 at 11:49 PM Akim Demaille wrote: > Hi Peng, > > > Le 8 févr. 2019 à 02:01, Peng Yu 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 WOR