Rizin
unix-like reverse engineering framework and cli tools
|
#include <stdio.h>
#include <rz_types.h>
#include <rz_list.h>
#include <rz_util/rz_str.h>
#include <rz_util/rz_file.h>
#include <rz_util/rz_assert.h>
#include <rz_type.h>
#include <tree_sitter/api.h>
#include <types_parser.h>
Go to the source code of this file.
Macros | |
#define | TS_START_END(node, start, end) |
Definition at line 15 of file types_parser.c.
Definition at line 63 of file types_parser.c.
Referenced by parse_parameter_declaration_node(), and parse_type_abstract_declarator_node().
Definition at line 69 of file types_parser.c.
Referenced by parse_parameter_declaration_node(), and parse_type_declarator_node().
Definition at line 1485 of file types_parser.c.
References type.
Referenced by parse_type_declarator_node().
void node_malformed_error | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
const char * | nodetype | ||
) |
Definition at line 27 of file types_parser.c.
References free(), NULL, rz_return_if_fail, rz_str_get_null(), rz_strbuf_appendf(), create_tags_rz::text, ts_node_is_null(), ts_node_string(), and ts_node_sub_string().
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_typedef_node(), and parse_union_node().
int parse_declaration_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair | ||
) |
Definition at line 1788 of file types_parser.c.
References free(), node_malformed_error(), NULL, parse_type_declarator_node(), parse_type_node_single(), parser_debug(), parser_error(), rz_return_val_if_fail, create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_sub_string(), and ts_node_type().
Referenced by parse_type_nodes_save(), and rz_type_parse_string_declaration_single().
int parse_enum_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
bool | is_const | ||
) |
Definition at line 885 of file types_parser.c.
References ParserTypePair::btype, c_parser_base_type_is_forward_definition(), c_parser_base_type_store(), c_parser_forward_definition_remove(), c_parser_get_enum_type(), c_parser_new_anonymous_enum_name(), c_parser_new_enum_forward_definition(), c_parser_new_enum_naked_type(), c_parser_new_enum_type(), rz_base_type_enum_t::cases, rz_base_type_t::enum_data, free(), i, rz_type_enum_case_t::name, node_malformed_error(), NULL, parser_debug(), parser_error(), parser_warning(), rz_num_get(), rz_return_val_if_fail, rz_vector_empty(), rz_vector_push(), rz_vector_tail(), st64, create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_string(), ts_node_sub_string(), ts_node_type(), and rz_type_enum_case_t::val.
Referenced by parse_type_node_single(), and parse_type_nodes_save().
int parse_parameter_declaration_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
char ** | identifier | ||
) |
Definition at line 226 of file types_parser.c.
References free(), is_abstract_declarator(), is_declarator(), node_malformed_error(), parse_type_abstract_declarator_node(), parse_type_declarator_node(), parse_type_node_single(), parser_debug(), parser_error(), rz_return_val_if_fail, create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_sub_string(), and ts_node_type().
Referenced by parse_parameter_list().
int parse_parameter_list | ( | CParserState * | state, |
TSNode | paramlist, | ||
const char * | text, | ||
ParserTypePair ** | tpair | ||
) |
Definition at line 1228 of file types_parser.c.
References c_parser_new_callable_argument(), free(), i, node_malformed_error(), NULL, parse_parameter_declaration_node(), parser_debug(), parser_error(), rz_return_val_if_fail, rz_str_newf(), RZ_TYPE_KIND_CALLABLE, create_tags_rz::text, ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_type(), and ParserTypePair::type.
Referenced by parse_type_abstract_declarator_node(), and parse_type_declarator_node().
int parse_primitive_type | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
bool | is_const | ||
) |
Definition at line 83 of file types_parser.c.
References c_parser_base_type_store(), c_parser_get_primitive_type(), c_parser_new_primitive_type(), free(), node_malformed_error(), parser_debug(), parser_error(), rz_return_val_if_fail, create_tags_rz::text, ts_node_is_named(), ts_node_is_null(), ts_node_sub_string(), and ts_node_type().
Referenced by parse_type_node_single().
int parse_sized_primitive_type | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
bool | is_const | ||
) |
Definition at line 119 of file types_parser.c.
References c_parser_base_type_store(), c_parser_get_primitive_type(), c_parser_new_primitive_type(), free(), node_malformed_error(), parser_debug(), parser_error(), rz_return_val_if_fail, create_tags_rz::text, ts_node_is_named(), ts_node_is_null(), ts_node_sub_string(), and ts_node_type().
Referenced by parse_type_node_single().
int parse_sole_type_name | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
bool | is_const | ||
) |
Definition at line 155 of file types_parser.c.
References c_parser_base_type_is_forward_definition(), c_parser_forward_definition_store(), c_parser_get_primitive_type(), c_parser_get_structure_type(), c_parser_get_typedef(), c_parser_get_union_type(), c_parser_new_primitive_type(), c_parser_new_unspecified_naked_type(), free(), node_malformed_error(), NULL, parser_debug(), parser_error(), RZ_FREE, rz_return_val_if_fail, rz_type_base_type_free(), rz_type_free(), create_tags_rz::text, ts_node_is_named(), ts_node_is_null(), ts_node_sub_string(), and ts_node_type().
Referenced by parse_type_node_single().
int parse_struct_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
bool | is_const | ||
) |
Definition at line 306 of file types_parser.c.
References bits(), ParserTypePair::btype, c_parser_base_type_is_forward_definition(), c_parser_base_type_store(), c_parser_forward_definition_remove(), c_parser_get_structure_type(), c_parser_new_anonymous_structure_name(), c_parser_new_structure_forward_definition(), c_parser_new_structure_naked_type(), c_parser_new_structure_type(), field_declarator, field_type, free(), i, rz_base_type_struct_t::members, rz_type_struct_member_t::name, node_malformed_error(), NULL, parse_type_declarator_node(), parse_type_node_single(), parser_debug(), parser_error(), parser_warning(), rz_num_get(), rz_return_val_if_fail, rz_vector_push(), rz_base_type_t::struct_data, create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_next_named_sibling(), ts_node_string(), ts_node_sub_string(), ts_node_type(), and ParserTypePair::type.
Referenced by parse_type_node_single(), and parse_type_nodes_save().
int parse_type_abstract_declarator_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair | ||
) |
Definition at line 1295 of file types_parser.c.
References c_parser_callable_type_store(), c_parser_new_anonymous_callable_name(), c_parser_new_callable(), free(), is_abstract_declarator(), node_malformed_error(), NULL, parse_parameter_list(), parser_debug(), parser_error(), RZ_NEW0, rz_num_get(), rz_return_val_if_fail, RZ_TYPE_KIND_ARRAY, RZ_TYPE_KIND_POINTER, create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_sub_string(), ts_node_type(), type, and rz_type_t::type.
Referenced by parse_parameter_declaration_node(), and parse_type_descriptor_single().
int parse_type_declarator_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
char ** | identifier | ||
) |
Definition at line 1492 of file types_parser.c.
References c_parser_callable_type_store(), c_parser_new_naked_callable(), rz_type_t::callable, free(), is_declarator(), is_function_declarator(), is_identifier(), rz_callable_at::name, node_malformed_error(), NULL, parse_parameter_list(), parser_debug(), parser_error(), rz_callable_at::ret, RZ_NEW0, rz_num_get(), rz_return_val_if_fail, RZ_TYPE_KIND_ARRAY, RZ_TYPE_KIND_POINTER, strdup(), create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_sub_string(), ts_node_type(), type, and rz_type_t::type.
Referenced by parse_declaration_node(), parse_parameter_declaration_node(), parse_struct_node(), parse_typedef_node(), and parse_union_node().
int parse_type_descriptor_single | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair | ||
) |
Definition at line 1719 of file types_parser.c.
References free(), node_malformed_error(), parse_type_abstract_declarator_node(), parse_type_node_single(), parser_debug(), parser_error(), rz_return_val_if_fail, create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_sub_string(), and ts_node_type().
Referenced by rz_type_parse_string_single().
int parse_type_node_single | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
bool | is_const | ||
) |
Definition at line 1170 of file types_parser.c.
References parse_enum_node(), parse_primitive_type(), parse_sized_primitive_type(), parse_sole_type_name(), parse_struct_node(), parse_typedef_node(), parse_union_node(), parser_debug(), rz_return_val_if_fail, create_tags_rz::text, ts_node_is_named(), ts_node_is_null(), and ts_node_type().
Referenced by parse_declaration_node(), parse_parameter_declaration_node(), parse_struct_node(), parse_type_descriptor_single(), parse_typedef_node(), and parse_union_node().
int parse_type_nodes_save | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text | ||
) |
Definition at line 1866 of file types_parser.c.
References free(), NULL, parse_declaration_node(), parse_enum_node(), parse_struct_node(), parse_typedef_node(), parse_union_node(), parser_error(), rz_return_val_if_fail, create_tags_rz::text, ts_node_is_named(), ts_node_is_null(), ts_node_sub_string(), and ts_node_type().
Referenced by type_parse_string().
int parse_typedef_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair | ||
) |
Definition at line 1078 of file types_parser.c.
References ParserTypePair::btype, c_parser_base_type_is_forward_definition(), c_parser_base_type_store(), c_parser_forward_definition_remove(), c_parser_new_typedef(), free(), node_malformed_error(), NULL, parse_type_declarator_node(), parse_type_node_single(), parser_debug(), parser_error(), rz_return_val_if_fail, rz_type_identifier(), create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_string(), ts_node_sub_string(), ts_node_type(), rz_base_type_t::type, and ParserTypePair::type.
Referenced by parse_type_node_single(), and parse_type_nodes_save().
int parse_union_node | ( | CParserState * | state, |
TSNode | node, | ||
const char * | text, | ||
ParserTypePair ** | tpair, | ||
bool | is_const | ||
) |
Definition at line 598 of file types_parser.c.
References bits(), ParserTypePair::btype, c_parser_base_type_is_forward_definition(), c_parser_base_type_store(), c_parser_forward_definition_remove(), c_parser_get_union_type(), c_parser_new_anonymous_union_name(), c_parser_new_union_forward_definition(), c_parser_new_union_naked_type(), c_parser_new_union_type(), field_declarator, field_type, free(), i, rz_base_type_union_t::members, rz_type_union_member_t::name, node_malformed_error(), NULL, parse_type_declarator_node(), parse_type_node_single(), parser_debug(), parser_error(), parser_warning(), rz_num_get(), rz_return_val_if_fail, rz_vector_push(), create_tags_rz::text, ts_node_child_by_field_name(), ts_node_is_named(), ts_node_is_null(), ts_node_named_child(), ts_node_named_child_count(), ts_node_next_named_sibling(), ts_node_string(), ts_node_sub_string(), ts_node_type(), ParserTypePair::type, and rz_base_type_t::union_data.
Referenced by parse_type_node_single(), and parse_type_nodes_save().
void parser_debug | ( | CParserState * | state, |
const char * | fmt, | ||
... | |||
) |
Definition at line 37 of file types_parser.c.
References rz_return_if_fail, and rz_strbuf_vappendf().
Referenced by c_parser_callable_type_store(), 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_typedef_node(), parse_union_node(), rz_type_parse_string_declaration_single(), rz_type_parse_string_single(), and type_parse_string().
void parser_error | ( | CParserState * | state, |
const char * | fmt, | ||
... | |||
) |
Definition at line 47 of file types_parser.c.
References rz_return_if_fail, and rz_strbuf_vappendf().
Referenced by c_parser_new_enum_type(), c_parser_new_primitive_type(), c_parser_new_structure_type(), c_parser_new_typedef(), c_parser_new_union_type(), 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_nodes_save(), parse_typedef_node(), and parse_union_node().
void parser_warning | ( | CParserState * | state, |
const char * | fmt, | ||
... | |||
) |
Definition at line 55 of file types_parser.c.
References rz_return_if_fail, and rz_strbuf_vappendf().
Referenced by parse_enum_node(), parse_struct_node(), parse_union_node(), rz_type_parse_string_declaration_single(), rz_type_parse_string_single(), and type_parse_string().
Definition at line 21 of file types_parser.c.
References test_evm::end, rz_str_newf(), start, and TS_START_END.
Referenced by node_malformed_error(), parse_declaration_node(), parse_enum_node(), parse_parameter_declaration_node(), 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_nodes_save(), parse_typedef_node(), and parse_union_node().