[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: On the subject of Lua's grammar... --[[ ]]
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 27 Nov 2003 10:04:02 -0200
> It would be nice if the parser could either count the [[ and ]] balance
It does. The problem is that, in regular code, `]]' usually appears
without a corresponding `[[' (e.g., `a[b[i]]').
> or allowed a different block-comment format whose terminator sequence
> wasn't valid Lua grammar.
It will. Lua 5.1 will generalize `[[ ]]' to `[*...*[ ]*...*]', so
that a `[*[' only closes with a `]*]' (same number of stars). That
will allow the inclusion of *any* literal string inside Lua code without
The syntax is not very pretty, but to allow any literal string we need
variable delimiters. And the need to insert source code (and other
large chunks of text) inside Lua code is quite common.