@@ -37,16 +37,124 @@ syn match moonKeyword /\<\%(export\|import\|from\|with\|in\|and\|or\|not\|class\
3737\ display
3838hi def link moonKeyword Keyword
3939
40- " bifs
41- syntax match moonBif / \<\% (table\. insert\| table\. concat\| module\| package\. seeall\| require\| print\| pairs\| ipairs\| rawset\| rawget\)\> /
40+ " all built in funcs from Lua 5.1
41+ syn keyword moonLuaFunc assert collectgarbage dofile error next
42+ syn keyword moonLuaFunc print rawget rawset tonumber tostring type _VERSION
43+ syn keyword moonLuaFunc _G getfenv getmetatable ipairs loadfile
44+ syn keyword moonLuaFunc loadstring pairs pcall rawequal
45+ syn keyword moonLuaFunc require setfenv setmetatable unpack xpcall
46+ syn keyword moonLuaFunc load module select
47+ syn match moonLuaFunc / package\. cpath/
48+ syn match moonLuaFunc / package\. loaded/
49+ syn match moonLuaFunc / package\. loadlib/
50+ syn match moonLuaFunc / package\. path/
51+ syn match moonLuaFunc / package\. preload/
52+ syn match moonLuaFunc / package\. seeall/
53+ syn match moonLuaFunc / coroutine\. running/
54+ syn match moonLuaFunc / coroutine\. create/
55+ syn match moonLuaFunc / coroutine\. resume/
56+ syn match moonLuaFunc / coroutine\. status/
57+ syn match moonLuaFunc / coroutine\. wrap/
58+ syn match moonLuaFunc / coroutine\. yield/
59+ syn match moonLuaFunc / string\. byte/
60+ syn match moonLuaFunc / string\. char/
61+ syn match moonLuaFunc / string\. dump/
62+ syn match moonLuaFunc / string\. find/
63+ syn match moonLuaFunc / string\. len/
64+ syn match moonLuaFunc / string\. lower/
65+ syn match moonLuaFunc / string\. rep/
66+ syn match moonLuaFunc / string\. sub/
67+ syn match moonLuaFunc / string\. upper/
68+ syn match moonLuaFunc / string\. format/
69+ syn match moonLuaFunc / string\. gsub/
70+ syn match moonLuaFunc / string\. gmatch/
71+ syn match moonLuaFunc / string\. match/
72+ syn match moonLuaFunc / string\. reverse/
73+ syn match moonLuaFunc / table\. maxn/
74+ syn match moonLuaFunc / table\. concat/
75+ syn match moonLuaFunc / table\. sort/
76+ syn match moonLuaFunc / table\. insert/
77+ syn match moonLuaFunc / table\. remove/
78+ syn match moonLuaFunc / math\. abs/
79+ syn match moonLuaFunc / math\. acos/
80+ syn match moonLuaFunc / math\. asin/
81+ syn match moonLuaFunc / math\. atan/
82+ syn match moonLuaFunc / math\. atan2/
83+ syn match moonLuaFunc / math\. ceil/
84+ syn match moonLuaFunc / math\. sin/
85+ syn match moonLuaFunc / math\. cos/
86+ syn match moonLuaFunc / math\. tan/
87+ syn match moonLuaFunc / math\. deg/
88+ syn match moonLuaFunc / math\. exp/
89+ syn match moonLuaFunc / math\. floor/
90+ syn match moonLuaFunc / math\. log/
91+ syn match moonLuaFunc / math\. log10/
92+ syn match moonLuaFunc / math\. max/
93+ syn match moonLuaFunc / math\. min/
94+ syn match moonLuaFunc / math\. fmod/
95+ syn match moonLuaFunc / math\. modf/
96+ syn match moonLuaFunc / math\. cosh/
97+ syn match moonLuaFunc / math\. sinh/
98+ syn match moonLuaFunc / math\. tanh/
99+ syn match moonLuaFunc / math\. pow/
100+ syn match moonLuaFunc / math\. rad/
101+ syn match moonLuaFunc / math\. sqrt/
102+ syn match moonLuaFunc / math\. frexp/
103+ syn match moonLuaFunc / math\. ldexp/
104+ syn match moonLuaFunc / math\. random/
105+ syn match moonLuaFunc / math\. randomseed/
106+ syn match moonLuaFunc / math\. pi/
107+ syn match moonLuaFunc / io\. stdin/
108+ syn match moonLuaFunc / io\. stdout/
109+ syn match moonLuaFunc / io\. stderr/
110+ syn match moonLuaFunc / io\. close/
111+ syn match moonLuaFunc / io\. flush/
112+ syn match moonLuaFunc / io\. input/
113+ syn match moonLuaFunc / io\. lines/
114+ syn match moonLuaFunc / io\. open/
115+ syn match moonLuaFunc / io\. output/
116+ syn match moonLuaFunc / io\. popen/
117+ syn match moonLuaFunc / io\. read/
118+ syn match moonLuaFunc / io\. tmpfile/
119+ syn match moonLuaFunc / io\. type/
120+ syn match moonLuaFunc / io\. write/
121+ syn match moonLuaFunc / os\. clock/
122+ syn match moonLuaFunc / os\. date/
123+ syn match moonLuaFunc / os\. difftime/
124+ syn match moonLuaFunc / os\. execute/
125+ syn match moonLuaFunc / os\. exit/
126+ syn match moonLuaFunc / os\. getenv/
127+ syn match moonLuaFunc / os\. remove/
128+ syn match moonLuaFunc / os\. rename/
129+ syn match moonLuaFunc / os\. setlocale/
130+ syn match moonLuaFunc / os\. time/
131+ syn match moonLuaFunc / os\. tmpname/
132+ syn match moonLuaFunc / debug\. debug/
133+ syn match moonLuaFunc / debug\. gethook/
134+ syn match moonLuaFunc / debug\. getinfo/
135+ syn match moonLuaFunc / debug\. getlocal/
136+ syn match moonLuaFunc / debug\. getupvalue/
137+ syn match moonLuaFunc / debug\. setlocal/
138+ syn match moonLuaFunc / debug\. setupvalue/
139+ syn match moonLuaFunc / debug\. sethook/
140+ syn match moonLuaFunc / debug\. traceback/
141+ syn match moonLuaFunc / debug\. getfenv/
142+ syn match moonLuaFunc / debug\. getmetatable/
143+ syn match moonLuaFunc / debug\. getregistry/
144+ syn match moonLuaFunc / debug\. setfenv/
145+ syn match moonLuaFunc / debug\. setmetatable/
146+
147+ hi def link moonLuaFunc Identifier
42148
43149" The first case matches symbol operators only if they have an operand before.
44- " need to put \ here
45150syn match moonExtendedOp / \% (\S\s *\)\@ <=[+\- */%&|\^ =!<>?]\+\|\.\|\\\| !/
46151\ display
47152hi def link moonExtendedOp moonOperator
48153hi def link moonOperator Operator
49154
155+ syntax match moonFunction / ->\| =>\| )\| (\|\[\| ]\| {\| }/
156+ highlight default link moonFunction Function
157+
50158" This is separate from `moonExtendedOp` to help differentiate commas from
51159" dots.
52160syn match moonSpecialOp / [,;]/ display
@@ -62,7 +170,7 @@ hi def link moonGlobal Type
62170syn match moonSpecialVar / \<\% (self\)\> / display
63171" An @-variable
64172syn match moonSpecialVar / @\% (\I\i *\)\? / display
65- hi def link moonSpecialVar Special
173+ hi def link moonSpecialVar Structure
66174
67175" A class-like name that starts with a capital letter
68176syn match moonObject / \<\u\w *\> / display
@@ -88,6 +196,10 @@ syn region moonString start=/'/ skip=/\\\\\|\\'/ end=/'/
88196\ contains= @m oonBasicString
89197hi def link moonString String
90198
199+ syn region moonString2 matchgroup =moonString start =" \[\z (=*\)\[ " end =" \]\z 1\] " contains =@Spell
200+ hi def link moonString2 String
201+
202+
91203" A integer, including a leading plus or minus
92204syn match moonNumber / \i\@ <![-+]\?\d\+\% ([eE][+-]\?\d\+\)\? / display
93205" A hex number
@@ -174,30 +286,30 @@ hi def link moonDotAccess moonExtendedOp
174286syn match moonProtoAccess / ::\s *\I\i */ he =s + 2 contains =@moonIdentifier
175287hi def link moonProtoAccess moonExtendedOp
176288
177- " This is required for interpolations to work.
178- syn region moonCurlies matchgroup =moonCurly start =/ {/ end =/ }/
179- \ contains= @m oonAll
180- syn region moonBrackets matchgroup =moonBracket start =/ \[ / end =/ \] /
181- \ contains= @m oonAll
182- syn region moonParens matchgroup =moonParen start =/ (/ end =/ )/
183- \ contains= @m oonAll
184-
185- " These are highlighted the same as commas since they tend to go together.
186- hi def link moonBlock moonSpecialOp
187- hi def link moonBracket moonBlock
188- hi def link moonCurly moonBlock
189- hi def link moonParen moonBlock
289+ " " This is required for interpolations to work.
290+ " syn region moonCurlies matchgroup=moonCurly start=/{/ end=/}/
291+ " \ contains=@moonAll
292+ " syn region moonBrackets matchgroup=moonBracket start=/\[/ end=/\]/
293+ " \ contains=@moonAll
294+ " syn region moonParens matchgroup=moonParen start=/(/ end=/)/
295+ " \ contains=@moonAll
296+ "
297+ " " These are highlighted the same as commas since they tend to go together.
298+ " hi def link moonBlock moonSpecialOp
299+ " hi def link moonBracket moonBlock
300+ " hi def link moonCurly moonBlock
301+ " hi def link moonParen moonBlock
190302
191303" This is used instead of TOP to keep things moon-specific for good
192304" embedding. `contained` groups aren't included.
193305syn cluster moonAll contains =moonStatement,moonRepeat,moonConditional,
194- \ moonKeyword,moonOperator,
306+ \ moonKeyword,moonOperator,moonFunction,
195307\ moonExtendedOp,moonSpecialOp,moonBoolean,
196308\ moonGlobal,moonSpecialVar,moonObject,
197309\ moonConstant,moonString,moonNumber,
198310\ moonFloat,moonReservedError,moonObjAssign,
199311\ moonObjStringAssign,moonObjNumberAssign,
200- \ moonComment,
312+ \ moonComment,moonLuaFunc,
201313\ moonSpaceError,moonSemicolonError,
202314\ moonDotAccess,moonProtoAccess,
203315\ moonCurlies,moonBrackets,moonParens