2 ms·
I wonder if the "quoting" problem could be fixed by making m4 recognize Lua-style longstrings, which never need escape characters. Some examples: http://lua-us
by scythe 7y ago
I wonder if the "quoting" problem could be fixed by making m4 recognize Lua-style longstrings, which never need escape characters. Some examples:
http://lua-users.org/wiki/StringsTutorial http://lua-users.org/wiki/StringsTutorial
I considered using longstrings to make a "better CSV" once but then I realized that quoting is only one of the many problems with CSV.
- iamthad 7y agoIt's not clear to me what you mean by "longstrings" from that page. Are you referring to the double-bracket quoted style?
- scythe 7y agoYes. A Lua-style longstring is delimited by [===[ and ]===] where the number of = signs can be arbitrary (including zero); the end must have the same number of = signs as the beginning. Any string can be encoded inside of a longstring without escaping, simply by using long enough delimiters. There are a number of advantages to this notation: it's more readable (usually), it generally results in shorter code files, and longquoted substrings can be directly addressed without translation (though there may be other reasons not to pass that pointer around).
- luizfelberti 7y agoI once developed a tiny single-file bash script to do dumb string substitution for arbitrary files and arbitrary strings, and I used this exact Lua mechanic to avoid escaping issues if the delimiters I chose collide with the syntax. It's a pretty great mechanic. My script is here if you wanna check it out https://github.com/luizberti/templ https://github.com/luizberti/templ