Skip to content

Commit 1d20da9

Browse files
committed
Merge branch 'master' of github.com:KokaKiwi/sublime-rust
Conflicts: Rust.JSON-tmLanguage Rust.tmLanguage
2 parents de8e914 + 3cec19b commit 1d20da9

File tree

2 files changed

+62
-11
lines changed

2 files changed

+62
-11
lines changed

Rust.JSON-tmLanguage

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"foldingStopMarker": "^\\s*\\}",
66
"patterns": [
77
{"name": "variable.other.source.rust",
8-
"match": "'[a-zA-Z_][a-zA-Z0-9_]*[^\\']"
8+
"match": "'[a-zA-Z_][a-zA-Z0-9_]*(?=[^\'])"
99
},
1010
{"name": "string.quoted.single.source.rust",
1111
"begin": "'",
@@ -22,14 +22,15 @@
2222
]
2323
},
2424
{"name": "meta.function.source.rust",
25-
"match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]?)[\\w\\:,+ \\'<>]*\\s*\\(",
25+
"match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]?[\\w\\:,+ \\'<>]*)\\s*(\\()",
2626
"captures": {
2727
"1": {"name": "keyword.source.rust"},
28-
"2": {"name": "entity.name.function.source.rust"}
28+
"2": {"name": "entity.name.function.source.rust"},
29+
"3": {"name": "keyword.operator.rust"}
2930
}
3031
},
3132
{"name": "keyword.source.rust",
32-
"match": "\\b(as|break|claim|const|copy|Copy|crate|do|drop|else|extern|for|if|in|impl|let|loop|match|mod|mut|Owned|priv|pub|pure|ref|return|unsafe|use|while|mod|Send|static|trait|struct|enum|type)\\b"
33+
"match": "\\b(as|break|claim|const|copy|Copy|crate|do|drop|else|extern|for|if|impl|in|let|loop|match|mod|mut|Owned|priv|pub|pure|ref|return|unsafe|use|while|mod|Send|static|trait|struct|enum|type)\\b"
3334
},
3435
{"name": "storage.type.source.rust",
3536
"match": "\\b(Self|m32|m64|m128|f80|f16|f128|int|uint|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|Option|Either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b"
@@ -43,8 +44,17 @@
4344
{"name": "support.constant.source.rust",
4445
"match": "\\b(EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b"
4546
},
46-
{"name": "meta.preprocessor.source.rust",
47-
"match": "\\b(\\w\\(\\w\\)*!)|(#\\[[\\w=\\(\\)_]+\\])\\b"
47+
{"name": "comment.block.preprocessor.rust",
48+
"match": "^(\\w\\(\\w\\)*!)|(#\\[[\\w=\\(\\)_]+\\])$"
49+
},
50+
{"name": "keyword.operator.rust",
51+
"match": "\\{|\\}"
52+
},
53+
{"name": "keyword.operator.rust",
54+
"match": "\\[|\\]"
55+
},
56+
{"name": "keyword.operator.rust",
57+
"match": "\\(|\\)"
4858
},
4959
{"name": "constant.numeric.integer.source.rust",
5060
"match": "\\b(([0-9][0-9_]*)|([0-9][0-9_]*(u|u8|u16|u32|u64))|([0-9][0-9_]*(i|i8|i16|i32|i64)))\\b"
@@ -69,6 +79,12 @@
6979
{"name": "comment.block.source.rust",
7080
"begin": "/\\*",
7181
"end": "\\*/"
82+
},
83+
{"name": "keyword.operator.rust",
84+
"match": "(=>)|(->)|[-:=*,!.+|%/&amp;~@<>;]"
85+
},
86+
{"name": "support.function.rust",
87+
"match": "_"
7288
}
7389
],
7490
"repository": {
@@ -78,4 +94,4 @@
7894
}
7995
},
8096
"uuid": "4339386b-4d67-4f0e-9e78-09ecbcddf71d"
81-
}
97+
}

Rust.tmLanguage

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<array>
1818
<dict>
1919
<key>match</key>
20-
<string>'[a-zA-Z_][a-zA-Z0-9_]*[^\']</string>
20+
<string>'[a-zA-Z_][a-zA-Z0-9_]*(?=[^\'])</string>
2121
<key>name</key>
2222
<string>variable.other.source.rust</string>
2323
</dict>
@@ -64,9 +64,14 @@
6464
<key>name</key>
6565
<string>entity.name.function.source.rust</string>
6666
</dict>
67+
<key>3</key>
68+
<dict>
69+
<key>name</key>
70+
<string>keyword.operator.rust</string>
71+
</dict>
6772
</dict>
6873
<key>match</key>
69-
<string>\b(fn)\s+([a-zA-Z_][a-zA-Z0-9_]?[\w\:,+ \'&lt;&gt;]*)\s*\(</string>
74+
<string>\b(fn)\s+([a-zA-Z_][a-zA-Z0-9_]?[\w\:,+ \'&lt;&gt;]*)\s*(\()</string>
7075
<key>name</key>
7176
<string>meta.function.source.rust</string>
7277
</dict>
@@ -102,9 +107,27 @@
102107
</dict>
103108
<dict>
104109
<key>match</key>
105-
<string>\b(\w\(\w\)*!)|(#\[[\w=\(\)_]+\])\b</string>
110+
<string>^(\w\(\w\)*!)|(#\[[\w=\(,\s\)_]+\])$</string>
111+
<key>name</key>
112+
<string>comment.block.preprocessor.rust</string>
113+
</dict>
114+
<dict>
115+
<key>match</key>
116+
<string>\{|\}</string>
117+
<key>name</key>
118+
<string>keyword.operator.rust</string>
119+
</dict>
120+
<dict>
121+
<key>match</key>
122+
<string>\(|\)</string>
106123
<key>name</key>
107-
<string>meta.preprocessor.source.rust</string>
124+
<string>keyword.operator.rust</string>
125+
</dict>
126+
<dict>
127+
<key>match</key>
128+
<string>\[|\]</string>
129+
<key>name</key>
130+
<string>keyword.operator.rust</string>
108131
</dict>
109132
<dict>
110133
<key>match</key>
@@ -154,6 +177,18 @@
154177
<key>name</key>
155178
<string>comment.block.source.rust</string>
156179
</dict>
180+
<dict>
181+
<key>match</key>
182+
<string>(=&gt;)|(-&gt;)|[-:=*,!.+|%/&amp;~@&lt;&gt;;]</string>
183+
<key>name</key>
184+
<string>keyword.operator.rust</string>
185+
</dict>
186+
<dict>
187+
<key>match</key>
188+
<string>_</string>
189+
<key>name</key>
190+
<string>support.function.rust</string>
191+
</dict>
157192
</array>
158193
<key>repository</key>
159194
<dict>

0 commit comments

Comments
 (0)