27 lines
455 B
C
27 lines
455 B
C
#ifndef PARSE_H
|
|
#define PARSE_H
|
|
|
|
#include "am.h"
|
|
#include "token.h"
|
|
|
|
#define PARSE_MAX_DEPTH 128U
|
|
|
|
typedef enum {
|
|
PARSE_STATE_INIT,
|
|
PARSE_STATE_LIST,
|
|
PARSE_STATE_DONE,
|
|
PARSE_STATE_ERROR,
|
|
} parse_state_t;
|
|
|
|
typedef struct {
|
|
am_t *am;
|
|
store_t *store;
|
|
parse_state_t state;
|
|
parse_state_t *sp, stack[PARSE_MAX_DEPTH];
|
|
} parse_ctx_t;
|
|
|
|
void parse_init(am_t *am, parse_ctx_t *out);
|
|
parse_state_t parse_proc(parse_ctx_t *ctx, const token_t *token);
|
|
|
|
#endif
|