mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 11:15:24 +03:00
[language-c] Scope identifiers as types when they are unambiguously so
Anything that is one of the reserved type words in C must be a type in all contexts. And any identifier that ends in `_t` is, by strong convention, a type.
This commit is contained in:
parent
9954068f8f
commit
ebf5333022
@ -46,6 +46,16 @@
|
||||
(primitive_type) @storage.type.builtin.c
|
||||
(type_identifier) @storage.type.other.c
|
||||
|
||||
; These types are all reserved words; if we see an identifier with this name,
|
||||
; it must be a type.
|
||||
((identifier) @storage.type.builtin.c
|
||||
(#match? @storage.type.builtin.c "^(char|int|float|double|long)$"))
|
||||
|
||||
; Assume any identifier that ends in `_t` is a type. This convention is not
|
||||
; always followed, but it's a very strong indicator when it's present.
|
||||
((identifier) @storage.type.other.c
|
||||
(#match? @storage.type.other.c "_t$"))
|
||||
|
||||
[
|
||||
"enum"
|
||||
"long"
|
||||
|
@ -58,6 +58,17 @@
|
||||
(type_identifier) @storage.type.other.cpp
|
||||
; (struct_specifier) @storage.type.cpp
|
||||
|
||||
; These types are all reserved words; if we see an identifier with this name,
|
||||
; it must be a type.
|
||||
((identifier) @storage.type.builtin.cpp
|
||||
(#match? @storage.type.builtin.cpp "^(char|int|float|double|long)$"))
|
||||
|
||||
; Assume any identifier that ends in `_t` is a type. This convention is not
|
||||
; always followed, but it's a very strong indicator when it's present.
|
||||
((identifier) @storage.type.other.cpp
|
||||
(#match? @storage.type.other.cpp "_t$"))
|
||||
|
||||
|
||||
[
|
||||
"enum"
|
||||
"long"
|
||||
|
Loading…
Reference in New Issue
Block a user