xref: /vim-8.2.3635/runtime/syntax/moo.vim (revision cb80aa2d)
1071d4279SBram Moolenaar" Vim syntax file
2071d4279SBram Moolenaar" Language:	MOO
3071d4279SBram Moolenaar" Maintainer:	Timo Frenay <[email protected]>
4*cb80aa2dSBram Moolenaar" Last Change:	2020 Oct 19
5071d4279SBram Moolenaar" Note:		Requires Vim 6.0 or above
6071d4279SBram Moolenaar
789bcfda6SBram Moolenaar" quit when a syntax file was already loaded
889bcfda6SBram Moolenaarif exists("b:current_syntax")
9071d4279SBram Moolenaar  finish
10071d4279SBram Moolenaarendif
11071d4279SBram Moolenaar
12071d4279SBram Moolenaar" Initializations
13071d4279SBram Moolenaarsyn case ignore
14071d4279SBram Moolenaar
15071d4279SBram Moolenaar" C-style comments
16071d4279SBram Moolenaarsyn match mooUncommentedError display ~\*/~
17071d4279SBram Moolenaarsyn match mooCStyleCommentError display ~/\ze\*~ contained
18071d4279SBram Moolenaarsyn region mooCStyleComment matchgroup=mooComment start=~/\*~ end=~\*/~ contains=mooCStyleCommentError
19071d4279SBram Moolenaar
20071d4279SBram Moolenaar" Statements
21071d4279SBram Moolenaarif exists("moo_extended_cstyle_comments")
22071d4279SBram Moolenaar  syn match mooIdentifier display ~\%(\%(/\*.\{-}\*/\s*\)*\)\@>\<\h\w*\>~ contained transparent contains=mooCStyleComment,@mooKeyword,mooType,mooVariable
23071d4279SBram Moolenaarelse
24071d4279SBram Moolenaar  syn match mooIdentifier display ~\<\h\w*\>~ contained transparent contains=@mooKeyword,mooType,mooVariable
25071d4279SBram Moolenaarendif
26071d4279SBram Moolenaarsyn keyword mooStatement break continue else elseif endfor endfork endif endtry endwhile finally for if try
27071d4279SBram Moolenaarsyn keyword mooStatement except fork while nextgroup=mooIdentifier skipwhite
28071d4279SBram Moolenaarsyn keyword mooStatement return nextgroup=mooString skipwhite
29071d4279SBram Moolenaar
30071d4279SBram Moolenaar" Operators
31071d4279SBram Moolenaarsyn keyword mooOperatorIn in
32071d4279SBram Moolenaar
33071d4279SBram Moolenaar" Error constants
34071d4279SBram Moolenaarsyn keyword mooAny ANY
35071d4279SBram Moolenaarsyn keyword mooErrorConstant E_ARGS E_INVARG E_DIV E_FLOAT E_INVIND E_MAXREC E_NACC E_NONE E_PERM E_PROPNF E_QUOTA E_RANGE E_RECMOVE E_TYPE E_VARNF E_VERBNF
36071d4279SBram Moolenaar
37071d4279SBram Moolenaar" Builtin variables
38071d4279SBram Moolenaarsyn match mooType display ~\<\%(ERR\|FLOAT\|INT\|LIST\|NUM\|OBJ\|STR\)\>~
39071d4279SBram Moolenaarsyn match mooVariable display ~\<\%(args\%(tr\)\=\|caller\|dobj\%(str\)\=\|iobj\%(str\)\=\|player\|prepstr\|this\|verb\)\>~
40071d4279SBram Moolenaar
41071d4279SBram Moolenaar" Strings
42071d4279SBram Moolenaarsyn match mooStringError display ~[^\t -[\]-~]~ contained
43071d4279SBram Moolenaarsyn match mooStringSpecialChar display ~\\["\\]~ contained
44071d4279SBram Moolenaarif !exists("moo_no_regexp")
45071d4279SBram Moolenaar  " Regular expressions
46071d4279SBram Moolenaar  syn match mooRegexp display ~%%~ contained containedin=mooString,mooRegexpParentheses transparent contains=NONE
47071d4279SBram Moolenaar  syn region mooRegexpParentheses display matchgroup=mooRegexpOr start=~%(~ skip=~%%~ end=~%)~ contained containedin=mooString,mooRegexpParentheses transparent oneline
48071d4279SBram Moolenaar  syn match mooRegexpOr display ~%|~ contained containedin=mooString,mooRegexpParentheses
49071d4279SBram Moolenaarendif
50071d4279SBram Moolenaarif !exists("moo_no_pronoun_sub")
51071d4279SBram Moolenaar  " Pronoun substitutions
52071d4279SBram Moolenaar  syn match mooPronounSub display ~%%~ contained containedin=mooString transparent contains=NONE
53071d4279SBram Moolenaar  syn match mooPronounSub display ~%[#dilnopqrst]~ contained containedin=mooString
54071d4279SBram Moolenaar  syn match mooPronounSub display ~%\[#[dilnt]\]~ contained containedin=mooString
55071d4279SBram Moolenaar  syn match mooPronounSub display ~%(\h\w*)~ contained containedin=mooString
56071d4279SBram Moolenaar  syn match mooPronounSub display ~%\[[dilnt]\h\w*\]~ contained containedin=mooString
57071d4279SBram Moolenaar  syn match mooPronounSub display ~%<\%([dilnt]:\)\=\a\+>~ contained containedin=mooString
58071d4279SBram Moolenaarendif
59071d4279SBram Moolenaarif exists("moo_unmatched_quotes")
60071d4279SBram Moolenaar  syn region mooString matchgroup=mooStringError start=~"~ end=~$~ contains=@mooStringContents keepend
61071d4279SBram Moolenaar  syn region mooString start=~"~ skip=~\\.~ end=~"~ contains=@mooStringContents oneline keepend
62071d4279SBram Moolenaarelse
63071d4279SBram Moolenaar  syn region mooString start=~"~ skip=~\\.~ end=~"\|$~ contains=@mooStringContents keepend
64071d4279SBram Moolenaarendif
65071d4279SBram Moolenaar
66071d4279SBram Moolenaar" Numbers and object numbers
67071d4279SBram Moolenaarsyn match mooNumber display ~\%(\%(\<\d\+\)\=\.\d\+\|\<\d\+\)\%(e[+\-]\=\d\+\)\=\>~
68071d4279SBram Moolenaarsyn match mooObject display ~#-\=\d\+\>~
69071d4279SBram Moolenaar
70071d4279SBram Moolenaar" Properties and verbs
71071d4279SBram Moolenaarif exists("moo_builtin_properties")
72071d4279SBram Moolenaar  "Builtin properties
73071d4279SBram Moolenaar  syn keyword mooBuiltinProperty contents f location name owner programmer r w wizard contained containedin=mooPropRef
74071d4279SBram Moolenaarendif
75071d4279SBram Moolenaarif exists("moo_extended_cstyle_comments")
76071d4279SBram Moolenaar  syn match mooPropRef display ~\.\s*\%(\%(/\*.\{-}\*/\s*\)*\)\@>\h\w*\>~ transparent contains=mooCStyleComment,@mooKeyword
77071d4279SBram Moolenaar  syn match mooVerbRef display ~:\s*\%(\%(/\*.\{-}\*/\s*\)*\)\@>\h\w*\>~ transparent contains=mooCStyleComment,@mooKeyword
78071d4279SBram Moolenaarelse
79071d4279SBram Moolenaar  syn match mooPropRef display ~\.\s*\h\w*\>~ transparent contains=@mooKeyword
80071d4279SBram Moolenaar  syn match mooVerbRef display ~:\s*\h\w*\>~ transparent contains=@mooKeyword
81071d4279SBram Moolenaarendif
82071d4279SBram Moolenaar
83071d4279SBram Moolenaar" Builtin functions, core properties and core verbs
84071d4279SBram Moolenaarif exists("moo_extended_cstyle_comments")
85071d4279SBram Moolenaar  syn match mooBuiltinFunction display ~\<\h\w*\s*\%(\%(/\*.\{-}\*/\s*\)*\)\@>\ze(~ contains=mooCStyleComment
86071d4279SBram Moolenaar  syn match mooCorePropOrVerb display ~\$\s*\%(\%(/\*.\{-}\*/\s*\)*\)\@>\%(in\>\)\@!\h\w*\>~ contains=mooCStyleComment,@mooKeyword
87071d4279SBram Moolenaarelse
88071d4279SBram Moolenaar  syn match mooBuiltinFunction display ~\<\h\w*\s*\ze(~ contains=NONE
89071d4279SBram Moolenaar  syn match mooCorePropOrVerb display ~\$\s*\%(in\>\)\@!\h\w*\>~ contains=@mooKeyword
90071d4279SBram Moolenaarendif
91071d4279SBram Moolenaarif exists("moo_unknown_builtin_functions")
92071d4279SBram Moolenaar  syn match mooUnknownBuiltinFunction ~\<\h\w*\>~ contained containedin=mooBuiltinFunction contains=mooKnownBuiltinFunction
93071d4279SBram Moolenaar  " Known builtin functions as of version 1.8.1 of the server
94071d4279SBram Moolenaar  " Add your own extensions to this group if you like
95071d4279SBram Moolenaar  syn keyword mooKnownBuiltinFunction abs acos add_property add_verb asin atan binary_hash boot_player buffered_output_length callers caller_perms call_function ceil children chparent clear_property connected_players connected_seconds connection_name connection_option connection_options cos cosh create crypt ctime db_disk_size decode_binary delete_property delete_verb disassemble dump_database encode_binary equal eval exp floatstr floor flush_input force_input function_info idle_seconds index is_clear_property is_member is_player kill_task length listappend listdelete listen listeners listinsert listset log log10 match max max_object memory_usage min move notify object_bytes open_network_connection output_delimiters parent pass players properties property_info queued_tasks queue_info raise random read recycle renumber reset_max_object resume rindex rmatch seconds_left server_log server_version setadd setremove set_connection_option set_player_flag set_property_info set_task_perms set_verb_args set_verb_code set_verb_info shutdown sin sinh sqrt strcmp string_hash strsub substitute suspend tan tanh task_id task_stack ticks_left time tofloat toint toliteral tonum toobj tostr trunc typeof unlisten valid value_bytes value_hash verbs verb_args verb_code verb_info contained
96071d4279SBram Moolenaarendif
97071d4279SBram Moolenaar
98*cb80aa2dSBram Moolenaar" Enclosed expressions
99071d4279SBram Moolenaarsyn match mooUnenclosedError display ~[')\]|}]~
100071d4279SBram Moolenaarsyn match mooParenthesesError display ~[';\]|}]~ contained
101071d4279SBram Moolenaarsyn region mooParentheses start=~(~ end=~)~ transparent contains=@mooEnclosedContents,mooParenthesesError
102071d4279SBram Moolenaarsyn match mooBracketsError display ~[');|}]~ contained
103071d4279SBram Moolenaarsyn region mooBrackets start=~\[~ end=~\]~ transparent contains=@mooEnclosedContents,mooBracketsError
104071d4279SBram Moolenaarsyn match mooBracesError display ~[');\]|]~ contained
105071d4279SBram Moolenaarsyn region mooBraces start=~{~ end=~}~ transparent contains=@mooEnclosedContents,mooBracesError
106071d4279SBram Moolenaarsyn match mooQuestionError display ~[');\]}]~ contained
107071d4279SBram Moolenaarsyn region mooQuestion start=~?~ end=~|~ transparent contains=@mooEnclosedContents,mooQuestionError
108071d4279SBram Moolenaarsyn match mooCatchError display ~[);\]|}]~ contained
109071d4279SBram Moolenaarsyn region mooCatch matchgroup=mooExclamation start=~`~ end=~'~ transparent contains=@mooEnclosedContents,mooCatchError,mooExclamation
110071d4279SBram Moolenaarif exists("moo_extended_cstyle_comments")
111071d4279SBram Moolenaar  syn match mooExclamation display ~[\t !%&(*+,\-/<=>?@[^`{|]\@<!\s*\%(\%(/\*.\{-}\*/\s*\)*\)\@>!=\@!~ contained contains=mooCStyleComment
112071d4279SBram Moolenaarelse
113071d4279SBram Moolenaar  syn match mooExclamation display ~[\t !%&(*+,\-/<=>?@[^`{|]\@<!\s*!=\@!~ contained
114071d4279SBram Moolenaarendif
115071d4279SBram Moolenaar
116071d4279SBram Moolenaar" Comments
117071d4279SBram Moolenaarsyn match mooCommentSpecialChar display ~\\["\\]~ contained transparent contains=NONE
118071d4279SBram Moolenaarsyn match mooComment ~[\t !%&*+,\-/<=>?@^|]\@<!\s*"\([^\"]\|\\.\)*"\s*;~ contains=mooStringError,mooCommentSpecialChar
119071d4279SBram Moolenaar
120071d4279SBram Moolenaar" Non-code
121071d4279SBram Moolenaarsyn region mooNonCode start=~^\s*@\<~ end=~$~
122071d4279SBram Moolenaarsyn match mooNonCode display ~^\.$~
123071d4279SBram Moolenaarsyn match mooNonCode display ~^\s*\d\+:~he=e-1
124071d4279SBram Moolenaar
125071d4279SBram Moolenaar" Overriding matches
126071d4279SBram Moolenaarsyn match mooRangeOperator display ~\.\.~ transparent contains=NONE
127071d4279SBram Moolenaarsyn match mooOrOperator display ~||~ transparent contains=NONE
128071d4279SBram Moolenaarif exists("moo_extended_cstyle_comments")
129071d4279SBram Moolenaar  syn match mooScattering ~[,{]\@<=\s*\%(\%(/\*.\{-}\*/\s*\)*\)\@>?~ transparent contains=mooCStyleComment
130071d4279SBram Moolenaarelse
131071d4279SBram Moolenaar  syn match mooScattering ~[,{]\@<=\s*?~ transparent contains=NONE
132071d4279SBram Moolenaarendif
133071d4279SBram Moolenaar
134071d4279SBram Moolenaar" Clusters
135071d4279SBram Moolenaarsyn cluster mooKeyword contains=mooStatement,mooOperatorIn,mooAny,mooErrorConstant
136071d4279SBram Moolenaarsyn cluster mooStringContents contains=mooStringError,mooStringSpecialChar
137071d4279SBram Moolenaarsyn cluster mooEnclosedContents contains=TOP,mooUnenclosedError,mooComment,mooNonCode
138071d4279SBram Moolenaar
139071d4279SBram Moolenaar" Define the default highlighting.
140071d4279SBram Moolenaarhi def link mooUncommentedError Error
141071d4279SBram Moolenaarhi def link mooCStyleCommentError Error
142071d4279SBram Moolenaarhi def link mooCStyleComment Comment
143071d4279SBram Moolenaarhi def link mooStatement Statement
144071d4279SBram Moolenaarhi def link mooOperatorIn Operator
145071d4279SBram Moolenaarhi def link mooAny Constant " link this to Keyword if you want
146071d4279SBram Moolenaarhi def link mooErrorConstant Constant
147071d4279SBram Moolenaarhi def link mooType Type
148071d4279SBram Moolenaarhi def link mooVariable Type
149071d4279SBram Moolenaarhi def link mooStringError Error
150071d4279SBram Moolenaarhi def link mooStringSpecialChar SpecialChar
151071d4279SBram Moolenaarhi def link mooRegexpOr SpecialChar
152071d4279SBram Moolenaarhi def link mooPronounSub SpecialChar
153071d4279SBram Moolenaarhi def link mooString String
154071d4279SBram Moolenaarhi def link mooNumber Number
155071d4279SBram Moolenaarhi def link mooObject Number
156071d4279SBram Moolenaarhi def link mooBuiltinProperty Type
157071d4279SBram Moolenaarhi def link mooBuiltinFunction Function
158071d4279SBram Moolenaarhi def link mooUnknownBuiltinFunction Error
159071d4279SBram Moolenaarhi def link mooKnownBuiltinFunction Function
160071d4279SBram Moolenaarhi def link mooCorePropOrVerb Identifier
161071d4279SBram Moolenaarhi def link mooUnenclosedError Error
162071d4279SBram Moolenaarhi def link mooParenthesesError Error
163071d4279SBram Moolenaarhi def link mooBracketsError Error
164071d4279SBram Moolenaarhi def link mooBracesError Error
165071d4279SBram Moolenaarhi def link mooQuestionError Error
166071d4279SBram Moolenaarhi def link mooCatchError Error
167071d4279SBram Moolenaarhi def link mooExclamation Exception
168071d4279SBram Moolenaarhi def link mooComment Comment
169071d4279SBram Moolenaarhi def link mooNonCode PreProc
170071d4279SBram Moolenaar
171071d4279SBram Moolenaarlet b:current_syntax = "moo"
172071d4279SBram Moolenaar
173071d4279SBram Moolenaar" vim: ts=8
174