From c548e690a6bde99d905d80c9960ef3209f664ac7 Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Mon, 25 May 2015 17:51:23 +0300
Subject: [PATCH] Improve Lua syntax highlighting.
* Support for "long" strings/comments.
* Fixed Syntax.in to recognize both "#!/path/to/lua"
and "#!/usr/bin/env lua".
* Fixed langauge name (it's "Lua", not "LUA").
---
misc/syntax/Syntax.in | 2 +-
misc/syntax/lua.syntax | 63 ++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 57 insertions(+), 8 deletions(-)
diff --git a/misc/syntax/Syntax.in b/misc/syntax/Syntax.in
index 849afe6..014d08a 100644
a
|
b
|
include povray.syntax |
178 | 178 | file .\*\\.(ebuild|eclass)$ Gentoo\sEbuild |
179 | 179 | include ebuild.syntax |
180 | 180 | |
181 | | file ..\*\\.([lL][uU][aA])$ LUA\sProgram ^#!.*/lua |
| 181 | file ..\*\\.([lL][uU][aA])$ Lua\sProgram ^#!.\*[\s/]lua |
182 | 182 | include lua.syntax |
183 | 183 | |
184 | 184 | file ..\*\\.([iI][dD][lL])$ CORBA\sIDL |
diff --git a/misc/syntax/lua.syntax b/misc/syntax/lua.syntax
index 97f8417..0d1b816 100644
a
|
b
|
|
1 | 1 | # |
2 | | # LUA Scripting Language syntax highlight |
3 | | # // Mike Gorchak <lestat@i.com.ua> |
| 2 | # Lua syntax highlighting |
4 | 3 | # |
| 4 | # History: |
| 5 | # |
| 6 | # - 2015: Support for long strings and long comments. |
| 7 | # - 2011: String-literal fixes. |
| 8 | # - 2005: Started by Mike Gorchak <lestat@i.com.ua> |
5 | 9 | |
6 | 10 | context default lightgray |
7 | 11 | |
… |
… |
context default lightgray |
28 | 32 | keyword whole until white |
29 | 33 | keyword whole while white |
30 | 34 | |
31 | | # Comments |
| 35 | # Comment and string delimiters |
32 | 36 | keyword -- brown |
33 | | keyword ]] brown |
| 37 | keyword ]\[=\]] brown |
| 38 | # The following colorizes the start delimiter of "long" strings. |
| 39 | # The start delimiter of "long" comments isn't affected by the following |
| 40 | # directive but gets its color from the "--" above (gods know why). |
| 41 | keyword [\[=\][ brown |
34 | 42 | |
35 | 43 | # Operators |
36 | 44 | keyword ( white |
… |
… |
context default lightgray |
60 | 68 | |
61 | 69 | |
62 | 70 | # Library Functions |
| 71 | |
63 | 72 | # basiclib |
64 | 73 | keyword whole error yellow |
65 | 74 | keyword whole getmetatable yellow |
… |
… |
context default lightgray |
74 | 83 | keyword whole tostring yellow |
75 | 84 | keyword whole type yellow |
76 | 85 | keyword whole assert yellow |
77 | | keyword whole unpack yellow |
| 86 | #keyword whole unpack yellow # modern code should use table.unpack() |
78 | 87 | keyword whole rawequal yellow |
79 | 88 | keyword whole rawget yellow |
80 | 89 | keyword whole rawset yellow |
… |
… |
context default lightgray |
115 | 124 | keyword whole table.sort yellow |
116 | 125 | keyword whole table.insert yellow |
117 | 126 | keyword whole table.remove yellow |
| 127 | keyword whole table.unpack yellow |
118 | 128 | |
119 | 129 | # mathlib |
120 | 130 | keyword whole math.abs yellow |
… |
… |
context default lightgray |
194 | 204 | keyword whole _VERSION brightmagenta |
195 | 205 | keyword whole _G brightmagenta |
196 | 206 | |
| 207 | # |
| 208 | # Long comments |
| 209 | # |
197 | 210 | |
198 | | # Comments |
199 | 211 | context exclusive --[[ ]] brown |
| 212 | # hightlights ldoc tags: "@todo", "@param", "@function" etc. |
| 213 | keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base |
| 214 | spellcheck |
| 215 | context exclusive --[=[ ]=] brown |
| 216 | keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base |
| 217 | spellcheck |
| 218 | context exclusive --[==[ ]==] brown |
| 219 | keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base |
| 220 | spellcheck |
| 221 | context exclusive --[===[ ]===] brown |
| 222 | keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base |
| 223 | spellcheck |
| 224 | # 4 equals and up (the number of ='s doesn't have to match, but that's the best we can do): |
| 225 | context exclusive --[====\[=\][ ]====\[=\]] brown |
| 226 | keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base |
| 227 | spellcheck |
| 228 | |
| 229 | # |
| 230 | # Long strings |
| 231 | # |
| 232 | |
| 233 | context exclusive [[ ]] brightmagenta |
| 234 | spellcheck |
| 235 | context exclusive [=[ ]=] brightmagenta |
200 | 236 | spellcheck |
| 237 | context exclusive [==[ ]==] brightmagenta |
| 238 | spellcheck |
| 239 | context exclusive [===[ ]===] brightmagenta |
| 240 | spellcheck |
| 241 | # 4 equals and up (the number of ='s doesn't have to match, but that's the best we can do): |
| 242 | context exclusive [====\[=\][ ]====\[=\]] brightmagenta |
| 243 | spellcheck |
| 244 | |
201 | 245 | |
| 246 | # Simple comments |
202 | 247 | context exclusive -- \n brown |
| 248 | keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base |
203 | 249 | spellcheck |
204 | 250 | |
205 | | context linestart # \n brown |
| 251 | # Shebang line |
| 252 | context linestart #! \n brown |
206 | 253 | |
207 | 254 | # Strings |
208 | 255 | context " " green |
… |
… |
context " " green |
211 | 258 | keyword %d brightgreen |
212 | 259 | keyword %l brightgreen |
213 | 260 | keyword %p brightgreen |
| 261 | keyword %q brightgreen |
214 | 262 | keyword %s brightgreen |
215 | 263 | keyword %u brightgreen |
216 | 264 | keyword %w brightgreen |
… |
… |
context ' ' green |
231 | 279 | keyword %d brightgreen |
232 | 280 | keyword %l brightgreen |
233 | 281 | keyword %p brightgreen |
| 282 | keyword %q brightgreen |
234 | 283 | keyword %s brightgreen |
235 | 284 | keyword %u brightgreen |
236 | 285 | keyword %w brightgreen |