Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | NodeChildIterator |
Definition at line 44 of file node.c.
Referenced by ts_node__is_relevant(), ts_node_is_named(), ts_node_symbol(), and ts_node_type().
|
inlinestatic |
Definition at line 136 of file node.c.
References ts_node__is_relevant(), ts_node__null(), ts_node__relevant_child_count(), ts_node_child_iterator_next(), and ts_node_iterate_children().
Referenced by ts_node_child(), and ts_node_named_child().
|
inlinestatic |
Definition at line 326 of file node.c.
References ts_node__is_relevant(), ts_node_child_iterator_next(), ts_node_iterate_children(), and ts_node_start_byte().
Referenced by ts_node_descendant_for_byte_range(), and ts_node_named_descendant_for_byte_range().
|
inlinestatic |
Definition at line 365 of file node.c.
References point_lt(), point_lte(), ts_node__is_relevant(), ts_node_child_iterator_next(), ts_node_iterate_children(), and ts_node_start_point().
Referenced by ts_node_descendant_for_point_range(), and ts_node_named_descendant_for_point_range().
|
inlinestatic |
Definition at line 297 of file node.c.
References ts_node__is_relevant(), ts_node__null(), ts_node_child_count(), ts_node_child_iterator_next(), ts_node_end_byte(), and ts_node_iterate_children().
Referenced by ts_node_first_child_for_byte(), and ts_node_first_named_child_for_byte().
Definition at line 106 of file node.c.
References TSSymbolMetadata::named, ts_language_symbol_metadata(), ts_node__alias(), ts_node__subtree(), ts_subtree_named(), and ts_subtree_visible().
Referenced by ts_node__child(), ts_node__descendant_for_byte_range(), ts_node__descendant_for_point_range(), ts_node__first_child_for_byte(), ts_node__next_sibling(), ts_node__prev_sibling(), ts_node_child_by_field_id(), and ts_node_parent().
Definition at line 246 of file node.c.
References ts_node__is_relevant(), ts_node__null(), ts_node__relevant_child_count(), ts_node__subtree(), ts_node_child_iterator_next(), ts_node_end_byte(), ts_node_is_null(), ts_node_iterate_children(), ts_node_parent(), and ts_node_start_byte().
Referenced by ts_node_next_named_sibling(), and ts_node_next_sibling().
|
inlinestatic |
Definition at line 30 of file node.c.
References length_zero(), NULL, and ts_node_new().
Referenced by ts_node__child(), ts_node__first_child_for_byte(), ts_node__next_sibling(), ts_node__prev_sibling(), ts_node_child_by_field_id(), and ts_node_parent().
Definition at line 187 of file node.c.
References TSNode::id, ts_node__is_relevant(), ts_node__null(), ts_node__relevant_child_count(), ts_node__subtree(), ts_node_child_iterator_next(), ts_node_end_byte(), ts_node_is_null(), ts_node_iterate_children(), ts_node_parent(), ts_subtree_has_trailing_empty_descendant(), and ts_subtree_total_bytes().
Referenced by ts_node_prev_named_sibling(), and ts_node_prev_sibling().
Definition at line 120 of file node.c.
References SubtreeHeapData::named_child_count, Subtree::ptr, ts_node__subtree(), ts_subtree_child_count(), and SubtreeHeapData::visible_child_count.
Referenced by ts_node__child(), ts_node__next_sibling(), and ts_node__prev_sibling().
Definition at line 48 of file node.c.
Referenced by ts_node__is_relevant(), ts_node__next_sibling(), ts_node__prev_sibling(), ts_node__relevant_child_count(), ts_node_child_by_field_id(), ts_node_child_count(), ts_node_end_byte(), ts_node_end_point(), ts_node_field_name_for_child(), ts_node_has_changes(), ts_node_has_error(), ts_node_is_extra(), ts_node_is_missing(), ts_node_is_named(), ts_node_iterate_children(), ts_node_named_child_count(), ts_node_string(), ts_node_symbol(), and ts_node_type().
Get the node's child at the given index, where zero represents the first child.
Definition at line 492 of file node.c.
References ts_node__child().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), handle_cmd_substitution_arg(), ts_node_child_by_field_id(), and ts_node_child_wasm().
Get the node's child with the given numerical field id.
You can convert a field name to an id using the ts_language_field_id_for_name
function.
Definition at line 500 of file node.c.
References field_id, TSFieldMapEntry::field_id, TSNode::id, TSFieldMapEntry::inherited, ts_language_field_map(), ts_node__is_relevant(), ts_node__null(), ts_node__subtree(), ts_node_child(), ts_node_child_by_field_id(), ts_node_child_count(), ts_node_child_iterator_next(), ts_node_iterate_children(), and ts_subtree_extra().
Referenced by ts_node_child_by_field_id(), ts_node_child_by_field_id_wasm(), ts_node_child_by_field_name(), and ts_query_cursor__advance().
TSNode ts_node_child_by_field_name | ( | TSNode | self, |
const char * | field_name, | ||
uint32_t | field_name_length | ||
) |
Get the node's child with the given field name.
Definition at line 589 of file node.c.
References field_id, ts_language_field_id_for_name(), and ts_node_child_by_field_id().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), parse_declaration_node(), parse_enum_node(), parse_parameter_declaration_node(), parse_struct_node(), parse_type_abstract_declarator_node(), parse_type_declarator_node(), parse_type_descriptor_single(), parse_typedef_node(), and parse_union_node().
Get the node's number of children.
Definition at line 602 of file node.c.
References Subtree::ptr, ts_node__subtree(), ts_subtree_child_count(), and SubtreeHeapData::visible_child_count.
Referenced by ts_node__first_child_for_byte(), ts_node_child_by_field_id(), ts_node_child_count_wasm(), and ts_node_children_wasm().
|
inlinestatic |
Definition at line 73 of file node.c.
Referenced by ts_node_child_iterator_next().
|
inlinestatic |
Definition at line 77 of file node.c.
References length_add(), ts_node_child_iterator_done(), ts_node_new(), ts_subtree_children, ts_subtree_extra(), ts_subtree_padding(), and ts_subtree_size().
Referenced by ts_node__child(), ts_node__descendant_for_byte_range(), ts_node__descendant_for_point_range(), ts_node__first_child_for_byte(), ts_node__next_sibling(), ts_node__prev_sibling(), ts_node_child_by_field_id(), and ts_node_parent().
Get the smallest node within this node that spans the given range of bytes or (row, column) positions.
Definition at line 644 of file node.c.
References test_evm::end, start, and ts_node__descendant_for_byte_range().
Referenced by ts_node_descendant_for_index_wasm().
Definition at line 660 of file node.c.
References test_evm::end, start, and ts_node__descendant_for_point_range().
Referenced by ts_node_descendant_for_position_wasm().
void ts_node_edit | ( | TSNode * | self, |
const TSInputEdit * | edit | ||
) |
Edit the node to keep it in-sync with source code that has been edited.
This function is only rarely needed. When you edit a syntax tree with the ts_tree_edit
function, all of the nodes that you retrieve from the tree afterward will already reflect the edit. You only need to use ts_node_edit
when you have a TSNode
instance that you want to keep and continue to use after an edit.
Definition at line 676 of file node.c.
References TSPoint::column, TSInputEdit::new_end_byte, TSInputEdit::new_end_point, TSInputEdit::old_end_byte, TSInputEdit::old_end_point, point_add(), point_sub(), TSPoint::row, TSInputEdit::start_byte, ts_node_start_byte(), and ts_node_start_point().
Get the node's end byte.
Definition at line 406 of file node.c.
References Length::bytes, ts_node__subtree(), ts_node_start_byte(), and ts_subtree_size().
Referenced by create_cmd_edit(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), find_autocmplt_type(), find_autocmplt_type_at_stmt(), find_autocmplt_type_at_stmt_op(), find_autocmplt_type_quoted_arg(), get_cd_from_cmdid(), ts_node__first_child_for_byte(), ts_node__next_sibling(), ts_node__prev_sibling(), ts_node_end_index_wasm(), ts_node_parent(), ts_query_cursor__advance(), ts_query_cursor__compare_nodes(), ts_query_cursor__first_in_progress_capture(), ts_query_cursor_next_capture(), and ts_tree_cursor_end_index_wasm().
Get the node's end position in terms of rows and columns.
Definition at line 410 of file node.c.
References point_add(), ts_node__subtree(), ts_node_start_point(), and ts_subtree_size().
Referenced by create_cmd_edit(), ts_node_descendants_of_type_wasm(), ts_node_end_point_wasm(), ts_query_cursor__advance(), ts_query_cursor__first_in_progress_capture(), and ts_tree_cursor_end_position_wasm().
Check if two nodes are identical.
Definition at line 430 of file node.c.
References TSNode::id, and TSNode::tree.
Get the field name for node's child at the given index, where zero represents the first child. Returns NULL, if no field is found.
Definition at line 572 of file node.c.
References i, NULL, ts_language_field_map(), and ts_node__subtree().
Get the node's first child that extends beyond the given byte offset.
Definition at line 636 of file node.c.
References ts_node__first_child_for_byte().
Get the node's first named child that extends beyond the given byte offset.
Definition at line 640 of file node.c.
References ts_node__first_child_for_byte().
Check if a syntax node has been edited.
Definition at line 453 of file node.c.
References ts_node__subtree(), and ts_subtree_has_changes().
Referenced by ts_node_has_changes_wasm().
Check if the node is a syntax error or contains any syntax errors.
Definition at line 457 of file node.c.
References ts_node__subtree(), and ts_subtree_error_cost().
Referenced by core_cmd_tsrzcmd(), find_autocmplt_type_quoted_arg(), substitute_args_do(), and ts_node_has_error_wasm().
Check if the node is extra. Extra nodes represent things like comments, which are not required the grammar, but can appear anywhere.
Definition at line 438 of file node.c.
References ts_node__subtree(), and ts_subtree_extra().
Check if the node is missing. Missing nodes are inserted by the parser in order to recover from certain kinds of syntax errors.
Definition at line 449 of file node.c.
References ts_node__subtree(), and ts_subtree_missing().
Referenced by ts_node_is_missing_wasm(), and ts_tree_cursor_current_node_is_missing_wasm().
Check if the node is named. Named nodes correspond to named rules in the grammar, whereas anonymous nodes correspond to string literals in the grammar.
Definition at line 442 of file node.c.
References TSSymbolMetadata::named, ts_language_symbol_metadata(), ts_node__alias(), ts_node__subtree(), and ts_subtree_named().
Referenced by parse_declaration_node(), parse_enum_node(), parse_parameter_declaration_node(), parse_parameter_list(), parse_primitive_type(), parse_sized_primitive_type(), parse_sole_type_name(), parse_struct_node(), parse_type_abstract_declarator_node(), parse_type_declarator_node(), parse_type_descriptor_single(), parse_type_node_single(), parse_type_nodes_save(), parse_typedef_node(), parse_union_node(), ts_node_is_named_wasm(), ts_node_named_children_wasm(), ts_query_cursor__advance(), and ts_tree_cursor_current_node_is_named_wasm().
Check if the node is null. Functions like ts_node_child
and ts_node_next_sibling
will return a null node to indicate that no such node was found.
Definition at line 434 of file node.c.
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), find_autocmplt_type_arg_identifier(), find_autocmplt_type_at_stmt_op(), get_arg_number(), get_arg_parent(), get_cd_from_arg(), guess_next_autocmplt_token(), handle_cmd_substitution_arg(), is_arg_identifier_in_tmp_stmt(), node_malformed_error(), parse_args(), parse_declaration_node(), parse_enum_node(), parse_parameter_declaration_node(), parse_parameter_list(), parse_primitive_type(), parse_sized_primitive_type(), parse_sole_type_name(), parse_struct_node(), parse_type_abstract_declarator_node(), parse_type_declarator_node(), parse_type_descriptor_single(), parse_type_node_single(), parse_type_nodes_save(), parse_typedef_node(), parse_union_node(), ts_node__next_sibling(), ts_node__prev_sibling(), and ts_query_cursor__advance().
|
inlinestatic |
Definition at line 54 of file node.c.
References TSTree::language, length_zero(), NULL, NULL_SUBTREE, SubtreeHeapData::production_id, Subtree::ptr, TSNode::tree, ts_language_alias_sequence(), ts_node__subtree(), ts_node_start_byte(), ts_node_start_point(), and ts_subtree_child_count().
Referenced by ts_node__child(), ts_node__descendant_for_byte_range(), ts_node__descendant_for_point_range(), ts_node__first_child_for_byte(), ts_node__next_sibling(), ts_node__prev_sibling(), ts_node_child_by_field_id(), and ts_node_parent().
Get the node's named child at the given index.
See also ts_node_is_named
.
Definition at line 496 of file node.c.
References ts_node__child().
Referenced by DEFINE_HANDLE_TS_FCN(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), do_handle_ts_unescape_arg(), do_iter_sections(), get_cd_from_arg(), handle_substitution_args(), iter_dbt_commands(), iter_offsets_common(), parse_args(), parse_declaration_node(), parse_enum_node(), parse_parameter_declaration_node(), parse_parameter_list(), parse_struct_node(), parse_type_abstract_declarator_node(), parse_type_declarator_node(), parse_type_descriptor_single(), parse_typedef_node(), parse_union_node(), rz_type_parse_string_declaration_single(), rz_type_parse_string_single(), substitute_args_do(), ts_node_handle_arg_prargs(), ts_node_named_child_wasm(), and type_parse_string().
Get the node's number of named children.
See also ts_node_is_named
.
Definition at line 611 of file node.c.
References SubtreeHeapData::named_child_count, Subtree::ptr, ts_node__subtree(), and ts_subtree_child_count().
Referenced by DEFINE_HANDLE_TS_FCN(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), do_handle_ts_unescape_arg(), find_autocmplt_type(), handle_substitution_args(), iter_offsets_common(), parse_args(), parse_declaration_node(), parse_enum_node(), parse_parameter_list(), parse_struct_node(), parse_type_abstract_declarator_node(), parse_type_declarator_node(), parse_type_descriptor_single(), parse_typedef_node(), parse_union_node(), rz_type_parse_string_declaration_single(), rz_type_parse_string_single(), ts_node_named_child_count_wasm(), ts_node_named_children_wasm(), and type_parse_string().
Get the smallest named node within this node that spans the given range of bytes or (row, column) positions.
Definition at line 652 of file node.c.
References test_evm::end, start, and ts_node__descendant_for_byte_range().
Referenced by guess_next_autocmplt_token(), and ts_node_named_descendant_for_index_wasm().
Definition at line 668 of file node.c.
References test_evm::end, start, and ts_node__descendant_for_point_range().
Referenced by ts_node_named_descendant_for_position_wasm().
TSNode ts_node_new | ( | const TSTree * | tree, |
const Subtree * | subtree, | ||
Length | position, | ||
TSSymbol | alias | ||
) |
Definition at line 17 of file node.c.
References Length::bytes, TSPoint::column, Length::extent, and TSPoint::row.
Referenced by ts_node__null(), ts_node_child_iterator_next(), ts_tree_cursor_current_node(), ts_tree_cursor_parent_node(), and ts_tree_root_node().
Get the node's next / previous named sibling.
Definition at line 624 of file node.c.
References ts_node__next_sibling().
Referenced by parse_struct_node(), parse_union_node(), and ts_node_next_named_sibling_wasm().
Get the node's next / previous sibling.
Definition at line 620 of file node.c.
References ts_node__next_sibling().
Referenced by ts_node_next_sibling_wasm().
Get the node's immediate parent.
Definition at line 461 of file node.c.
References TSNode::id, ts_node__is_relevant(), ts_node__null(), ts_node_child_iterator_next(), ts_node_end_byte(), ts_node_iterate_children(), ts_node_start_byte(), and ts_tree_root_node().
Referenced by get_arg_number(), get_arg_parent(), get_cd_from_arg(), handle_cmd_substitution_arg(), ts_node__next_sibling(), ts_node__prev_sibling(), and ts_node_parent_wasm().
Definition at line 632 of file node.c.
References ts_node__prev_sibling().
Referenced by ts_node_prev_named_sibling_wasm().
Definition at line 628 of file node.c.
References ts_node__prev_sibling().
Referenced by get_arg_number(), and ts_node_prev_sibling_wasm().
Get the node's start byte.
Definition at line 36 of file node.c.
Referenced by create_cmd_edit(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), find_autocmplt_type(), find_autocmplt_type_at_stmt(), find_autocmplt_type_at_stmt_op(), find_autocmplt_type_newcmd_or_arg(), find_autocmplt_type_quoted_arg(), get_cd_from_cmdid(), ts_node__descendant_for_byte_range(), ts_node__next_sibling(), ts_node_edit(), ts_node_end_byte(), ts_node_iterate_children(), ts_node_parent(), ts_node_start_index_wasm(), ts_node_sub_parent_string(), ts_query_cursor__advance(), ts_query_cursor__compare_nodes(), ts_query_cursor__first_in_progress_capture(), ts_query_cursor_next_capture(), and ts_tree_cursor_start_index_wasm().
Get the node's start position in terms of rows and columns.
Definition at line 40 of file node.c.
Referenced by create_cmd_edit(), ts_node__descendant_for_point_range(), ts_node_descendants_of_type_wasm(), ts_node_edit(), ts_node_end_point(), ts_node_iterate_children(), ts_node_start_point_wasm(), ts_query_cursor__advance(), and ts_tree_cursor_start_position_wasm().
char* ts_node_string | ( | TSNode | self | ) |
Get an S-expression representing the node as a string.
This string is allocated with malloc
and the caller is responsible for freeing it using free
.
Definition at line 426 of file node.c.
References ts_node__subtree(), and ts_subtree_string().
Referenced by core_cmd_tsrzcmd(), node_malformed_error(), parse_enum_node(), parse_struct_node(), parse_typedef_node(), parse_union_node(), rz_type_parse_string_declaration_single(), rz_type_parse_string_single(), ts_node_to_string_wasm(), and type_parse_string().
Get the node's type as a numerical id.
Definition at line 414 of file node.c.
References ts_language_public_symbol(), ts_node__alias(), ts_node__subtree(), and ts_subtree_symbol().
Referenced by handle_ts_stmt(), ts_node_descendants_of_type_wasm(), ts_node_symbol_wasm(), ts_query_cursor__advance(), and ts_tree_cursor_current_node_type_id_wasm().
Get the node's type as a null-terminated string.
Definition at line 420 of file node.c.
References ts_language_symbol_name(), ts_node__alias(), ts_node__subtree(), and ts_subtree_symbol().
Referenced by find_autocmplt_type(), find_autocmplt_type_arg_identifier(), find_autocmplt_type_at_stmt(), find_autocmplt_type_at_stmt_op(), find_autocmplt_type_newcmd_or_arg(), find_autocmplt_type_quoted_arg(), get_arg_number(), get_arg_parent(), get_cd_from_arg(), handle_ts_stmt(), is_arg_identifier_in_tmp_stmt(), parse_declaration_node(), parse_enum_node(), parse_parameter_declaration_node(), parse_parameter_list(), parse_primitive_type(), parse_sized_primitive_type(), parse_sole_type_name(), parse_struct_node(), parse_type_abstract_declarator_node(), parse_type_declarator_node(), parse_type_descriptor_single(), parse_type_node_single(), parse_type_nodes_save(), parse_typedef_node(), parse_union_node(), rz_type_parse_string_declaration_single(), rz_type_parse_string_single(), ts_query_cursor__advance(), ts_query_cursor__capture(), and type_parse_string().
Definition at line 173 of file node.c.
References i, Subtree::ptr, ts_subtree_child_count(), ts_subtree_children, and ts_subtree_total_bytes().
Referenced by ts_node__prev_sibling().