@@ -1,10 +1,19 @@
11; Identifier naming conventions
22
3+((identifier) @constant
4+ (#match? @constant "^[A-Z_]*$"))
5+
36((identifier) @constructor
47 (#match? @constructor "^[A-Z]"))
58
6−((identifier) @constant
7− (#match? @constant "^[A-Z][A-Z_]*$"))
9+; Types
10+
11+((identifier) @type
12+ (#match?
13+ @type
14+ "^(bool|bytes|dict|float|frozenset|int|list|set|str|tuple)$"))
15+
16+(type (identifier)) @type
817
918; Builtin functions
1019
@@ -12,7 +21,7 @@
1221 function: (identifier) @function.builtin)
1322 (#match?
1423 @function.builtin
15− "^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
24+ "^(abs|all|any|ascii|bin|breakpoint|bytearray|callable|chr|classmethod|compile|complex|delattr|dir|divmod|enumerate|eval|exec|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip|__import__)$"))
1625
1726; Function calls
1827
@@ -30,7 +39,6 @@
3039
3140(identifier) @variable
3241(attribute attribute: (identifier) @variable.other.member)
33−(type (identifier) @type)
3442
3543; Literals
3644
@@ -81,41 +89,48 @@
8189 ">>"
8290 "|"
8391 "~"
84− "and"
85− "in"
86− "is"
87− "not"
88− "or"
8992] @operator
9093
9194[
9295 "as"
9396 "assert"
94− "async"
9597 "await"
9698 "break"
97− "class"
9899 "continue"
99− "def"
100− "del"
101100 "elif"
102101 "else"
103102 "except"
104− "exec"
105103 "finally"
106104 "for"
107105 "from"
108− "global"
109106 "if"
110107 "import"
111− "lambda"
112− "nonlocal"
113108 "pass"
114− "print"
115109 "raise"
116110 "return"
117111 "try"
118112 "while"
119113 "with"
120114 "yield"
115+] @keyword.control
116+
117+(for_statement "in" @keyword.control)
118+(for_in_clause "in" @keyword.control)
119+
120+[
121+ "and"
122+ "async"
123+ "class"
124+ "def"
125+ "del"
126+ "exec"
127+ "global"
128+ "in"
129+ "is"
130+ "lambda"
131+ "nonlocal"
132+ "not"
133+ "or"
134+ "print"
121135] @keyword
136+