lua-users home
lua-l archive

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


Jamie Webb wrote:
On Sunday 20 June 2004 10:25, Philippe Lhoste wrote:

Perhaps it is a bit too much convoluted, with "complex" rules to
memorize, but at least it should satisfy most people, coping with most
cases.

It is indeed rather convoluted. How exactly is this better than [**[ ... ]**] (bearing in mind that there can be zero stars)?

I don't know if it is better, I don't claim it, it is just another proposal. Perhaps it can seems more "natural" to those already using HereDoc in other languages. Note it still go against the ease of syntax-highlighting, but I suppose it is the price to pay to enclose arbitrary strings.

My rules can simplified by removing the exception of [[<nl> and writing [a-zA-Z_]* instead of +. It includes the legacy form and the HereDoc in an unique rule.

That makes three rules:
- one-liners: s = [[Foo Gah Bar]]

- legacy form: s = [[Foo Gah
Bar Whatever]]

- HereDoc form: s = [[T2
Foo Gah Bar
a = b[c[d]]
Whatever
T2]]

or: s = [[
Foo Gah Bar
a = b[c[d]]
Whatever
]]

Nesting:

s = [[__
pfff = [[abc def
[[supercallifragislisticexpialidocious]]
gggg]]
__]]

Again, this is just a proposal, and of course the final word will go to Lua authors, which probably will just keep the [**[ ... ]**] form, which is fine for me, actually.

Note for the pain to type multiple [ and ]: I share this view, since I have a French keyboard with the same problem (~{[\@]} are hard to type, to give only frequent chars), but I believe that if you have a good editor (scriptable?), or some good utility (like abbreviation expander), the pain can be easily reduced.

--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://Phi.Lho.free.fr
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--