tokens_lua.json 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. [[
  2. ["bracketedComment",2,"start"],
  3. ["comment","--[[--"]
  4. ],[
  5. ["bracketedComment",2,"start"],
  6. ["comment","num_args takes in 5.1 byte code and extracts the number of arguments"]
  7. ],[
  8. ["bracketedComment",2,"start"],
  9. ["comment","from its function header."]
  10. ],[
  11. "start",
  12. ["comment","--]]--"]
  13. ],[
  14. "start"
  15. ],[
  16. "start",
  17. ["keyword","function"],
  18. ["text"," "],
  19. ["identifier","int"],
  20. ["paren.lparen","("],
  21. ["identifier","t"],
  22. ["paren.rparen",")"]
  23. ],[
  24. "start",
  25. ["text","\t"],
  26. ["keyword","return"],
  27. ["text"," "],
  28. ["identifier","t"],
  29. ["keyword.operator",":"],
  30. ["support.function","byte"],
  31. ["paren.lparen","("],
  32. ["constant.numeric","1"],
  33. ["paren.rparen",")"],
  34. ["keyword.operator","+"],
  35. ["identifier","t"],
  36. ["keyword.operator",":"],
  37. ["support.function","byte"],
  38. ["paren.lparen","("],
  39. ["constant.numeric","2"],
  40. ["paren.rparen",")"],
  41. ["keyword.operator","*"],
  42. ["constant.numeric","0x100"],
  43. ["keyword.operator","+"],
  44. ["identifier","t"],
  45. ["keyword.operator",":"],
  46. ["support.function","byte"],
  47. ["paren.lparen","("],
  48. ["constant.numeric","3"],
  49. ["paren.rparen",")"],
  50. ["keyword.operator","*"],
  51. ["constant.numeric","0x10000"],
  52. ["keyword.operator","+"],
  53. ["identifier","t"],
  54. ["keyword.operator",":"],
  55. ["support.function","byte"],
  56. ["paren.lparen","("],
  57. ["constant.numeric","4"],
  58. ["paren.rparen",")"],
  59. ["keyword.operator","*"],
  60. ["constant.numeric","0x1000000"]
  61. ],[
  62. "start",
  63. ["keyword","end"]
  64. ],[
  65. "start"
  66. ],[
  67. "start",
  68. ["keyword","function"],
  69. ["text"," "],
  70. ["identifier","num_args"],
  71. ["paren.lparen","("],
  72. ["identifier","func"],
  73. ["paren.rparen",")"]
  74. ],[
  75. "start",
  76. ["text","\t"],
  77. ["keyword","local"],
  78. ["text"," "],
  79. ["support.function","dump"],
  80. ["text"," "],
  81. ["keyword.operator","="],
  82. ["text"," "],
  83. ["constant.library","string"],
  84. ["text","."],
  85. ["support.function","dump"],
  86. ["paren.lparen","("],
  87. ["identifier","func"],
  88. ["paren.rparen",")"]
  89. ],[
  90. "start",
  91. ["text","\t"],
  92. ["keyword","local"],
  93. ["text"," "],
  94. ["identifier","offset"],
  95. ["text",", "],
  96. ["identifier","cursor"],
  97. ["text"," "],
  98. ["keyword.operator","="],
  99. ["text"," "],
  100. ["identifier","int"],
  101. ["paren.lparen","("],
  102. ["support.function","dump"],
  103. ["keyword.operator",":"],
  104. ["support.function","sub"],
  105. ["paren.lparen","("],
  106. ["constant.numeric","13"],
  107. ["paren.rparen","))"],
  108. ["text",", "],
  109. ["identifier","offset"],
  110. ["text"," "],
  111. ["keyword.operator","+"],
  112. ["text"," "],
  113. ["constant.numeric","26"]
  114. ],[
  115. "start",
  116. ["text","\t"],
  117. ["comment","--Get the params and var flag (whether there's a ... in the param)"]
  118. ],[
  119. "start",
  120. ["text","\t"],
  121. ["keyword","return"],
  122. ["text"," "],
  123. ["support.function","dump"],
  124. ["keyword.operator",":"],
  125. ["support.function","sub"],
  126. ["paren.lparen","("],
  127. ["identifier","cursor"],
  128. ["paren.rparen",")"],
  129. ["keyword.operator",":"],
  130. ["support.function","byte"],
  131. ["paren.lparen","("],
  132. ["paren.rparen",")"],
  133. ["text",", "],
  134. ["support.function","dump"],
  135. ["keyword.operator",":"],
  136. ["support.function","sub"],
  137. ["paren.lparen","("],
  138. ["identifier","cursor"],
  139. ["keyword.operator","+"],
  140. ["constant.numeric","1"],
  141. ["paren.rparen",")"],
  142. ["keyword.operator",":"],
  143. ["support.function","byte"],
  144. ["paren.lparen","("],
  145. ["paren.rparen",")"]
  146. ],[
  147. "start",
  148. ["keyword","end"]
  149. ],[
  150. "start"
  151. ],[
  152. "start",
  153. ["comment","-- Usage:"]
  154. ],[
  155. "start",
  156. ["identifier","num_args"],
  157. ["paren.lparen","("],
  158. ["keyword","function"],
  159. ["paren.lparen","("],
  160. ["identifier","a"],
  161. ["text",","],
  162. ["identifier","b"],
  163. ["text",","],
  164. ["identifier","c"],
  165. ["text",","],
  166. ["identifier","d"],
  167. ["text",", "],
  168. ["keyword.operator","..."],
  169. ["paren.rparen",")"],
  170. ["text"," "],
  171. ["keyword","end"],
  172. ["paren.rparen",")"],
  173. ["text"," "],
  174. ["comment","-- return 4, 7"]
  175. ],[
  176. "start"
  177. ],[
  178. "start",
  179. ["comment","-- Python styled string format operator"]
  180. ],[
  181. "start",
  182. ["keyword","local"],
  183. ["text"," "],
  184. ["identifier","gm"],
  185. ["text"," "],
  186. ["keyword.operator","="],
  187. ["text"," "],
  188. ["constant.library","debug"],
  189. ["text","."],
  190. ["support.function","getmetatable"],
  191. ["paren.lparen","("],
  192. ["string","\"\""],
  193. ["paren.rparen",")"]
  194. ],[
  195. "start"
  196. ],[
  197. "start",
  198. ["identifier","gm"],
  199. ["text","."],
  200. ["support.function","__mod"],
  201. ["keyword.operator","="],
  202. ["keyword","function"],
  203. ["paren.lparen","("],
  204. ["identifier","self"],
  205. ["text",", "],
  206. ["identifier","other"],
  207. ["paren.rparen",")"]
  208. ],[
  209. "start",
  210. ["text"," "],
  211. ["keyword","if"],
  212. ["text"," "],
  213. ["support.function","type"],
  214. ["paren.lparen","("],
  215. ["identifier","other"],
  216. ["paren.rparen",")"],
  217. ["text"," "],
  218. ["keyword.operator","~="],
  219. ["text"," "],
  220. ["string","\"table\""],
  221. ["text"," "],
  222. ["keyword","then"],
  223. ["text"," "],
  224. ["identifier","other"],
  225. ["text"," "],
  226. ["keyword.operator","="],
  227. ["text"," "],
  228. ["paren.lparen","{"],
  229. ["identifier","other"],
  230. ["paren.rparen","}"],
  231. ["text"," "],
  232. ["keyword","end"]
  233. ],[
  234. "start",
  235. ["text"," "],
  236. ["keyword","for"],
  237. ["text"," "],
  238. ["identifier","i"],
  239. ["text",","],
  240. ["identifier","v"],
  241. ["text"," "],
  242. ["keyword","in"],
  243. ["text"," "],
  244. ["support.function","ipairs"],
  245. ["paren.lparen","("],
  246. ["identifier","other"],
  247. ["paren.rparen",")"],
  248. ["text"," "],
  249. ["keyword","do"],
  250. ["text"," "],
  251. ["identifier","other"],
  252. ["paren.lparen","["],
  253. ["identifier","i"],
  254. ["paren.rparen","]"],
  255. ["text"," "],
  256. ["keyword.operator","="],
  257. ["text"," "],
  258. ["support.function","tostring"],
  259. ["paren.lparen","("],
  260. ["identifier","v"],
  261. ["paren.rparen",")"],
  262. ["text"," "],
  263. ["keyword","end"]
  264. ],[
  265. "start",
  266. ["text"," "],
  267. ["keyword","return"],
  268. ["text"," "],
  269. ["identifier","self"],
  270. ["keyword.operator",":"],
  271. ["support.function","format"],
  272. ["paren.lparen","("],
  273. ["support.function","unpack"],
  274. ["paren.lparen","("],
  275. ["identifier","other"],
  276. ["paren.rparen","))"]
  277. ],[
  278. "start",
  279. ["keyword","end"]
  280. ],[
  281. "start"
  282. ],[
  283. ["bracketedString",5,"start"],
  284. ["support.function","print"],
  285. ["paren.lparen","("],
  286. ["comment","[===["]
  287. ],[
  288. ["bracketedString",5,"start"],
  289. ["comment"," blah blah %s, (%d %d)"]
  290. ],[
  291. "start",
  292. ["comment","]===]"],
  293. ["keyword.operator","%"],
  294. ["paren.lparen","{"],
  295. ["string","\"blah\""],
  296. ["text",", "],
  297. ["identifier","num_args"],
  298. ["paren.lparen","("],
  299. ["identifier","int"],
  300. ["paren.rparen",")})"]
  301. ],[
  302. "start"
  303. ],[
  304. ["bracketedComment",3,"start"],
  305. ["comment","--[=[--"]
  306. ],[
  307. ["bracketedComment",3,"start"],
  308. ["comment","table.maxn is deprecated, use # instead."]
  309. ],[
  310. "start",
  311. ["comment","--]=]--"]
  312. ],[
  313. "start",
  314. ["support.function","print"],
  315. ["paren.lparen","("],
  316. ["constant.library","table"],
  317. ["text","."],
  318. ["invalid.deprecated","maxn"],
  319. ["paren.lparen","{"],
  320. ["constant.numeric","1"],
  321. ["text",","],
  322. ["constant.numeric","2"],
  323. ["text",","],
  324. ["paren.lparen","["],
  325. ["constant.numeric","4"],
  326. ["paren.rparen","]"],
  327. ["keyword.operator","="],
  328. ["constant.numeric","4"],
  329. ["text",","],
  330. ["paren.lparen","["],
  331. ["constant.numeric","8"],
  332. ["paren.rparen","]"],
  333. ["keyword.operator","="],
  334. ["constant.numeric","8"],
  335. ["paren.rparen",")"],
  336. ["text"," "],
  337. ["comment","-- outputs 8 instead of 2"]
  338. ],[
  339. "start"
  340. ],[
  341. "start",
  342. ["support.function","print"],
  343. ["paren.lparen","("],
  344. ["constant.numeric","5"],
  345. ["text"," "],
  346. ["comment","--[[ blah ]]"],
  347. ["paren.rparen",")"]
  348. ]]