54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
#ifndef VY_ASSETC_DESCRIPTION_PARSER_H
|
|
#define VY_ASSETC_DESCRIPTION_PARSER_H
|
|
|
|
#include "runtime/runtime.h"
|
|
|
|
typedef enum {
|
|
VY_STMT_FORM_VALUE,
|
|
VY_STMT_FORM_LIST,
|
|
} vy_stmt_form;
|
|
|
|
typedef struct {
|
|
unsigned int first;
|
|
unsigned int count;
|
|
} vy_parsed_stmt_list;
|
|
|
|
typedef struct {
|
|
vy_stmt_form form;
|
|
vy_text_span attribute;
|
|
union {
|
|
vy_text_span value;
|
|
unsigned int list_index;
|
|
};
|
|
/* For lists */
|
|
unsigned int next;
|
|
} vy_parsed_stmt;
|
|
|
|
typedef struct {
|
|
const char *file;
|
|
const char *text;
|
|
size_t at;
|
|
size_t length;
|
|
int line;
|
|
|
|
vy_parsed_stmt *statements;
|
|
unsigned int statement_count;
|
|
unsigned int statement_capacity;
|
|
|
|
vy_parsed_stmt_list *statement_lists;
|
|
unsigned int statement_list_count;
|
|
unsigned int statement_list_capacity;
|
|
} vy_parse_state;
|
|
|
|
vy_result vyParseDescription(const char *text,
|
|
size_t length,
|
|
const char *file_path,
|
|
unsigned int *root_list,
|
|
vy_parse_state *state);
|
|
|
|
const vy_parsed_stmt *vyFindStatement(const vy_parse_state *state, unsigned int list_index, const char *attribute);
|
|
|
|
void vyReleaseParseState(vy_parse_state *state);
|
|
|
|
#endif
|