Merge branch '4549_subshell_execl_argv0'
[midnight-commander.git] / misc / syntax / lua.syntax
blob0d1b816328d156f4b294a23e4335ffc4d0a55a6b
2 # Lua syntax highlighting
4 # History:
6 # - 2015: Support for long strings and long comments.
7 # - 2011: String-literal fixes.
8 # - 2005: Started by Mike Gorchak <lestat@i.com.ua>
10 context default lightgray
12 # keywords
13     keyword whole and white
14     keyword whole break white
15     keyword whole do white
16     keyword whole else white
17     keyword whole elseif white
18     keyword whole end white
19     keyword whole false white
20     keyword whole for white
21     keyword whole function white
22     keyword whole if white
23     keyword whole in white
24     keyword whole local white
25     keyword whole nil white
26     keyword whole not white
27     keyword whole or white
28     keyword whole repeat white
29     keyword whole return white
30     keyword whole then white
31     keyword whole true white
32     keyword whole until white
33     keyword whole while white
35 # Comment and string delimiters
36     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
43 # Operators
44     keyword ( white
45     keyword ) white
46     keyword { white
47     keyword } white
48     keyword [ white
49     keyword ] white
50     keyword . white
51     keyword , white
52     keyword ; white
53     keyword : white
54     keyword .. white
55     keyword ... white
56     keyword = white
57     keyword == white
58     keyword ~= white
59     keyword <= white
60     keyword => white
61     keyword > white
62     keyword < white
63     keyword \+ white
64     keyword - white
65     keyword \* white
66     keyword / white
67     keyword ^ white
70 # Library Functions
72     # basiclib
73     keyword whole error yellow
74     keyword whole getmetatable yellow
75     keyword whole setmetatable yellow
76     keyword whole getfenv yellow
77     keyword whole setfenv yellow
78     keyword whole next yellow
79     keyword whole ipairs yellow
80     keyword whole pairs yellow
81     keyword whole print yellow
82     keyword whole tonumber yellow
83     keyword whole tostring yellow
84     keyword whole type yellow
85     keyword whole assert yellow
86     #keyword whole unpack yellow    # modern code should use table.unpack()
87     keyword whole rawequal yellow
88     keyword whole rawget yellow
89     keyword whole rawset yellow
90     keyword whole pcall yellow
91     keyword whole xpcall yellow
92     keyword whole collectgarbage yellow
93     keyword whole gcinfo yellow
94     keyword whole loadfile yellow
95     keyword whole dofile yellow
96     keyword whole loadstring yellow
97     keyword whole require yellow
98     keyword whole coroutine.create yellow
99     keyword whole coroutine.wrap yellow
100     keyword whole coroutine.resume yellow
101     keyword whole coroutine.yield yellow
102     keyword whole coroutine.status yellow
104     # stringlib
105     keyword whole string.len yellow
106     keyword whole string.sub yellow
107     keyword whole string.lower yellow
108     keyword whole string.upper yellow
109     keyword whole string.char yellow
110     keyword whole string.rep yellow
111     keyword whole string.byte yellow
112     keyword whole string.format yellow
113     keyword whole string.dump yellow
114     keyword whole string.find yellow
115     keyword whole string.gfind yellow
116     keyword whole string.gsub yellow
118     # tablelib
119     keyword whole table.concat yellow
120     keyword whole table.foreach yellow
121     keyword whole table.foreachi yellow
122     keyword whole table.getn yellow
123     keyword whole table.setn yellow
124     keyword whole table.sort yellow
125     keyword whole table.insert yellow
126     keyword whole table.remove yellow
127     keyword whole table.unpack yellow
129     # mathlib
130     keyword whole math.abs yellow
131     keyword whole math.sin yellow
132     keyword whole math.cos yellow
133     keyword whole math.tan yellow
134     keyword whole math.asin yellow
135     keyword whole math.acos yellow
136     keyword whole math.atan yellow
137     keyword whole math.atan2 yellow
138     keyword whole math.ceil yellow
139     keyword whole math.floor yellow
140     keyword whole math.mod yellow
141     keyword whole math.frexp yellow
142     keyword whole math.ldexp yellow
143     keyword whole math.sqrt yellow
144     keyword whole math.min yellow
145     keyword whole math.max yellow
146     keyword whole math.log yellow
147     keyword whole math.log10 yellow
148     keyword whole math.exp yellow
149     keyword whole math.deg yellow
150     keyword whole math.pow yellow
151     keyword whole math.rad yellow
152     keyword whole math.random yellow
153     keyword whole math.randomseed yellow
155     # iolib
156     keyword whole io.input yellow
157     keyword whole io.output yellow
158     keyword whole io.lines yellow
159     keyword whole io.close yellow
160     keyword whole io.flush yellow
161     keyword whole io.open yellow
162     keyword whole io.popen yellow
163     keyword whole io.read yellow
164     keyword whole io.tmpfile yellow
165     keyword whole io.type yellow
166     keyword whole io.write yellow
168     # filelib
169     keyword whole file.flush yellow
170     keyword whole file.read yellow
171     keyword whole file.lines yellow
172     keyword whole file.seek yellow
173     keyword whole file.write yellow
174     keyword whole file.close yellow
175     keyword whole file.__gc yellow
176     keyword whole file.__tostring yellow
178     # syslib
179     keyword whole os.clock yellow
180     keyword whole os.date yellow
181     keyword whole os.difftime yellow
182     keyword whole os.execute yellow
183     keyword whole os.exit yellow
184     keyword whole os.getenv yellow
185     keyword whole os.remove yellow
186     keyword whole os.rename yellow
187     keyword whole os.setlocale yellow
188     keyword whole os.time yellow
189     keyword whole os.tmpname yellow
191     # debuglib
192     keyword whole debug.getlocal yellow
193     keyword whole debug.getinfo yellow
194     keyword whole debug.gethook yellow
195     keyword whole debug.getupvalue yellow
196     keyword whole debug.sethook yellow
197     keyword whole debug.setlocal yellow
198     keyword whole debug.setupvalue yellow
199     keyword whole debug.debug yellow
200     keyword whole debug.traceback yellow
203 # Global Variables
204     keyword whole _VERSION brightmagenta
205     keyword whole _G brightmagenta
208 # Long comments
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
230 # Long strings
233 context exclusive [[ ]] brightmagenta
234     spellcheck
235 context exclusive [=[ ]=] brightmagenta
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
246 # Simple comments
247 context exclusive -- \n brown
248     keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base
249     spellcheck
251 # Shebang line
252 context linestart #! \n brown
254 # Strings
255 context " " green
256     keyword %a brightgreen
257     keyword %c brightgreen
258     keyword %d brightgreen
259     keyword %l brightgreen
260     keyword %p brightgreen
261     keyword %q brightgreen
262     keyword %s brightgreen
263     keyword %u brightgreen
264     keyword %w brightgreen
265     keyword %x brightgreen
266     keyword %z brightgreen
267     keyword \\\\ brightgreen
268     keyword \\" brightgreen
269     keyword \\' brightgreen
270     keyword \\\{abtnvfr\} brightgreen
271     keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
272     keyword \\\{01234567\}\{01234567\} brightgreen
273     keyword \\\{01234567\} brightgreen
274     spellcheck
276 context ' ' green
277     keyword %a brightgreen
278     keyword %c brightgreen
279     keyword %d brightgreen
280     keyword %l brightgreen
281     keyword %p brightgreen
282     keyword %q brightgreen
283     keyword %s brightgreen
284     keyword %u brightgreen
285     keyword %w brightgreen
286     keyword %x brightgreen
287     keyword %z brightgreen
288     keyword \\\\ brightgreen
289     keyword \\" brightgreen
290     keyword \\' brightgreen
291     keyword \\\{abtnvfr\} brightgreen
292     keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
293     keyword \\\{01234567\}\{01234567\} brightgreen
294     keyword \\\{01234567\} brightgreen
295     spellcheck