[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: New long comments in 5.1
- From: Philippe Lhoste <PhiLho@...>
- Date: Mon, 21 Jun 2004 01:00:37 +0200
Jadek wrote:
> "little chance of them appearing in normal code"?
> What about content of strings, or nested comments?
You just have to look to existing lua conventions for the answer to that...
Comments inside strings aren't parsed. Try the following in lua:
var = "test -- test"
print( var )
If you were to parse comments inside strings, then any set of comment
characters
could appear validly in the language.
You take it the way around, the problem isn't comments inside strings,
but strings inside comments.
Try:
a = "x ]] y"; print(a)
it works, it is perfectly valid.
Now, takes:
x = [[
a = "x ]] y"; print(a)
]]
You get the following Lua error: unfinished string near `"; printf(a)'
Same if you try to comment out this portion of code with --[[ ... ]]
A comment doesn't look at the syntax of the commented out code, it stops
at the first occurence of ending sequence.
As for nested comments, this is a perennial problem which occurs
wherever block
comments are allowed.
[snip]
On reading again my message, I don't know why I mentioned nested
comments here ;o|
--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://Phi.Lho.free.fr
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--