#ifndef RT_ASSETC_DESCRIPTION_PARSER_H #define RT_ASSETC_DESCRIPTION_PARSER_H #include "runtime/runtime.h" #ifdef __cplusplus extern "C" { #endif struct rt_arena_s; typedef enum { RT_STMT_FORM_VALUE, RT_STMT_FORM_LIST, RT_STMT_FORM_BLOCK, } rt_stmt_form; typedef struct { unsigned int first; unsigned int count; } rt_parsed_stmt_list; typedef struct { rt_stmt_form form; rt_text_span attribute; union { rt_text_span value; rt_text_span block; unsigned int list_index; }; /* For lists */ unsigned int next; } rt_parsed_stmt; typedef struct { const char *file; const char *text; size_t at; size_t length; int line; rt_parsed_stmt *statements; unsigned int statement_count; unsigned int statement_capacity; rt_parsed_stmt_list *statement_lists; unsigned int statement_list_count; unsigned int statement_list_capacity; } rt_parse_state; rt_result rtParseDescription(const char *text, size_t length, const char *file_path, unsigned int *root_list, rt_parse_state *state, struct rt_arena_s *arena); const rt_parsed_stmt * rtFindStatement(const rt_parse_state *state, unsigned int list_index, const char *attribute); #ifdef __cplusplus } #endif #endif