on master help sign in
Introduce storage_class highlight scope (#2731)
commit7983c71752e2443266ecc65581f3a980696cc294 authorAnton Romanov <theli.ua@gmail.com> dateTue 14 Jun 2022, 10:35 (4 years ago) parentcdeab33
3 files changed+15−8
book/src/themes.md+1 runtime/queries/c/highlights.scm+2−2 runtime/queries/rust/highlights.scm+12−6
book/src/themes.md+1
@@ -151,6 +151,7 @@ We use a similar set of scopes as
151151 - `operator` - `or`, `in`
152152 - `directive` - Preprocessor directives (`#if` in C)
153153 - `function` - `fn`, `func`
154+ - `storage` - Keywords that affect the storage of a variable, function or data structure `static`, `mut`, `const`, `ref`
154155
155156- `operator` - `||`, `+=`, `>`
156157
runtime/queries/c/highlights.scm+2−2
@@ -1,8 +1,9 @@
1+(storage_class_specifier) @keyword.storage
2+
13"goto" @keyword
24"register" @keyword
35"break" @keyword
46"case" @keyword
5−"const" @keyword
67"continue" @keyword
78"default" @keyword
89"do" @keyword
@@ -14,7 +15,6 @@
1415"inline" @keyword
1516"return" @keyword
1617"sizeof" @keyword
17−"static" @keyword
1818"struct" @keyword
1919"switch" @keyword
2020"typedef" @keyword
runtime/queries/rust/highlights.scm+12−6
@@ -156,16 +156,22 @@
156156 "macro_rules!"
157157
158158 "let"
159− "ref"
160− "move"
161159
162− "dyn"
163− "static"
164− "const"
165160 "async"
166161] @keyword
167162
168−(mutable_specifier) @keyword.mut
163+(mutable_specifier) @keyword.storage.modifier.mut
164+
165+(reference_type "&" @keyword.storage.modifier.ref)
166+(self_parameter "&" @keyword.storage.modifier.ref)
167+
168+[
169+ "static"
170+ "const"
171+ "ref"
172+ "move"
173+ "dyn"
174+] @keyword.storage.modifier
169175
170176; TODO: variable.mut to highlight mutable identifiers via locals.scm
171177