[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How a load reader can pre-parse chunks?
- From: v <v19930312@...>
- Date: Fri, 12 Mar 2021 16:18:23 +0300
On Fri, 2021-03-12 at 07:59 -0500, Varanda wrote:
> Hello All,
>
> I am implementing a Lua shell using load function.
> It is working fine for single line entries. I would like to add
> multiline support WITHOUT adding a explicit multi-line line
> terminator (like ‘\’ in C and makefiles)
>
> Question: Is there a parser that the reader can use to figure out
> when the chunk is completed?
>
> For example, what could be done inside the following “chunk_reader”
> for detecting it?
> Or should the load caller keep calling it based on “<eof>” presence
> in the error message?
> Thanks in advance,
> Varanda
>
Vanilla Lua REPL checks if it can compile chunk as entered and expects
continuation if it can't. If such continuation is an empty string,
input buffer gets reset and error is printed.
--
v <v19930312@gmail.com>