lang: ast: fix incorrect return types; add function to determine expression tokens
This commit is contained in:
@@ -9,16 +9,12 @@ struct msgh_parser_state {
|
||||
struct parser_state s_base;
|
||||
bool s_oneline;
|
||||
|
||||
enum {
|
||||
AREA_SELECTOR,
|
||||
AREA_BODY,
|
||||
} s_current_area;
|
||||
|
||||
unsigned int s_i;
|
||||
unsigned int s_prev;
|
||||
};
|
||||
|
||||
static struct token_parse_result parse_ident(struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
static struct token_parse_result parse_ident(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
{
|
||||
struct msgh_parser_state *state
|
||||
= parser_get_state(ctx, struct msgh_parser_state);
|
||||
@@ -26,7 +22,7 @@ static struct token_parse_result parse_ident(struct ivy_parser *ctx, struct ivy_
|
||||
struct ivy_ast_msgh_node *msgh
|
||||
= (struct ivy_ast_msgh_node *)state->s_base.s_node;
|
||||
|
||||
if (state->s_current_area == AREA_BODY) {
|
||||
if (msgh->n_sel) {
|
||||
/* TODO expression parsing */
|
||||
return PARSE_RESULT(IVY_ERR_NOT_SUPPORTED, 0);
|
||||
}
|
||||
@@ -39,18 +35,18 @@ static struct token_parse_result parse_ident(struct ivy_parser *ctx, struct ivy_
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
static struct token_parse_result add_child(
|
||||
static enum ivy_status add_child(
|
||||
struct ivy_ast_node *parent, struct ivy_ast_node *child)
|
||||
{
|
||||
struct ivy_ast_msgh_node *msgh = (struct ivy_ast_msgh_node *)parent;
|
||||
|
||||
if (child->n_type == IVY_AST_SELECTOR && !msgh->n_sel) {
|
||||
msgh->n_sel = (struct ivy_ast_selector_node *)child;
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
b_queue_push_back(&msgh->n_body, &child->n_entry);
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
static void init_state(struct ivy_parser *ctx, struct parser_state *sp)
|
||||
@@ -58,7 +54,6 @@ static void init_state(struct ivy_parser *ctx, struct parser_state *sp)
|
||||
struct msgh_parser_state *state = (struct msgh_parser_state *)sp;
|
||||
state->s_oneline = false;
|
||||
state->s_i = 0;
|
||||
state->s_current_area = AREA_SELECTOR;
|
||||
state->s_prev = IVY_SYM_HYPHEN;
|
||||
|
||||
parser_push_state(ctx, IVY_AST_SELECTOR);
|
||||
|
||||
Reference in New Issue
Block a user