|
1 | 1 | ; highlights.scm |
2 | 2 |
|
3 | | - |
4 | 3 | ; Literals |
5 | 4 |
|
6 | 5 | (integer) @number |
7 | | - |
8 | | -(float) @float |
9 | | - |
| 6 | +(float) @number |
10 | 7 | (complex) @number |
11 | 8 |
|
12 | 9 | (string) @string |
13 | | -(string (escape_sequence) @string.escape) |
14 | | - |
15 | | -(comment) @comment |
| 10 | +(string (string_content (escape_sequence) @string.escape)) |
16 | 11 |
|
17 | | -;; tune for tree-sitter-langs as it make all as variable |
18 | | -;; (identifier) @variable |
19 | | -(left_assignment name: (identifier) @variable) |
20 | | -(equals_assignment name: (identifier) @variable) |
21 | | -(right_assignment name: (identifier) @variable) |
| 12 | +; Comments |
22 | 13 |
|
23 | | -(formal_parameters (identifier) @parameter) |
24 | | -(formal_parameters (default_parameter (identifier) @parameter)) |
| 14 | +(comment) @comment |
25 | 15 |
|
26 | 16 | ; Operators |
27 | | -[ |
28 | | - "=" |
29 | | - "<-" |
30 | | - "<<-" |
31 | | - "->>" |
32 | | - "->" |
33 | | -] @operator |
34 | | - |
35 | | -(unary operator: [ |
36 | | - "-" |
37 | | - "+" |
38 | | - "!" |
39 | | - "~" |
40 | | -] @operator) |
41 | | - |
42 | | -(binary operator: [ |
43 | | - "-" |
44 | | - "+" |
45 | | - "*" |
46 | | - "/" |
47 | | - "^" |
48 | | - "<" |
49 | | - ">" |
50 | | - "<=" |
51 | | - ">=" |
52 | | - "==" |
53 | | - "!=" |
54 | | - "||" |
55 | | - "|" |
56 | | - "&&" |
57 | | - "&" |
58 | | - ":" |
59 | | - "~" |
60 | | -] @operator) |
61 | 17 |
|
62 | 18 | [ |
63 | | - "|>" |
64 | | - (special) |
| 19 | + "?" ":=" "=" "<-" "<<-" "->" "->>" |
| 20 | + "~" "|>" "||" "|" "&&" "&" |
| 21 | + "<" "<=" ">" ">=" "==" "!=" |
| 22 | + "+" "-" "*" "/" "::" ":::" |
| 23 | + "**" "^" "$" "@" ":" |
| 24 | + "special" |
65 | 25 | ] @operator |
66 | 26 |
|
67 | | -(lambda_function "\\" @operator) |
| 27 | +; Punctuation |
68 | 28 |
|
69 | 29 | [ |
70 | | - "(" |
71 | | - ")" |
72 | | - "[" |
73 | | - "]" |
74 | | - "{" |
75 | | - "}" |
| 30 | + "(" ")" |
| 31 | + "{" "}" |
| 32 | + "[" "]" |
| 33 | + "[[" "]]" |
76 | 34 | ] @punctuation.bracket |
77 | 35 |
|
78 | | -(dollar "$" @operator) |
| 36 | +(comma) @punctuation.delimiter |
79 | 37 |
|
80 | | -(subset2 |
81 | | - [ |
82 | | - "[[" |
83 | | - "]]" |
84 | | - ] @punctuation.bracket) |
| 38 | +; Variables |
85 | 39 |
|
86 | | -[ |
87 | | - "in" |
88 | | - (dots) |
89 | | - (break) |
90 | | - (next) |
91 | | - (inf) |
92 | | -] @keyword |
| 40 | +(identifier) @variable |
| 41 | + |
| 42 | +; Functions |
| 43 | + |
| 44 | +(binary_operator |
| 45 | + lhs: (identifier) @function |
| 46 | + operator: "<-" |
| 47 | + rhs: (function_definition) |
| 48 | +) |
| 49 | + |
| 50 | +(binary_operator |
| 51 | + lhs: (identifier) @function |
| 52 | + operator: "=" |
| 53 | + rhs: (function_definition) |
| 54 | +) |
| 55 | + |
| 56 | +; Calls |
| 57 | + |
| 58 | +(call function: (identifier) @function) |
| 59 | + |
| 60 | +; Parameters |
| 61 | + |
| 62 | +(parameters (parameter name: (identifier) @variable.parameter)) |
| 63 | +(arguments (argument name: (identifier) @variable.parameter)) |
| 64 | + |
| 65 | +; Namespace |
| 66 | + |
| 67 | +(namespace_operator lhs: (identifier) @namespace) |
| 68 | + |
| 69 | +(call |
| 70 | + function: (namespace_operator rhs: (identifier) @function) |
| 71 | +) |
| 72 | + |
| 73 | +; Keywords |
| 74 | + |
| 75 | +(function_definition name: "function" @keyword.function) |
| 76 | +(function_definition name: "\\" @operator) |
93 | 77 |
|
94 | 78 | [ |
95 | | - (nan) |
96 | | - (na) |
97 | | - (null) |
98 | | -] @type.builtin |
| 79 | + "in" |
| 80 | + (return) |
| 81 | + (next) |
| 82 | + (break) |
| 83 | +] @keyword |
99 | 84 |
|
100 | 85 | [ |
101 | 86 | "if" |
102 | 87 | "else" |
103 | | - "switch" |
104 | 88 | ] @conditional |
105 | 89 |
|
106 | 90 | [ |
|
114 | 98 | (false) |
115 | 99 | ] @boolean |
116 | 100 |
|
117 | | -"function" @keyword.function |
118 | | - |
119 | | -(call function: (identifier) @function) |
120 | | -(default_argument name: (identifier) @parameter) |
121 | | - |
122 | | - |
123 | | -(namespace_get function: (identifier) @method) |
124 | | -(namespace_get_internal function: (identifier) @method) |
125 | | - |
126 | | -(namespace_get namespace: (identifier) @namespace |
127 | | - "::" @operator) |
128 | | -(namespace_get_internal namespace: (identifier) @namespace |
129 | | - ":::" @operator) |
| 101 | +[ |
| 102 | + (null) |
| 103 | + (inf) |
| 104 | + (nan) |
| 105 | + (na) |
| 106 | + (dots) |
| 107 | + (dot_dot_i) |
| 108 | +] @constant.builtin |
130 | 109 |
|
131 | 110 | ; Error |
| 111 | + |
132 | 112 | (ERROR) @error |
0 commit comments