/
mlfi.sublime-syntax
executable file
·166 lines (131 loc) · 5.59 KB
/
mlfi.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
161
162
163
164
165
166
%YAML1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- mf
- mfi
scope: source.mlfi
variables:
alnum: '[A-Za-z_0-9]'
contexts:
main:
- match: '([~?])(\(*)([A-Za-z0-9_]+)'
captures:
1: keyword.operator.mlfi
3: variable.parameter.mlfi
- match: '\b(Some|None)\b'
scope: support.function.mlfi
- match: '(`[A-Z][A-Za-z0-9_\'']*)'
scope: entity.name.function.mlfi
- match: '\b(?<=module)\s+([A-Z][A-Za-z0-9_'']+)\s*(?=[\(:=])'
captures:
1: entity.name.type.mlfi
- match: '\b([tpc][A-Z][A-Za-z0-9_'']*)\b(?=:)'
scope: support.class.mlfi
- match: '\b(assert|open|include)\b'
scope: storage.modifier.mlfi
- match: '\b(?<=val|method)\s+([A-Za-z0-9_]+)\s*:'
captures:
1: entity.name.function.mlfi
- match: '\b(?<=type|exception)\s+(\(*''[A-Za-z0-9_,]+\)*\s*)*([A-Za-z0-9_]+)\b'
captures:
2: entity.name.type.mlfi
- match: '(?<=^|[=|])\s*([A-Z][A-Za-z0-9_]*)(?=\s*(of|:|\||$|\(\*))'
captures:
1: entity.name.function.mlfi
- match: '\b([A-Z][A-Za-z0-9_\'']*)\b'
scope: support.class.mlfi
- match: (let)\s*(open)(?=\b)
captures:
1: keyword.other.mlfi
2: storage.modifier.mlfi
- match: '\b(?<=(let|and))(\s+(rec))?\s+\(*([A-Z.a-z0-9_]+)\b'
push: function_defition
captures:
3: keyword.other.mlfi
4: entity.name.function.mlfi
- match: '\b(value_and_text|tag|sink|simulation|value_row|value_ext|comparer|value_and_caption|const|value|composite|trigger|button_trigger|defer_trigger|final_trigger|non_trigger|init_trigger|clean_trigger|build_trigger|save_trigger|import_context|grid_append|grid_append_count|grid_columns|grid_idx_columns|enabled|readonly|protected|composite_readonly|composite_protected|tooltip|decimals|value_text|caption_text|column_enabled|column_readonly|column_decimals|column_caption_text|restrict|constructor|is_constructor|branch|interval|restrict_compare|exclude|restrict_exclude|subpath|subpath_ext|none|seq_unit|seq_units|join_unit|fail|empty|update|update_m|validate|validate_m|init|init_m|default|subpath|subpath_fst|subpath_snd|extract|grid_add_init_m|grid_add_init|grid_add_init_multiple|grid|grid_ext|weak_update|weak_update_m|button_enabled|button|button_m|button_by_name|button_by_name_m|all|conditional|copy|same|equalize|virt_pack_cast|with_virtual_field|variant|variant_ext|on_save|copy_value|update_default_m|update_default|tuple[0-9]*)\b'
scope: entity.name.tag.mlfi
- match: \'(.?|\\.)\'
captures:
1: constant.character.mlfi
# Strings begin and end with quotes, and use backslashes as an escape
# character
- match: '"'
scope: punctuation.definition.string.begin.mlfi
push: double_quoted_string
- match: '\{([A-Za-z_]*)\|'
scope: punctuation.definition.string.begin.mlfi
push: heredoc
# Comments begin with a '(*' and finish at '*)'
- match: '\(\*'
scope: punctuation.definition.comment.mlfi
push: block_comment
# Record type
- match: '\{'
push: records
- match: '\b(a(nd|s)|c(onstraint|lass)|ex(ception|ternal)|fun(ct(ion|or))?|in(herit)?|let|m(ethod|utable|odule)|not|of|p(arser|rivate)|rec|type|v(al|irtual)|raise)\b'
scope: keyword.other.mlfi
- match: '\b(set|list|option)\b'
scope: keyword.other.mlfi
- match: '\b(int|string|ttype|ttype_of|unit|bool|decimal|date)\b'
scope: keyword.other.mlfi
# Keywords are if, else for and while.
# Note that blackslashes don't need to be escaped within single quoted
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- match: '\b(if|else|for|while|object|struct|sig|begin|end)\b'
scope: keyword.control.mlfi
- match: '\b(do(ne|wnto)?|else|for|i(f|gnore)|lazy|match|new|or|t(hen|o|ry)|w(h(en|ile)|ith))\b'
scope: keyword.control.mlfi
# Numbers
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.mlfi
- match: '\b<|>|<>|\+|-|\*|/|%|<=|>=|==|=|!=|&&|\|\||\^|>>|<<|&|\||::|:=|\|>|:|:-|@|!|\\|->|=>\b'
scope: keyword.operator.mlfi
- match: '\b(true|false)\b'
scope: constant.language.mlfi
- match: '\b(return(f|)|bind|lift_Cs|lift_cache_based_Cs|mapM|database_handle|cache|abort|liftM(f|))\b'
scope: support.function.mlfi
double_quoted_string:
- meta_scope: string.quoted.double.mlfi
- match: '\\.'
scope: constant.character.escape.mlfi
- match: '"'
scope: punctuation.definition.string.end.mlfi
pop: true
heredoc:
- meta_scope: string.unquoted.heredoc.mlfi
- match: \|\1\}
scope: punctuation.definition.string.end.mlfi
pop: true
block_comment:
- meta_scope: comment.line.mlfi
- match: '\*\)'
pop: true
- match: '\(\*'
scope: punctuation.definition.comment.mlfi
push: block_comment
function_defition:
# - meta_scope: markup.bold.mlfi
- match: ',\s*([A-Za-z0-9_]+)\b'
captures:
1: entity.name.function.mlfi
- match: \s
pop: true
records:
- match: \}
pop: true
- match: '\s*([A-Za-z0-9_]+)\s*(?=:)'
captures:
1: entity.name.function.mlfi
- include: main
# parameters:
# - match: '\b=\b'
# scope: keyword.operator.mlfi
# pop: true
# - match: \bin\b
# scope: keyword.control.mlfi
# pop: true
# - include: main