-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmuf.sublime-syntax
160 lines (155 loc) · 10.9 KB
/
muf.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
%YAML 1.2
name: MUF
file-extensions: [muf]
scope: source.muf
variables:
prims3: '(?i)time|systime|timestamps|timesplit|timefmt|date|gmtoffset|systime_precise|atoi|dbref|int|intostr|ctoi|itoc|stod|dtos|float|strtof|ftostr|itoh|htoi|ftostrc|notify|notify_exclude|notify_except|ansi_notify|ansi_notify_exclude|ansi_notify_except|notify_html|notify_html_exclude|notify_html_except|notify_html_nocr|notify_html_exclude_nocr|html_nocr_except|notify_descriptor|array_notify|descrflush|stopmidi|playmidi|commandtext|array_ansi_notify|array_notify_html|ansi_notify_descriptor|notify_descriptor_char|explode_array'
prims2: '(?i)addprop|getprop|setprop|envprop|remove_prop|getpropstr|getpropval|getpropfval|envpropstr|nextprop|desc|idesc|htmldesc|ihtmldesc|propdir\?|setdesc|setsucc|setfail|setdrop|setosucc|setofail|setodrop|succ|fail|drop|osucc|ofail|odrop|getlockstr|ansidesc|setansidesc|iansidesc|setiansidesc|reflist_add|reflist_find|reflist_del|copyprops|exit|call|execute|read|public|sleep|pid|ispid\?|kill|queue|fork|interp|caller|abort|case|trig|prog|parsempi|parseprop|cancall\?|compiled\?|tread|propqueue|envpropqueue|instances|magecall|wizcall|archcall|boycall|getpidinfo|getpids|jmp|enqueue|parsepropex|debug_on|debug_off|debug_line|selfcall|debugger_break|read_wants_blanks|get_read_wants_blanks|read_wants_blanks_toggle|read_wants_blanks_on|read_wants_blanks_off|\?dup|dup|dupn|ldup|over|pop|rot|rotate|sort|swap|depth|number\?|dbref\?|int\?|string\?|address\?|socket\?|lock\?|float\?|variable\?|array\?|mark|}|checkargs|reverse|lreverse|popn|pick|put|descr\?|sql\?|mark\?|nip|tuck'
prims1: '(?i)var|variable|variable\?|lvar|localvar|me|trigger|command|descr|var\!|preempt|foreground|background|mode|setmode|pr_mode|fg_mode|bg_mode|sleep|event_wait|event_send|event_count|event_exists|timer_start|timer_stop|event_waitfor|watchpid|onevent|interrupt_level|random|bitor|bitxor|bitshift|ceil|floor|sqrt|pi|round|sin|cos|tan|asin|acos|atan|atan2|dist3d|xyz_to_polar|polar_to_xyz|exp|log|log10|fabs|pow|frand|fmod|modf|and|or|not|abs|srand|getseed|setseed|sign|xor|inf|epsilon'
oper: '\+|\-|\*|/|%|<|>|=|\!=|<=|>=|\^|\@|(?<!var)\!|\+\+|\-\-'
primsrest: '\*\->\[\]|\*\[\]<\-|\*\[\^\]|\*\[x\]|\->\[\]|\[\.\.\]|\[\]|\[\]<\-|\[\^\]|\[x\]|addpennies|ansi_midstr|ansi_midstr|ansi_name|ansi_name|ansi_notify|ansi_notify_descriptor|ansi_notify_except|ansi_notify_exclude|ansi_strcut|ansi_strcut|ansi_strip|ansi_strip|ansi_strlen|ansi_strlen|ansi_unparseobj|ansi_unparseobj|armageddon|array\?|array_ansi_notify|array_ansi_notify|array_appenditem|array_compare|array_count|array_cut|array_delitem|array_delrange|array_diff|array_excludeval|array_explode|array_extract|array_filter_flags|array_filter_prop|array_filter_smart|array_findval|array_first|array_fmtstrings|array_get_ignores|array_get_propdirs|array_get_proplist|array_get_propvals|array_get_reflist|array_getitem|array_getlinks|array_getrange|array_insertitem|array_insertrange|array_interpret|array_intersect|array_join|array_join|array_keys|array_last|array_make|array_make_dict|array_matchkey|array_matchval|array_ndiff|array_nested_del|array_nested_get|array_nested_set|array_next|array_nintersect|array_notify|array_notify_html|array_nunion|array_prev|array_put_proplist|array_put_propvals|array_put_reflist|array_regfilter_prop|array_regmatchkey|array_regmatchval|array_regsub|array_reverse|array_setitem|array_setrange|array_sort|array_sort_indexed|array_string_fragment|array_sum|array_union|array_vals|awake\?|bandwidth|bappend|base64decode|base64encode|bread|bwrite|checkpassword|compile|conboot|concount|condbref|condescr|conhost|conidle|conipnum|connotify|conport|contents|contents_array|contents_array|contime|controls|conuser|copyobj|copyplayer|curid|dbcmp|dbtop|delta|descr|descr\?|descr_array|descr_flag\?|descr_html\?|descr_logout|descr_pueblo\?|descr_set|descr_setuser|descr_welcome_user|descrboot|descrbufsize|descrcon|descrconport|descrdbref|descrflush|descrhost|descridle|descripnum|descriptors|descrleastidle|descrmostidle|descrport|descrtime|descruser|dictionary\?|dump|entrances_array|entrances_array|escape_ansi|escape_ansi|escape_url|event|exit\?|exits|exits_array|exits_array|explode|fappend|fcr|find_array|find_array|findnext|firstdescr|flag\?|flag_2char|flag_2char|fmtstring|fmtstringex|force|force_level|fpublish|fread|freadn|freadto|fren|frm|fsinfo|fsize|fstats|fwrite|get_macros_array|get_sockinfo|getdescrinfo|getdescrinfo|getdir|getlink|getlinks|getlinks_array|getlockstr|getobjinfo|getobjinfo|gui_available|gui_ctrl_command|gui_ctrl_create|gui_dlog_close|gui_dlog_create|gui_dlog_show|gui_value_get|gui_values_get|gui_values_set|httpdata|ignore_add|ignore_del|ignoring\?|insert_macro|instr|instring|isflag\?|islocked\?|ispower\?|kill_macro|lastdescr|location|lock\?|locked\?|logstatus|lsock6open|lsockopen|match|max_ignores|mcp_bind|mcp_register|mcp_register|mcp_send|mcp_supports|md5hash|midstr|mkdir|mlevel|motd_notify|movepennies|moveto|name|name\-ok\?|name\-ok\?|nbsock6open|nbsockopen|newexit|newobject|newpassword|newplayer|newprogram|newroom|next|next_flag|nextdescr|nextentrance|nextexit|nextowned|nextowned_flag|nextplayer|nextplayer_flag|nextplayer_power|nextprogram|nextroom|nextthing|nextthing_flag|objmem|ok\?|online|online_array|owner|parse_ansi|parse_ansi|parse_neon|parselock|part_pmatch|pennies|player\?|pmatch|pname\-ok\?|pname\-ok\?|power\?|power_2char|power_2char|prettylock|program\?|program_deletelines|program_getlines|program_insertlines|program_linecount|pronoun_sub|recycle|refstamps|regexp|regfind_array|regfind_array|regfindnext|regmatch|regsub|restart|rinstr|rinstring|rmatch|rmdir|room\?|rsplit|set|set_sockopt|setlink|setlockstr|setname|setown|setpassword|setsysparm|sha1hash|shutdown|smatch|sock6open|sockaccept|sockcheck|sockclose|socket_setuser|sockopen|sockrecv|socksecure|socksend|sockshutdown|socktodescr|sockunsecure|split|sql\?|sqlclose|sqlconnect|sqlping|sqlquery|ssl_sockaccept|stats|strcat|strcmp|strcut|strdecrypt|strencrypt|stringcmp|stringpfx|strip|striplead|stripspaces|striptail|strlen|strncmp|subst|suid|sysparm|sysparm_array|testlock|textattr|thing\?|timestamps|toadplayer|tokensplit|tolower|touch|toupper|udp6send|udpclose|udpopen|udpsend|uncompile|unescape_url|unparse_ansi|unparse_ansi|unparselock|unparseobj|use|version|\}array|\}cat|\}dict|\}join|\}list|\}tell'
boundary: "[ \t\n\r\t\\':]"
boundarybefore: '(?<={{boundary}})'
boundaryafter: '(?={{boundary}})'
contexts:
prototype:
- include: comment
- include: constants
pre-processor:
- match: '\$def'
scope: keyword.preprocessor.muf
push:
- include: expression
- match: '\n'
pop: true
- match: '(?i)\$(include|author|version|lib-version|define|enddef|undef|libdef|else|ifdef|endif)'
scope: keyword.preprocessor.muf
main:
- include: pre-processor
- match: '(?i)\b(public)\b ([a-zA-Z0-9_-]+)'
captures:
1: storage.modifier.muf
2: entity.name.function.muf
- match: ':'
scope: keyword.operator.muf punctuation.definition.generic.begin.muf
push: procedure-name
comment:
- match: '\('
scope: punctuation.comment.begin.muf
push:
- meta_scope: comment.block.muf
- include : comment
- match: '\)'
scope: punctuation.comment.end.muf
pop: true
procedure-name:
- match: '\b([a-zA-Z0-9\-\?_]*)(?=\[)'
captures:
1: entity.name.function.muf
2: punctuation.section.brackets.begin.muf
set:
- meta_scope: meta.function.parameters.muf
- match: '\b([a-zA-Z][a-zA-Z0-9]*):([a-zA-Z-][a-zA-Z0-9_-]*)\b'
captures:
1: storage.type.muf
2: variable.parameter.muf
- match: '\]'
scope: punctuation.section.brackets.end.muf
set: procedure-body
- match: '(?<=\s)([a-zA-Z][a-zA-Z0-9\_\-]*)(?=\s)'
scope: entity.name.function.muf
set: procedure-body
control-keywords:
- match: '(?i)\bif\b'
scope: keyword.control.conditional.muf punctuation.definition.generic.begin.muf
push:
- meta_scope: meta.block.muf
- include: expression
- match: '\belse\b'
scope: keyword.control.conditional.muf
- match: '\bthen\b'
scope: keyword.control.conditional.muf punctuation.definition.generic.end.muf
pop: true
- match: '(?i)\b(begin|for(?:each)?)\b'
scope: keyword.control.muf
push:
- meta_scope: meta.block.muf
- include: expression
- match: (?i)\b(until|repeat)\b
scope: keyword.control.muf
pop: true
- match: '(?i)\b(while|break|continue)\b'
scope: keyword.control.muf
- match: '(?i)\b(try)\b'
scope: keyword.control.muf
push:
- meta_scope: meta.block.muf
- include: expression
- match: '(?i)\b(catch|catch_detailed)\b'
scope: keyword.control.muf
set:
- include: expression
- match: '(?i)\bendcatch\b'
scope: keyword.control.muf
pop: true
- match: '(?i)\bcase\b'
scope: keyword.control.muf
push:
- meta_scope: meta.block.muf
- include: expression
- match: '(?i){{boundarybefore}}(when|default)\b'
scope: keyword.control.muf punctuation.section.block.begin.muf
push:
- meta_scope: meta.block.muf
- include: expression
- match: '(?i){{boundarybefore}}(end)\b'
scope: keyword.control.muf punctuation.section.block.end.muf
pop: true
- match: '(?i)\bendcase\b'
scope: keyword.control.muf punctuation.section.block.end.muf
pop: true
constants:
- match: '#\-?[0-9]+'
scope: constant.other.numeric.muf constant.other.placeholder.dbref.muf
- match: '(?<=\s)\-?[0-9]+(?:\.[0-9]*)?(?=\s)'
scope: constant.numeric.muf
# - match: '\b[a-zA-Z_][a-zA-Z0-9]+\b'
# scope: constant.other.placeholder.muf
- match: '"'
scope: punctuation.definition.string.begin.muf
push:
- meta_scope: string.quoted.double.muf
- meta_include_prototype: false
- match: '\\.'
scope: constant.character.escape.muf
- match: '"'
scope: punctuation.definition.string.end.muf
pop: true
operator:
- match: '(?i)(?<=\s)({{oper}})(?=\s)'
scope: keyword.muf
support:
- match: '(?i)(?<=\s)((?i){{prims1}}|{{prims2}}|{{prims3}}|{{primsrest}})(?=\s)'
scope: support.function.muf
builtin-var:
- match: '(?i)(?<=\s)(me|loc|command|prog)(?=\s)'
scope: variable.language.muf
variable-def:
- match: '(?i)(?<=\s)(var\!?)\s+([a-zA-Z0-9_-]+)(?=\s)'
captures:
1: storage.muf
2: variable.other.muf
expression:
- include: pre-processor
- include: operator
- include: control-keywords
- include: constants
- include: variable-def
- include: support
- include: builtin-var
procedure-body:
- meta_scope: meta.function.muf meta.block.muf
- include: expression
- match: \;
scope: punctuation.section.generic.end.muf
pop: true