From 3906ec27228978b43cae8af7e1258f9a773d5a26 Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Thu, 30 May 2024 15:46:21 +0200 Subject: [PATCH] split types into headers --- parser/src/api_structs.h | 79 ++++++++++++++++++---------------------- parser/src/structs.h | 58 ++++++++++++++--------------- 2 files changed, 63 insertions(+), 74 deletions(-) diff --git a/parser/src/api_structs.h b/parser/src/api_structs.h index 42ebe60c..1148e992 100644 --- a/parser/src/api_structs.h +++ b/parser/src/api_structs.h @@ -7,76 +7,66 @@ #include "me/types.h" #include +typedef uint16_t t_field_id; typedef uint16_t t_state_id; typedef uint16_t t_symbol; -typedef uint16_t t_field_id; -typedef unsigned t_stack_version; typedef uint64_t t_parser_clock; typedef uint64_t t_parser_duration; +typedef unsigned t_stack_version; typedef union u_parse_action_entry t_parse_action_entry; typedef union u_subtree t_subtree; typedef union u_mutable_subtree t_mutable_subtree; typedef union u_parse_action t_parse_action; -typedef struct s_language t_language; -typedef struct s_first_parser t_first_parser; -typedef struct s_first_tree t_first_tree; -typedef struct s_parse_query t_parse_query; -typedef struct s_query_cursor t_query_cursor; -typedef struct s_lookahead_iterator t_lookahead_iterator; -typedef struct s_point t_point; -typedef struct s_length t_length; -typedef struct s_parse_range t_parse_range; -typedef struct s_parse_input t_parse_input; -typedef struct s_parse_logger t_parse_logger; -typedef struct s_input_edit t_input_edit; -typedef struct s_parse_node t_parse_node; -typedef struct s_tree_cursor t_tree_cursor; -typedef struct s_query_capture t_query_capture; -typedef struct s_query_match t_query_match; -typedef struct s_query_predicate_step t_query_predicate_step; -typedef struct s_subtree_inline_data t_subtree_inline_data; -typedef struct s_subtree_heap_data t_subtree_heap_data; -typedef struct s_subtree_pool t_subtree_pool; -typedef struct s_table_entry t_table_entry; -typedef struct s_symbol_metadata t_symbol_metadata; +typedef struct s_char_range t_char_range; +typedef struct s_external_scanner_state t_external_scanner_state; typedef struct s_field_map_entry t_field_map_entry; typedef struct s_field_map_slice t_field_map_slice; -typedef struct s_lexer_data t_lexer_data; +typedef struct s_first_parser t_first_parser; +typedef struct s_first_tree t_first_tree; +typedef struct s_input_edit t_input_edit; +typedef struct s_language t_language; +typedef struct s_length t_length; typedef struct s_lex_mode t_lex_mode; -typedef struct s_char_range t_char_range; -typedef struct s_tree_cursor_entry t_tree_cursor_entry; -typedef struct s_external_scanner_state t_external_scanner_state; +typedef struct s_lexer t_lexer; +typedef struct s_lexer_data t_lexer_data; +typedef struct s_lookahead_iterator t_lookahead_iterator; +typedef struct s_parse_input t_parse_input; +typedef struct s_parse_logger t_parse_logger; +typedef struct s_parse_node t_parse_node; +typedef struct s_parse_query t_parse_query; typedef struct s_parse_query_cursor t_parse_query_cursor; typedef struct s_parse_query_error t_parse_query_error; typedef struct s_parse_query_error_cost t_parse_query_error_cost; -typedef struct s_lexer_data t_lexer_data; -typedef struct s_subtree_inline_data t_subtree_inline_data; -typedef struct s_subtree_heap_data t_subtree_heap_data; -typedef struct s_subtree_pool t_subtree_pool; -typedef struct s_table_entry t_table_entry; -typedef struct s_symbol_metadata t_symbol_metadata; -typedef struct s_field_map_entry t_field_map_entry; -typedef struct s_field_map_slice t_field_map_slice; -typedef struct s_lexer_data t_lexer_data; -typedef struct s_lex_mode t_lex_mode; -typedef struct s_lexer t_lexer; +typedef struct s_parse_range t_parse_range; typedef struct s_parse_state t_parse_state; +typedef struct s_point t_point; +typedef struct s_query_capture t_query_capture; +typedef struct s_query_cursor t_query_cursor; +typedef struct s_query_match t_query_match; +typedef struct s_query_predicate_step t_query_predicate_step; typedef struct s_reduce_action t_reduce_action; -typedef struct s_stack_entry t_stack_entry; typedef struct s_reusable_node t_reusable_node; -typedef struct s_stack_summary_entry t_stack_summary_entry; typedef struct s_stack t_stack; +typedef struct s_stack_entry t_stack_entry; typedef struct s_stack_slice t_stack_slice; +typedef struct s_stack_summary_entry t_stack_summary_entry; +typedef struct s_subtree_heap_data t_subtree_heap_data; +typedef struct s_subtree_inline_data t_subtree_inline_data; +typedef struct s_subtree_pool t_subtree_pool; +typedef struct s_symbol_metadata t_symbol_metadata; +typedef struct s_table_entry t_table_entry; +typedef struct s_tree_cursor t_tree_cursor; +typedef struct s_tree_cursor_entry t_tree_cursor_entry; typedef enum e_input_encoding t_input_encoding; -typedef enum e_symbol_type t_symbol_type; typedef enum e_log_type t_log_type; +typedef enum e_parse_action_type t_parse_action_type; typedef enum e_quantifier t_quantifier; typedef enum e_query_error t_query_error; typedef enum e_query_predicate_step_type t_query_predicate_step_type; -typedef enum e_parse_action_type t_parse_action_type; +typedef enum e_symbol_type t_symbol_type; typedef Array(t_parse_range) t_range_array; typedef Array(t_subtree) t_subtree_array; @@ -84,6 +74,7 @@ typedef Array(t_mutable_subtree) t_mutable_subtree_array; typedef Array(t_reduce_action) t_reduce_action_set; typedef Array(t_stack_slice) t_stack_slice_array; typedef Array(t_stack_summary_entry) t_stack_summary; + typedef void (*StackIterateCallback)(void *, t_state_id, uint32_t); struct s_point @@ -586,4 +577,4 @@ struct s_first_tree unsigned included_range_count; }; -#endif // API_STRUCTS_H \ No newline at end of file +#endif // API_STRUCTS_H diff --git a/parser/src/structs.h b/parser/src/structs.h index e0ef3ce1..e04ba0ed 100644 --- a/parser/src/structs.h +++ b/parser/src/structs.h @@ -5,51 +5,49 @@ typedef unsigned t_stack_action; +typedef struct s_analysis_state t_analysis_state; +typedef struct s_analysis_state_entry t_analysis_state_entry; +typedef struct s_analysis_subgraph t_analysis_subgraph; +typedef struct s_analysis_subgraph_node t_analysis_subgraph_node; +typedef struct s_capture_list_pool t_capture_list_pool; +typedef struct s_cursor_child_iterator t_cursor_child_iterator; typedef struct s_edit t_edit; typedef struct s_edit_entry t_edit_entry; -typedef struct s_cursor_child_iterator t_cursor_child_iterator; -typedef struct s_summarize_stack_session t_summarize_stack_session; -typedef struct s_stack_node t_stack_node; -typedef struct s_stack_link t_stack_link; -typedef struct s_stack_head t_stack_head; -typedef struct s_stack_iterator t_stack_iterator; +typedef struct s_error_status t_error_status; +typedef struct s_first_parser t_first_parser; +typedef struct s_iterator t_iterator; +typedef struct s_node_child_iterator t_node_child_iterator; +typedef struct s_parse_query t_parse_query; +typedef struct s_pattern_entry t_pattern_entry; +typedef struct s_query_analysis t_query_analysis; +typedef struct s_query_cursor t_query_cursor; +typedef struct s_query_pattern t_query_pattern; +typedef struct s_query_state t_query_state; +typedef struct s_query_step t_query_step; +typedef struct s_slice t_slice; typedef struct s_stack t_stack; typedef struct s_stack_head t_stack_head; typedef struct s_stack_iterator t_stack_iterator; -typedef struct s_query_cursor t_query_cursor; -typedef struct s_parse_query t_parse_query; +typedef struct s_stack_link t_stack_link; +typedef struct s_stack_node t_stack_node; typedef struct s_state_predecessor_map t_state_predecessor_map; -typedef struct s_analysis_subgraph t_analysis_subgraph; -typedef struct s_analysis_subgraph_node t_analysis_subgraph_node; -typedef struct s_query_analysis t_query_analysis; -typedef struct s_analysis_state t_analysis_state; -typedef struct s_analysis_state_entry t_analysis_state_entry; -typedef struct s_capture_list_pool t_capture_list_pool; -typedef struct s_query_state t_query_state; typedef struct s_step_offset t_step_offset; -typedef struct s_query_pattern t_query_pattern; -typedef struct s_pattern_entry t_pattern_entry; -typedef struct s_symbol_table t_symbol_table; -typedef struct s_slice t_slice; -typedef struct s_query_step t_query_step; typedef struct s_stream t_stream; typedef struct s_string_input t_string_input; -typedef struct s_error_status t_error_status; -typedef struct s_first_parser t_first_parser; +typedef struct s_summarize_stack_session t_summarize_stack_session; +typedef struct s_symbol_table t_symbol_table; typedef struct s_token_cache t_token_cache; -typedef struct s_node_child_iterator t_node_child_iterator; -typedef struct s_iterator t_iterator; -typedef struct s_parse_query t_parse_query; typedef t_stack_action (*t_stack_callback)(void *, const t_stack_iterator *); -typedef Array(t_stack_node *) t_stack_node_array; -typedef Array(t_analysis_subgraph) t_analysis_subgraph_array; -typedef Array(t_analysis_state *) t_analysis_state_set; -typedef Array(uint8_t) t_capture_quantifiers; typedef uint32_t (*t_unicode_decode_function)(const uint8_t *chunk, uint32_t size, int32_t *codepoint); + +typedef Array(t_analysis_state *) t_analysis_state_set; +typedef Array(t_analysis_subgraph) t_analysis_subgraph_array; typedef Array(t_query_capture) t_capture_list; +typedef Array(t_stack_node *) t_stack_node_array; +typedef Array(uint8_t) t_capture_quantifiers; typedef enum e_stack_status t_stack_status; typedef enum e_error_comparaison t_error_comparaison; @@ -542,4 +540,4 @@ struct s_cursor_child_iterator const t_symbol *alias_sequence; }; -#endif // STRUCTS_H \ No newline at end of file +#endif // STRUCTS_H