[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Two small questions/comments
- From: Philippe Lhoste <PhiLho@...>
- Date: Mon, 24 Sep 2001 12:47:13 +0200 (MEST)
> >About disabling code blocks
> Juts a reminder: there's the string trick:
> local C=[[
> BLOCK TO BE COMMENTED OUT
> The block can be turned on again simply by adding -- to the first line.
> This does not generate bytecode for the block but adds a string...
Of course, if GC time isn't an issue, you can just write:
local C = [[
<syntaxly correct code to comment out>
--]] ; C = nil
and the string isn't in memory anymore (after the GC of course).
Erik Hougaard wrote:
> >Well from a color syntaxing viewpoint this is a bad solution :-(
> Only if it's hard to add coloring for multiline [[..]]] strings...
Usually, yes, strings and comments are often seen as monolithic, and are
rarely parsed for syntax highligthing.
Of course, there are some exceptions, like looking for doc. comments,
highlighting scripts in HTML comments, etc.
In a generic, ideal solution, we should highlight any code inside [[ ]]
comments, be it Lua code, HTML fragments, etc. Of course, one difficulty would be
to know which language to highlight. In HTML, it can be easy: <script
special tags (ASP, etc.) are ignored, thus seen as comments.
With just [[ ]], it is a bit harder... Unless we choose the convention to
discard the first line (or characters) of this string, holding the ID of the
language. A very personal choice indeed.
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
Sent through GMX FreeMail - http://www.gmx.net