lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jan 16, 2019 at 11:24 AM Dirk Laurie <dirk.laurie@gmail.com> wrote:
> Have you studied how lua.c solves precisely this problem?

Can you be more specific? It does not seem to me that lua uses pattern
matching (nor on multiple chunks). If you are talking about the lua
lexer... well, I do not want to implement a proper lexer. Here I was
just searching for a way to detect if a failing pattern have some
chance to match when data is appended to the input

On Wed, Jan 16, 2019 at 8:02 PM Sean Conner <sean@conman.org> wrote:
>   I've used Lua itself as the configuration language (for personal and work
> related projects).  It's pretty easy to do:

Me to... but now I need something more "Ini" like...

On Wed, Jan 16, 2019 at 9:16 PM Sean Conner <sean@conman.org> wrote:
>   This is currently more interesting than anything going on at work, so let
> me ask:  why can't you have the entire config file in memory?  Or at least a
> line at a time?  This seems like a weird, if arbitrary, limitation.

Yes, I agree with you that it is quite arbitrary for the described
scenario. However, I am investigating on the possibility to use the
same format for data insertion/transfer/storage. So keep all in memory
could not be feasible. Splitting the chunks on specific token (e,g,
new line) could work, but I have some patterns that spawn across
multiple lines, so at least that ones must be handled in a special
way.

On Thu, Jan 17, 2019 at 4:59 AM Sam Pagenkopf <ssaammp@gmail.com> wrote:
>  - Make a library that generates the above automatically using lua-style regex.

If I have to write a C library, probably the quickest solution is just
to modify the lua pattern matching library in order to return a the
end position in case of failure. I think it should be enough.