1" MUSHcode syntax file
2" Maintainer: Rick Bird <nveid@nveid.com>
3" Based on vim Syntax file by: Bek Oberin <gossamer@tertius.net.au>
4" Last Updated: Fri Nov 04 20:28:15 2005
5"
6" For version 5.x: Clear all syntax items
7" For version 6.x: Quit when a syntax file was already loaded
8if version < 600
9  syntax clear
10elseif exists("b:current_syntax")
11  finish
12endif
13
14
15" regular mush functions
16
17syntax keyword mushFunction contained @@ abs accent accname acos add after align
18syntax keyword mushFunction contained allof alphamax alphamin and andflags
19syntax keyword mushFunction contained andlflags andlpowers andpowers ansi aposs art
20syntax keyword mushFunction contained asin atan atan2 atrlock attrcnt band baseconv
21syntax keyword mushFunction contained beep before blank2tilde bnand bnot bor bound
22syntax keyword mushFunction contained brackets break bxor cand cansee capstr case
23syntax keyword mushFunction contained caseall cat ceil center checkpass children
24syntax keyword mushFunction contained chr clone cmds cnetpost comp con config conn
25syntax keyword mushFunction contained controls convsecs convtime convutcsecs cor
26syntax keyword mushFunction contained cos create ctime ctu dec decrypt default
27syntax keyword mushFunction contained delete die dig digest dist2d dist3d div
28syntax keyword mushFunction contained division divscope doing downdiv dynhelp e
29syntax keyword mushFunction contained edefault edit element elements elist elock
30syntax keyword mushFunction contained emit empire empower encrypt endtag entrances
31syntax keyword mushFunction contained eq escape etimefmt eval exit exp extract fdiv
32syntax keyword mushFunction contained filter filterbool findable first firstof
33syntax keyword mushFunction contained flags flip floor floordiv fmod fold
34syntax keyword mushFunction contained folderstats followers following foreach
35syntax keyword mushFunction contained fraction fullname functions get get_eval grab
36syntax keyword mushFunction contained graball grep grepi gt gte hasattr hasattrp
37syntax keyword mushFunction contained hasattrpval hasattrval hasdivpower hasflag
38syntax keyword mushFunction contained haspower haspowergroup hastype height hidden
39syntax keyword mushFunction contained home host hostname html idle idlesecs
40syntax keyword mushFunction contained idle_average idle_times idle_total if ifelse
41syntax keyword mushFunction contained ilev iname inc index indiv indivall insert
42syntax keyword mushFunction contained inum ipaddr isdaylight isdbref isint isnum
43syntax keyword mushFunction contained isword itemize items iter itext last lattr
44syntax keyword mushFunction contained lcon lcstr ldelete ldivisions left lemit
45syntax keyword mushFunction contained level lexits lflags link list lit ljust lmath
46syntax keyword mushFunction contained ln lnum loc localize locate lock loctree log
47syntax keyword mushFunction contained lparent lplayers lports lpos lsearch lsearchr
48syntax keyword mushFunction contained lstats lt lte lthings lvcon lvexits lvplayers
49syntax keyword mushFunction contained lvthings lwho mail maildstats mailfrom
50syntax keyword mushFunction contained mailfstats mailstats mailstatus mailsubject
51syntax keyword mushFunction contained mailtime map match matchall max mean median
52syntax keyword mushFunction contained member merge mid min mix mod modulo modulus
53syntax keyword mushFunction contained money mtime mudname mul munge mwho name nand
54syntax keyword mushFunction contained nattr ncon nearby neq nexits next nor not
55syntax keyword mushFunction contained nplayers nsemit nslemit nsoemit nspemit
56syntax keyword mushFunction contained nsremit nszemit nthings null num nvcon
57syntax keyword mushFunction contained nvexits nvplayers nvthings obj objeval objid
58syntax keyword mushFunction contained objmem oemit ooref open or ord orflags
59syntax keyword mushFunction contained orlflags orlpowers orpowers owner parent
60syntax keyword mushFunction contained parse pcreate pemit pi pickrand playermem
61syntax keyword mushFunction contained pmatch poll ports pos poss power powergroups
62syntax keyword mushFunction contained powers powover program prompt pueblo quitprog
63syntax keyword mushFunction contained quota r rand randword recv regedit regeditall
64syntax keyword mushFunction contained regeditalli regediti regmatch regmatchi
65syntax keyword mushFunction contained regrab regraball regraballi regrabi regrep
66syntax keyword mushFunction contained regrepi remainder remit remove repeat replace
67syntax keyword mushFunction contained rest restarts restarttime reswitch
68syntax keyword mushFunction contained reswitchall reswitchalli reswitchi reverse
69syntax keyword mushFunction contained revwords right rjust rloc rnum room root
70syntax keyword mushFunction contained round s scan scramble search secs secure sent
71syntax keyword mushFunction contained set setdiff setinter setq setr setunion sha0
72syntax keyword mushFunction contained shl shr shuffle sign signal sin sort sortby
73syntax keyword mushFunction contained soundex soundlike soundslike space spellnum
74syntax keyword mushFunction contained splice sql sqlescape sqrt squish ssl
75syntax keyword mushFunction contained starttime stats stddev step strcat strinsert
76syntax keyword mushFunction contained stripaccents stripansi strlen strmatch
77syntax keyword mushFunction contained strreplace sub subj switch switchall t table
78syntax keyword mushFunction contained tag tagwrap tan tel terminfo textfile
79syntax keyword mushFunction contained tilde2blank time timefmt timestring tr
80syntax keyword mushFunction contained trigger trim trimpenn trimtiny trunc type u
81syntax keyword mushFunction contained ucstr udefault ufun uldefault ulocal updiv
82syntax keyword mushFunction contained utctime v vadd val valid vcross vdim vdot
83syntax keyword mushFunction contained version visible vmag vmax vmin vmul vsub
84syntax keyword mushFunction contained vtattr vtcount vtcreate vtdestroy vtlcon
85syntax keyword mushFunction contained vtloc vtlocate vtmaster vtname vtref vttel
86syntax keyword mushFunction contained vunit wait where width wipe wordpos words
87syntax keyword mushFunction contained wrap xcon xexits xget xor xplayers xthings
88syntax keyword mushFunction contained xvcon xvexits xvplayers xvthings zemit zfun
89syntax keyword mushFunction contained zmwho zone zwho
90
91" only highligh functions when they have an in-bracket immediately after
92syntax match mushFunctionBrackets  "\i*(" contains=mushFunction
93"
94" regular mush commands
95syntax keyword mushAtCommandList contained @ALLHALT @ALLQUOTA @ASSERT @ATRCHOWN @ATRLOCK @ATTRIBUTE @BOOT 
96syntax keyword mushAtCommandList contained @BREAK @CEMIT @CHANNEL @CHAT @CHOWN @CHOWNALL @CHZONE @CHZONEALL 
97syntax keyword mushAtCommandList contained @CLOCK @CLONE @COBJ @COMMAND @CONFIG @CPATTR @CREATE @CRPLOG @DBCK
98syntax keyword mushAtCommandList contained @DECOMPILE @DESTROY @DIG @DISABLE @DIVISION @DOING @DOLIST @DRAIN 
99syntax keyword mushAtCommandList contained @DUMP @EDIT @ELOCK @EMIT @EMPOWER @ENABLE @ENTRANCES @EUNLOCK @FIND 
100syntax keyword mushAtCommandList contained @FIRSTEXIT @FLAG @FORCE @FUNCTION @EDIT @GREP @HALT @HIDE @HOOK @KICK 
101syntax keyword mushAtCommandList contained @LEMIT @LEVEL @LINK @LIST @LISTMOTD @LOCK @LOG @LOGWIPE @LSET @MAIL @MALIAS 
102syntax keyword mushAtCommandList contained @MAP @MOTD @MVATTR @NAME @NEWPASSWORD @NOTIFY @NSCEMIT @NSEMIT @NSLEMIT 
103syntax keyword mushAtCommandList contained @NSOEMIT @NSPEMIT @NSPEMIT @NSREMIT @NSZEMIT @NUKE @OEMIT @OPEN @PARENT @PASSWORD
104syntax keyword mushAtCommandList contained @PCREATE @PEMIT @POLL @POOR @POWERLEVEL @PROGRAM @PROMPT @PS @PURGE @QUOTA 
105syntax keyword mushAtCommandList contained @READCACHE @RECYCLE @REJECTMOTD @REMIT @RESTART @SCAN @SEARCH @SELECT @SET 
106syntax keyword mushAtCommandList contained @SHUTDOWN @SITELOCK @SNOOP @SQL @SQUOTA @STATS @SWITCH @SWEEP @SWITCH @TELEPORT 
107syntax keyword mushAtCommandList contained @TRIGGER @ULOCK @UNDESTROY @UNLINK @UNLOCK @UNRECYCLE @UPTIME @UUNLOCK @VERB 
108syntax keyword mushAtCommandList contained @VERSION @WAIT @WALL @WARNINGS @WCHECK @WHEREIS @WIPE @ZCLONE @ZEMIT
109syntax match mushCommand  "@\i\I*" contains=mushAtCommandList
110
111
112syntax keyword mushCommand AHELP ANEWS ATTRIB_SET BRIEF BRIEF BUY CHANGES DESERT
113syntax keyword mushCommand DISMISS DROP EMPTY ENTER EXAMINE FOLLOW GET GIVE GOTO 
114syntax keyword mushCommand HELP HUH_COMMAND INVENTORY INVENTORY LOOK LEAVE LOOK
115syntax keyword mushCommand GOTO NEWS PAGE PAGE POSE RULES SAY SCORE SEMIPOSE 
116syntax keyword mushCommand SPECIALNEWS TAKE TEACH THINK UNFOLLOW USE WHISPER WHISPER
117syntax keyword mushCommand WARN_ON_MISSING WHISPER WITH
118
119syntax match mushSpecial     "\*\|!\|=\|-\|\\\|+"
120syntax match mushSpecial2 contained     "\*"
121
122syn region    mushString         start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=mushSpecial,mushSpecial2,@Spell
123
124
125syntax match mushIdentifier   "&[^ ]\+"
126
127syntax match mushVariable   "%r\|%t\|%cr\|%[A-Za-z0-9]\+\|%#\|##\|here"
128
129" numbers
130syntax match mushNumber	+[0-9]\++
131
132" A comment line starts with a or # or " at the start of the line
133" or an @@
134syntax keyword mushTodo contained	TODO FIXME XXX
135syntax cluster mushCommentGroup contains=mushTodo
136syntax match	mushComment	"^\s*@@.*$"	contains=mushTodo
137syntax match mushComment "^#[^define|^ifdef|^else|^pragma|^ifndef|^echo|^elif|^undef|^warning].*$" contains=mushTodo
138syntax match mushComment "^#$" contains=mushTodo
139syntax region mushComment        matchgroup=mushCommentStart start="/@@" end="@@/" contains=@mushCommentGroup,mushCommentStartError,mushCommentString,@Spell
140syntax region mushCommentString  contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+@@/+me=s-1 contains=mushCommentSkip
141syntax match  mushCommentSkip    contained "^\s*@@\($\|\s\+\)"
142
143
144syntax match mushCommentStartError display "/@@"me=e-1 contained
145
146" syntax match	mushComment	+^".*$+	contains=mushTodo
147" Work on this one
148" syntax match	mushComment	+^#.*$+	contains=mushTodo
149
150syn region      mushPreCondit      start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=mushComment
151syn match       mushPreCondit      display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
152
153syn cluster     mushPreProcGroup   contains=mushPreCondit,mushIncluded,mushInclude,mushDefine,mushSpecial,mushString,mushCommentSkip,mushCommentString,@mushCommentGroup,mushCommentStartError
154
155syn region      mushIncluded       display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
156syn match       mushIncluded       display contained "<[^>]*>"
157syn match       mushInclude        display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=mushIncluded
158syn region	mushDefine		start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 contains=ALLBUT,@mushPreProcGroup,@Spell
159syn region	mushPreProc	start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@mushPreProcGroup
160
161
162syntax region	mushFuncBoundaries start="\[" end="\]" contains=mushFunction,mushFlag,mushAttributes,mushNumber,mushCommand,mushVariable,mushSpecial2
163
164" FLAGS
165syntax keyword mushFlag PLAYER ABODE BUILDER CHOWN_OK DARK FLOATING
166syntax keyword mushFlag GOING HAVEN INHERIT JUMP_OK KEY LINK_OK MONITOR
167syntax keyword mushFlag NOSPOOF OPAQUE QUIET STICKY TRACE UNFINDABLE VISUAL
168syntax keyword mushFlag WIZARD PARENT_OK ZONE AUDIBLE CONNECTED DESTROY_OK
169syntax keyword mushFlag ENTER_OK HALTED IMMORTAL LIGHT MYOPIC PUPPET TERSE
170syntax keyword mushFlag ROBOT SAFE TRANSPARENT VERBOSE CONTROL_OK COMMANDS
171
172syntax keyword mushAttribute aahear aclone aconnect adesc adfail adisconnect
173syntax keyword mushAttribute adrop aefail aenter afail agfail ahear akill
174syntax keyword mushAttribute aleave alfail alias amhear amove apay arfail
175syntax keyword mushAttribute asucc atfail atport aufail ause away charges
176syntax keyword mushAttribute cost desc dfail drop ealias efail enter fail
177syntax keyword mushAttribute filter forwardlist gfail idesc idle infilter
178syntax keyword mushAttribute inprefix kill lalias last lastsite leave lfail
179syntax keyword mushAttribute listen move odesc odfail odrop oefail oenter
180syntax keyword mushAttribute ofail ogfail okill oleave olfail omove opay
181syntax keyword mushAttribute orfail osucc otfail otport oufail ouse oxenter
182syntax keyword mushAttribute oxleave oxtport pay prefix reject rfail runout
183syntax keyword mushAttribute semaphore sex startup succ tfail tport ufail
184syntax keyword mushAttribute use va vb vc vd ve vf vg vh vi vj vk vl vm vn
185syntax keyword mushAttribute vo vp vq vr vs vt vu vv vw vx vy vz
186
187
188if version >= 508 || !exists("did_mush_syntax_inits")
189  if version < 508
190    let did_mush_syntax_inits = 1
191    command -nargs=+ HiLink hi link <args>
192  else
193    command -nargs=+ HiLink hi def link <args>
194  endif
195
196  " The default methods for highlighting.  Can be overridden later
197  HiLink mushAttribute  Constant
198  HiLink mushCommand    Function
199  HiLink mushNumber     Number
200  HiLink mushSetting    PreProc
201  HiLink mushFunction   Statement
202  HiLink mushVariable   Identifier
203  HiLink mushSpecial    Special
204  HiLink mushTodo       Todo
205  HiLink mushFlag       Special
206  HiLink mushIdentifier Identifier
207  HiLink mushDefine     Macro
208  HiLink mushPreProc    PreProc
209  HiLink mushPreProcGroup PreProc 
210  HiLink mushPreCondit PreCondit
211  HiLink mushIncluded cString
212  HiLink  mushInclude Include
213
214
215
216" Comments
217  HiLink mushCommentStart mushComment
218  HiLink mushComment    Comment
219  HiLink mushCommentString mushString
220
221
222  delcommand HiLink
223endif
224
225let b:current_syntax = "mush"
226
227" mush: ts=17
228