syntax highlighting Lua

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

syntax highlighting Lua

Luiz Henrique de Figueiredo
Has anyone fixed the vim syntax highlighting for [[...]] strings?
The version of lua.vim available at our tools page (which has recently moved
to lua-users) does not handle nested comments, as in
	return [[ alpha [[ beta ]] gamma ]] 

I think I fixed this as follows, but I know little of vim syntax highlighting.

 60c61
 < syn region  luaString	start=+\[\[+ end=+\]\]+ 
 ---
 > syn region  luaString2	start=+\[\[+ end=+\]\]+ contains=luaString2
 103a105
 >   hi link luaString2		String

Does anyone out there knows whether this is the correct or better way?

Also, we're considering adding block comments to Lua in the form --[[...]],
as suggested in lua-users (there's even a patch available there). We would
like that this form could be highlighted correctly in vim and other editors,
even when the --[[...]] contains [[..]] strings and other --[[...]] comments.
We'd like to know whether highlighting --[[...]] comments is possible/easy
to do in vim and other editors. Please let us know. Thanks.

--lhf

Reply | Threaded
Open this post in threaded view
|

Re: syntax highlighting Lua

Enrico Colombini
>Also, we're considering adding block comments to Lua in the form --[[...]]

Will they be recursive? I mean, suppose I comment out (e.g. for testing) a
block of code that includes a block comment:

--[[
some_code
some_code
--[[
some_code
some_code
]]
some_code
some_code
]]

This will not work if the first "]]" closes both comments. I suppose
"[[...]]" recursion goes without saying even in comments, but just to be
sure...

  Enrico


Reply | Threaded
Open this post in threaded view
|

Re: syntax highlighting Lua

Luiz Henrique de Figueiredo
In reply to this post by Luiz Henrique de Figueiredo
>>Also, we're considering adding block comments to Lua in the form --[[...]]
>
>Will they be recursive?

Yes, just like [[..]] strings: they end at the matching ]].
--lhf

Reply | Threaded
Open this post in threaded view
|

RE: syntax highlighting Lua

Carlos Augusto Teixeira Mendes-3
I know it is possible to do so becouse in the following C code,
when you change the first  "#if 1" to "#if 0", the text is highlighted
correctly.

The C syntax highlighting code is quite complicated and, unfortunately, I am
not
with much time at the moment to look further into this.

#if 1
 a= 2;

#if 0
  b = 3
#endif

#endif

As soon as I have some spare time I will try to fix Luas syntax highlighting
macros.

Carlos Augusto.

> -----Original Message-----
> From: [hidden email]
> [[hidden email] Behalf Of Luiz Henrique de
> Figueiredo
> Sent: Saturday, January 19, 2002 8:55 AM
> To: Multiple recipients of list
> Subject: Re: syntax highlighting Lua
>
>
> >>Also, we're considering adding block comments to Lua in the
> form --[[...]]
> >
> >Will they be recursive?
>
> Yes, just like [[..]] strings: they end at the matching ]].
> --lhf