Re: Lua syntax ambiguity

"'Martin Eden' via lua-l" <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
Hi Sean,

On 2026-08-18 20:36, Sean Conner wrote:
>    What are you doing that requires this level of detail?
Just printing tables.
>    That aside, it sounds like you have some form of AST that you want to turn
> into textual Lua (possibly with a minimum of extra space for some reason).
> Per your example:
>
> 	t={['a']=1}
>
>    At some point you have a string.  By what criteria are you using to write
> a string as [[...]]?  Why not "..."?  Or '...'?  Avoid the issue entirely.
Objective is not "avoid issue and make job done". Objective is
"deal with it. Preferably nicely".

I have string quoting function at Sophistication stage.
She can quote string in many ways. We like her.

https://github.com/martin-eden/lua_table_serializer/blob/06e5bedb6a248a950158b7fb4062a8d6f61957d6/src/workshop/concepts/lua/quote_string.lua

Another function is embedding her output in index brackets [].
Code there is at Inquiry stage. It knows about possible syntax clash
and has means to avoid it (without adding unnecessary spaces).
Implementation for that is not conceptually nice, so I created this
topic to get hints, clarify things for myself or at least warn
fellow masters about this case.
>    -spc
-- Martin

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/4ba347cb-f9f0-47a8-a97f-a6c21384f4d2%40disroot.org.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.