[FW] 在UltraEdit里正確顯示Lua的塊注釋(語法著色)
Origin Link http://blog.2ndboy.net/?p=116#comment-3104
Thanks to 2ndboy
在 UltraEdit 里正確顯示 Lua 的塊注釋(DoNeY注:語法著色問題)
我算得上是 UltraEdit 的鐵桿用戶啦(雖然是 D 版用戶:)),所以寫 Lua 程序當然用 UltraEdit 啦!讓 UltraEdit 支持 Lua 的語法高亮很簡單,去 UE 的官網(wǎng),下載 Lua 的語法文件集成在自帶的語法高亮文件里就可以啦。
但是 UE 官網(wǎng)上這個語法文件貌似比較舊,是 02 年 8 月發(fā)布的,塊注釋居然用的是“[[”和“]]”:“Block Comment On = [[ Block Comment Off = ]]”。于是手工改成“Block Comment On = –[[ Block Comment Off = –]]”保存,結(jié)果發(fā)現(xiàn)行注釋“–”是可以正確顯示的,但是塊注釋就只能顯示快注釋開始標記所在的那一行。貌似是 UE 的 bug?估計跟行注釋有沖突,因為語法文件里是這么寫的“Line Comment = — Block Comment On = –[[ Block Comment Off = –]]”。試了一下把行注釋放在塊注釋后面也不行,開動 Google,結(jié)果在 UE 的論壇上找到了答案。
把 Lua 的語法文件第一行改成如下這個樣子就可以啦:
(DoNeY注:哈,終于有了解決方案,下面聽作者講一下這一微小滴奧妙所在)
查了一下 UE 的幫助文檔,上面對“Block Comment On Alt”的描述是這樣的“The second set of block comments are in the form “Block Comment On Alt = ” and “Block Comment Off Alt = ” followed by up to five characters each that define the comment designators. If a Block Comment On Alt is defined but the Block Comment Off Alt is not defined the commenting will stop at the end of the line.”。看來塊注釋指示器有兩種,這個辦法還真是比較巧妙,但是要熟讀 UE 文檔才能想的到呀。
(DoNeY注:意即如果ultraedit在wordfile中對某個語言的語法著色只定義其Block Comment On Alt =作為第二種塊注釋的起始符號,而不定義第二種塊注釋的結(jié)束符號Block Comment Off Alt =,那么這個Block Comment On Alt 所定義的符號將會只注釋掉從符號開始至行尾的部分,也就相當于換一個方法定義了行注釋的符號了)
改完以后再看 Lua 代碼里的塊注釋,現(xiàn)在已經(jīng)可以完美顯示啦:D
posted on 2008-10-21 17:35 DoNeY 閱讀(3404) 評論(0) 編輯 收藏 所屬分類: LUA