Count expression- and literal-class counters for one node. */
| 166 | |
| 167 | /* Count expression- and literal-class counters for one node. */ |
| 168 | static void accumulate_expressions(const char *kind, cbm_ast_profile_t *out) { |
| 169 | if (is_comparison(kind)) { |
| 170 | out->comparison_ops++; |
| 171 | } |
| 172 | if (is_arithmetic(kind)) { |
| 173 | out->arithmetic_ops++; |
| 174 | } |
| 175 | if (strcmp(kind, "not_operator") == 0 || strcmp(kind, "boolean_operator") == 0) { |
| 176 | out->logical_ops++; |
| 177 | } |
| 178 | if (is_assignment(kind)) { |
| 179 | out->assignment_count++; |
| 180 | out->variable_reassigns++; |
| 181 | } |
| 182 | if (is_string_lit(kind)) { |
| 183 | out->string_literals++; |
| 184 | } |
| 185 | if (is_number_lit(kind)) { |
| 186 | out->number_literals++; |
| 187 | } |
| 188 | if (is_bool_lit(kind)) { |
| 189 | out->bool_literals++; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /* Accumulate Halstead operator/operand counts. Leaf identifiers, literals, |
| 194 | * and booleans are "operands"; recognized statement/expression kinds are |
no test coverage detected