robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f3ee2440c7
master
1; Keywords 2"return" @ keyword.return 3 4[ 5"goto" 6"in" 7"local" 8] @ keyword 9 10( break_statement ) @ keyword 11 12( do_statement 13[ 14"do" 15"end" 16] @ keyword ) 17 18( while_statement 19[ 20"while" 21"do" 22"end" 23] @ keyword.repeat ) 24 25( repeat_statement 26[ 27"repeat" 28"until" 29] @ keyword.repeat ) 30 31( if_statement 32[ 33"if" 34"elseif" 35"else" 36"then" 37"end" 38] @ keyword.conditional ) 39 40( elseif_statement 41[ 42"elseif" 43"then" 44"end" 45] @ keyword.conditional ) 46 47( else_statement 48[ 49"else" 50"end" 51] @ keyword.conditional ) 52 53( for_statement 54[ 55"for" 56"do" 57"end" 58] @ keyword.repeat ) 59 60( function_declaration 61[ 62"function" 63"end" 64] @ keyword.function ) 65 66( function_definition 67[ 68"function" 69"end" 70] @ keyword.function ) 71 72; Operators 73( binary_expression 74operator : _ @ operator ) 75 76( unary_expression 77operator : _ @ operator ) 78 79"=" @ operator 80 81[ 82"and" 83"not" 84"or" 85] @ keyword.operator 86 87; Punctuations 88[ 89";" 90":" 91"::" 92"," 93"." 94] @ punctuation.delimiter 95 96; Brackets 97[ 98"(" 99")" 100"[" 101"]" 102"{" 103"}" 104] @ punctuation.bracket 105 106; Variables 107( identifier ) @ variable 108 109(( identifier ) @ constant.builtin 110(# eq ? @ constant.builtin "_VERSION" )) 111 112(( identifier ) @ variable.builtin 113(# eq ? @ variable.builtin "self" )) 114 115(( identifier ) @ module.builtin 116(# any-of ? @ module.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8" )) 117 118(( identifier ) @ keyword.coroutine 119(# eq ? @ keyword.coroutine "coroutine" )) 120 121( variable_list 122( attribute 123"<" @ punctuation.bracket 124( identifier ) @ attribute 125">" @ punctuation.bracket )) 126 127; Labels 128( label_statement 129( identifier ) @ label ) 130 131( goto_statement 132( identifier ) @ label ) 133 134; Constants 135(( identifier ) @ constant 136(# lua-match ? @ constant "^[A-Z][A-Z_0-9]*$" )) 137 138( nil ) @ constant.builtin 139 140[ 141( false ) 142( true ) 143] @ boolean 144 145; Tables 146( field 147name : ( identifier ) @ property ) 148 149( dot_index_expression 150field : ( identifier ) @ variable.member ) 151 152( table_constructor 153[ 154"{" 155"}" 156] @ constructor ) 157 158; Functions 159( parameters 160( identifier ) @ variable.parameter ) 161 162( vararg_expression ) @ variable.parameter.builtin 163 164( function_declaration 165name : [ 166( identifier ) @ function 167( dot_index_expression 168field : ( identifier ) @ function ) 169]) 170 171( function_declaration 172name : ( method_index_expression 173method : ( identifier ) @ function.method )) 174 175( assignment_statement 176( variable_list 177. 178name : [ 179( identifier ) @ function 180( dot_index_expression 181field : ( identifier ) @ function ) 182]) 183( expression_list 184. 185value : ( function_definition ))) 186 187( table_constructor 188( field 189name : ( identifier ) @ function 190value : ( function_definition ))) 191 192( function_call 193name : [ 194( identifier ) @ function.call 195( dot_index_expression 196field : ( identifier ) @ function.call ) 197( method_index_expression 198method : ( identifier ) @ function.method.call ) 199]) 200 201( function_call 202( identifier ) @ function.builtin 203(# any-of ? @ function.builtin 204; built-in functions in Lua 5.1 205"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" "load" "loadfile" 206"loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" 207"require" "select" "setfenv" "setmetatable" "tonumber" "tostring" "type" "unpack" "xpcall" 208"__add" "__band" "__bnot" "__bor" "__bxor" "__call" "__concat" "__div" "__eq" "__gc" "__idiv" 209"__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex" "__pairs" 210"__pow" "__shl" "__shr" "__sub" "__tostring" "__unm" )) 211 212; Others 213( comment ) @ comment @ spell 214 215(( comment ) @ comment.documentation 216(# lua-match ? @ comment.documentation "^[-][-][-]" )) 217 218(( comment ) @ comment.documentation 219(# lua-match ? @ comment.documentation "^[-][-](%s?)@" )) 220 221( hash_bang_line ) @ keyword.directive 222 223( number ) @ number 224 225( string ) @ string 226 227( escape_sequence ) @ string.escape 228 229; string.match("123", "%d+") 230( function_call 231( dot_index_expression 232field : ( identifier ) @ _method 233(# any-of ? @ _method "find" "match" "gmatch" "gsub" )) 234arguments : ( arguments 235. 236( _ ) 237. 238( string 239content : ( string_content ) @ string.regexp ))) 240 241;("123"):match("%d+") 242( function_call 243( method_index_expression 244method : ( identifier ) @ _method 245(# any-of ? @ _method "find" "match" "gmatch" "gsub" )) 246arguments : ( arguments 247. 248( string 249content : ( string_content ) @ string.regexp )))