-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathCoronaSDKLua.sublime-syntax
84 lines (84 loc) · 4.15 KB
/
CoronaSDKLua.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Lua (Solar2D)
comment: "Lua Syntax for Solar2D: version 0.2 (after Lua Syntax: version 0.8)"
file_extensions:
- lua
scope: source.lua.corona
contexts:
main:
- match: '--\[(=*)\['
captures:
0: punctuation.definition.comment.lua
push: string
- match: '([\s]*-{2})(?!\[\[).*$\n?'
scope: comment.line.double-dash.lua
captures:
1: punctuation.definition.comment.lua
- match: '(\w+)?(?:\s*=\s*)*(function\s*)(\w+\s*[:.]+)*(?:\s+)*(\w+)*\s*(\()(.*)(\))'
comment: 'Find the various kinds of function definition in Lua: for any line containing "function", match optional "local" and/or "function", match identifier with optional classname, discard optional "=", match optional "function", match "(", match everything until closing ")", match ")"'
scope: meta.function.lua
captures:
1: entity.name.function.scope.lua
2: keyword.control.lua
3: entity.name.function.scope.lua
4: entity.name.function.scope.lua
5: punctuation.definition.parameters.begin.lua
6: variable
7: punctuation.definition.parameters.end.lua
- match: '(?<![\d.])\s0x[a-fA-F\d]+|\b\d+(\.\d+)?([eE]-?\d+)?|\.\d+([eE]-?\d+)?'
scope: constant.numeric.lua
- match: "'"
captures:
0: punctuation.definition.string.begin.lua
push:
- meta_scope: string.quoted.single.lua
- match: "'"
captures:
0: punctuation.definition.string.end.lua
pop: true
- match: \\.
scope: constant.character.escape.lua
- match: '"'
captures:
0: punctuation.definition.string.begin.lua
push:
- meta_scope: string.quoted.double.lua
- match: '"'
captures:
0: punctuation.definition.string.end.lua
pop: true
- match: \\.
scope: constant.character.escape.lua
- match: '(?<!--)\[(=*)\['
captures:
0: punctuation.definition.string.begin.lua
push:
- meta_scope: string.quoted.other.multiline.lua
- match: '\]\1\]'
captures:
0: punctuation.definition.string.end.lua
pop: true
- match: \b(break|do|else|for|if|elseif|return|then|repeat|while|until|end|function|local|in)\b
scope: keyword.control.lua
- match: '(?<![^.]\.|:)\b(false|nil|true|_G|_VERSION|math\.(pi|huge))\b|(?<![.])\.{3}(?!\.)'
scope: constant.language.lua
- match: '(?<![^.]\.|:)\b(self)\b'
scope: variable.language.self.lua
- match: '(?<![^.]\.|:)\b(assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|loadfile|loadstring|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\b(?=[( {])'
scope: support.function.lua
- match: '(?<![^.]\.|:)\b(coroutine\.(create|resume|running|status|wrap|yield)|string\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)|table\.(concat|insert|maxn|remove|sort)|math\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pow|rad|random|randomseed|sinh?|sqrt|tanh?)|io\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|os\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\.(cpath|loaded|loadlib|path|preload|seeall)|debug\.(debug|[gs]etfenv|[gs]ethook|getinfo|[gs]etlocal|[gs]etmetatable|getregistry|[gs]etupvalue|traceback))\b(?=[( {])'
scope: support.function.library.lua
- match: '\b(ads|analytics|audio|composer|credits|crypto|display|easing|facebook|gameNetwork|global|graphics|io|json|lfs|licensing|math|mime|media|native|network|os|package|physics|socket|sprite|sqlite3|store|storyboard|string|syntax|system|table|timer|transition|widget)\.[a-zA-Z0-9]+\b'
scope: support.function.library.corona
- match: \b(and|or|not)\b
scope: keyword.operator.lua
- match: '\+|-|%|#|\*|\/|\^|==?|~=|<=?|>=?|(?<!\.)\.{2}(?!\.)'
scope: keyword.operator.lua
string:
- meta_scope: comment.block.lua
- match: '\]\1\]'
captures:
0: punctuation.definition.comment.lua
pop: true