| 674 | static bool any_field_contains_node(TSNode parent, const char *field, TSNode node); |
| 675 | |
| 676 | static bool is_tlaplus_binding(TSNode node) { |
| 677 | for (TSNode parent = ts_node_parent(node); !ts_node_is_null(parent); |
| 678 | parent = ts_node_parent(parent)) { |
| 679 | const char *kind = ts_node_type(parent); |
| 680 | if (strcmp(kind, "operator_definition") == 0) { |
| 681 | /* `name:` is the callable declaration, while every repeated |
| 682 | * `parameter:` field is a function-wide lexical binder. */ |
| 683 | return any_field_contains_node(parent, "parameter", node); |
| 684 | } |
| 685 | if (strcmp(kind, "function_definition") == 0) { |
| 686 | /* `F[x \in S] == ...`: only quantifier_bound.intro binds. The set |
| 687 | * expression S remains an ordinary identifier_ref usage. */ |
| 688 | for (TSNode bound = ts_node_parent(node); |
| 689 | !ts_node_is_null(bound) && !ts_node_eq(bound, parent); |
| 690 | bound = ts_node_parent(bound)) { |
| 691 | if (strcmp(ts_node_type(bound), "quantifier_bound") == 0) { |
| 692 | return any_field_contains_node(bound, "intro", node); |
| 693 | } |
| 694 | } |
| 695 | return false; |
| 696 | } |
| 697 | if (strcmp(kind, "bounded_quantification") == 0) { |
| 698 | for (TSNode bound = ts_node_parent(node); |
| 699 | !ts_node_is_null(bound) && !ts_node_eq(bound, parent); |
| 700 | bound = ts_node_parent(bound)) { |
| 701 | if (strcmp(ts_node_type(bound), "quantifier_bound") == 0) { |
| 702 | return any_field_contains_node(bound, "intro", node); |
| 703 | } |
| 704 | } |
| 705 | return false; |
| 706 | } |
| 707 | if (strcmp(kind, "unbounded_quantification") == 0) { |
| 708 | return any_field_contains_node(parent, "intro", node); |
| 709 | } |
| 710 | } |
| 711 | return false; |
| 712 | } |
| 713 | |
| 714 | static bool is_cobol_move_destination(TSNode node) { |
| 715 | for (TSNode parent = ts_node_parent(node); !ts_node_is_null(parent); |
no test coverage detected