42 lines
1003 B
C
42 lines
1003 B
C
#include "parse.h"
|
|
|
|
struct unit_parser_state {
|
|
struct parser_state s_base;
|
|
};
|
|
|
|
static enum ivy_status parse_constpool(struct ivy_asm_parser* ctx, struct ivy_asm_token* tok)
|
|
{
|
|
asm_parser_push_state(ctx, ASM_PARSER_CONSTPOOL);
|
|
return IVY_OK;
|
|
}
|
|
|
|
static enum ivy_status parse_import(
|
|
struct ivy_asm_parser *ctx, struct ivy_asm_token *tok)
|
|
{
|
|
asm_parser_push_state(ctx, ASM_PARSER_IMPORT);
|
|
return IVY_OK;
|
|
}
|
|
|
|
static enum ivy_status parse_block(
|
|
struct ivy_asm_parser *ctx, struct ivy_asm_token *tok)
|
|
{
|
|
asm_parser_push_state(ctx, ASM_PARSER_BLOCK);
|
|
return IVY_OK;
|
|
}
|
|
|
|
static enum ivy_status parse_class(
|
|
struct ivy_asm_parser *ctx, struct ivy_asm_token *tok)
|
|
{
|
|
asm_parser_push_state(ctx, ASM_PARSER_CLASS);
|
|
return IVY_OK;
|
|
}
|
|
|
|
struct parser_state_type unit_parser_state_type = {
|
|
.n_state_size = sizeof(struct unit_parser_state),
|
|
.n_keyword_parsers = {
|
|
KW_PARSER(CONSTPOOL, parse_constpool),
|
|
KW_PARSER(IMPORT, parse_import),
|
|
KW_PARSER(CLASS, parse_class),
|
|
KW_PARSER(BLOCK, parse_block),
|
|
},
|
|
}; |