lua.syntax 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. #
  2. # Lua syntax highlighting
  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>
  9. context default lightgray
  10. # keywords
  11. keyword whole and white
  12. keyword whole break white
  13. keyword whole do white
  14. keyword whole else white
  15. keyword whole elseif white
  16. keyword whole end white
  17. keyword whole false white
  18. keyword whole for white
  19. keyword whole function white
  20. keyword whole if white
  21. keyword whole in white
  22. keyword whole local white
  23. keyword whole nil white
  24. keyword whole not white
  25. keyword whole or white
  26. keyword whole repeat white
  27. keyword whole return white
  28. keyword whole then white
  29. keyword whole true white
  30. keyword whole until white
  31. keyword whole while white
  32. # Comment and string delimiters
  33. keyword -- brown
  34. keyword ]\[=\]] brown
  35. # The following colorizes the start delimiter of "long" strings.
  36. # The start delimiter of "long" comments isn't affected by the following
  37. # directive but gets its color from the "--" above (gods know why).
  38. keyword [\[=\][ brown
  39. # Operators
  40. keyword ( white
  41. keyword ) white
  42. keyword { white
  43. keyword } white
  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. # Library Functions
  65. # basiclib
  66. keyword whole error yellow
  67. keyword whole getmetatable yellow
  68. keyword whole setmetatable yellow
  69. keyword whole getfenv yellow
  70. keyword whole setfenv yellow
  71. keyword whole next yellow
  72. keyword whole ipairs yellow
  73. keyword whole pairs yellow
  74. keyword whole print yellow
  75. keyword whole tonumber yellow
  76. keyword whole tostring yellow
  77. keyword whole type yellow
  78. keyword whole assert yellow
  79. #keyword whole unpack yellow # modern code should use table.unpack()
  80. keyword whole rawequal yellow
  81. keyword whole rawget yellow
  82. keyword whole rawset yellow
  83. keyword whole pcall yellow
  84. keyword whole xpcall yellow
  85. keyword whole collectgarbage yellow
  86. keyword whole gcinfo yellow
  87. keyword whole loadfile yellow
  88. keyword whole dofile yellow
  89. keyword whole loadstring yellow
  90. keyword whole require yellow
  91. keyword whole coroutine.create yellow
  92. keyword whole coroutine.wrap yellow
  93. keyword whole coroutine.resume yellow
  94. keyword whole coroutine.yield yellow
  95. keyword whole coroutine.status yellow
  96. # stringlib
  97. keyword whole string.len yellow
  98. keyword whole string.sub yellow
  99. keyword whole string.lower yellow
  100. keyword whole string.upper yellow
  101. keyword whole string.char yellow
  102. keyword whole string.rep yellow
  103. keyword whole string.byte yellow
  104. keyword whole string.format yellow
  105. keyword whole string.dump yellow
  106. keyword whole string.find yellow
  107. keyword whole string.gfind yellow
  108. keyword whole string.gsub yellow
  109. # tablelib
  110. keyword whole table.concat yellow
  111. keyword whole table.foreach yellow
  112. keyword whole table.foreachi yellow
  113. keyword whole table.getn yellow
  114. keyword whole table.setn yellow
  115. keyword whole table.sort yellow
  116. keyword whole table.insert yellow
  117. keyword whole table.remove yellow
  118. keyword whole table.unpack yellow
  119. # mathlib
  120. keyword whole math.abs yellow
  121. keyword whole math.sin yellow
  122. keyword whole math.cos yellow
  123. keyword whole math.tan yellow
  124. keyword whole math.asin yellow
  125. keyword whole math.acos yellow
  126. keyword whole math.atan yellow
  127. keyword whole math.atan2 yellow
  128. keyword whole math.ceil yellow
  129. keyword whole math.floor yellow
  130. keyword whole math.mod yellow
  131. keyword whole math.frexp yellow
  132. keyword whole math.ldexp yellow
  133. keyword whole math.sqrt yellow
  134. keyword whole math.min yellow
  135. keyword whole math.max yellow
  136. keyword whole math.log yellow
  137. keyword whole math.log10 yellow
  138. keyword whole math.exp yellow
  139. keyword whole math.deg yellow
  140. keyword whole math.pow yellow
  141. keyword whole math.rad yellow
  142. keyword whole math.random yellow
  143. keyword whole math.randomseed yellow
  144. # iolib
  145. keyword whole io.input yellow
  146. keyword whole io.output yellow
  147. keyword whole io.lines yellow
  148. keyword whole io.close yellow
  149. keyword whole io.flush yellow
  150. keyword whole io.open yellow
  151. keyword whole io.popen yellow
  152. keyword whole io.read yellow
  153. keyword whole io.tmpfile yellow
  154. keyword whole io.type yellow
  155. keyword whole io.write yellow
  156. # filelib
  157. keyword whole file.flush yellow
  158. keyword whole file.read yellow
  159. keyword whole file.lines yellow
  160. keyword whole file.seek yellow
  161. keyword whole file.write yellow
  162. keyword whole file.close yellow
  163. keyword whole file.__gc yellow
  164. keyword whole file.__tostring yellow
  165. # syslib
  166. keyword whole os.clock yellow
  167. keyword whole os.date yellow
  168. keyword whole os.difftime yellow
  169. keyword whole os.execute yellow
  170. keyword whole os.exit yellow
  171. keyword whole os.getenv yellow
  172. keyword whole os.remove yellow
  173. keyword whole os.rename yellow
  174. keyword whole os.setlocale yellow
  175. keyword whole os.time yellow
  176. keyword whole os.tmpname yellow
  177. # debuglib
  178. keyword whole debug.getlocal yellow
  179. keyword whole debug.getinfo yellow
  180. keyword whole debug.gethook yellow
  181. keyword whole debug.getupvalue yellow
  182. keyword whole debug.sethook yellow
  183. keyword whole debug.setlocal yellow
  184. keyword whole debug.setupvalue yellow
  185. keyword whole debug.debug yellow
  186. keyword whole debug.traceback yellow
  187. # Global Variables
  188. keyword whole _VERSION brightmagenta
  189. keyword whole _G brightmagenta
  190. #
  191. # Long comments
  192. #
  193. context exclusive --[[ ]] brown
  194. # hightlights ldoc tags: "@todo", "@param", "@function" etc.
  195. keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base
  196. spellcheck
  197. context exclusive --[=[ ]=] brown
  198. keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base
  199. spellcheck
  200. context exclusive --[==[ ]==] brown
  201. keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base
  202. spellcheck
  203. context exclusive --[===[ ]===] brown
  204. keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base
  205. spellcheck
  206. # 4 equals and up (the number of ='s doesn't have to match, but that's the best we can do):
  207. context exclusive --[====\[=\][ ]====\[=\]] brown
  208. keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base
  209. spellcheck
  210. #
  211. # Long strings
  212. #
  213. context exclusive [[ ]] brightmagenta
  214. spellcheck
  215. context exclusive [=[ ]=] brightmagenta
  216. spellcheck
  217. context exclusive [==[ ]==] brightmagenta
  218. spellcheck
  219. context exclusive [===[ ]===] brightmagenta
  220. spellcheck
  221. # 4 equals and up (the number of ='s doesn't have to match, but that's the best we can do):
  222. context exclusive [====\[=\][ ]====\[=\]] brightmagenta
  223. spellcheck
  224. # Simple comments
  225. context exclusive -- \n brown
  226. keyword @\[abcdefghijklmnopqrstuvwxyz\] brightred base
  227. spellcheck
  228. # Shebang line
  229. context linestart #! \n brown
  230. # Strings
  231. context " " green
  232. keyword %a brightgreen
  233. keyword %c brightgreen
  234. keyword %d brightgreen
  235. keyword %l brightgreen
  236. keyword %p brightgreen
  237. keyword %q brightgreen
  238. keyword %s brightgreen
  239. keyword %u brightgreen
  240. keyword %w brightgreen
  241. keyword %x brightgreen
  242. keyword %z brightgreen
  243. keyword \\\\ brightgreen
  244. keyword \\" brightgreen
  245. keyword \\' brightgreen
  246. keyword \\\{abtnvfr\} brightgreen
  247. keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
  248. keyword \\\{01234567\}\{01234567\} brightgreen
  249. keyword \\\{01234567\} brightgreen
  250. spellcheck
  251. context ' ' green
  252. keyword %a brightgreen
  253. keyword %c brightgreen
  254. keyword %d brightgreen
  255. keyword %l brightgreen
  256. keyword %p brightgreen
  257. keyword %q brightgreen
  258. keyword %s brightgreen
  259. keyword %u brightgreen
  260. keyword %w brightgreen
  261. keyword %x brightgreen
  262. keyword %z brightgreen
  263. keyword \\\\ brightgreen
  264. keyword \\" brightgreen
  265. keyword \\' brightgreen
  266. keyword \\\{abtnvfr\} brightgreen
  267. keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen
  268. keyword \\\{01234567\}\{01234567\} brightgreen
  269. keyword \\\{01234567\} brightgreen
  270. spellcheck