lang: ast: fix parsing of consecutive unary messages
This commit is contained in:
@@ -205,6 +205,29 @@ static struct ivy_ast_node *create_operator_node_from_token(struct ivy_token *to
|
|||||||
return (struct ivy_ast_node *)new_op_node;
|
return (struct ivy_ast_node *)new_op_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_expr_queues(struct expr_parser_state *state)
|
||||||
|
{
|
||||||
|
b_queue_iterator it = {0};
|
||||||
|
|
||||||
|
printf("operators:");
|
||||||
|
b_queue_foreach (&it, &state->s_operator_stack) {
|
||||||
|
struct ivy_ast_node *n
|
||||||
|
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||||
|
fputc(' ', stdout);
|
||||||
|
print_operand(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\noperands:");
|
||||||
|
b_queue_foreach (&it, &state->s_output_queue) {
|
||||||
|
struct ivy_ast_node *n
|
||||||
|
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||||
|
fputc(' ', stdout);
|
||||||
|
print_operand(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void push_operator(struct expr_parser_state *state, struct ivy_ast_node *node)
|
static void push_operator(struct expr_parser_state *state, struct ivy_ast_node *node)
|
||||||
{
|
{
|
||||||
const struct ivy_operator *op = get_operator_from_node(node);
|
const struct ivy_operator *op = get_operator_from_node(node);
|
||||||
@@ -250,29 +273,7 @@ static void push_operator(struct expr_parser_state *state, struct ivy_ast_node *
|
|||||||
}
|
}
|
||||||
|
|
||||||
b_queue_push_back(&state->s_operator_stack, &node->n_entry);
|
b_queue_push_back(&state->s_operator_stack, &node->n_entry);
|
||||||
}
|
print_expr_queues(state);
|
||||||
|
|
||||||
static void print_expr_queues(struct expr_parser_state *state)
|
|
||||||
{
|
|
||||||
b_queue_iterator it = {0};
|
|
||||||
|
|
||||||
printf("operators:");
|
|
||||||
b_queue_foreach (&it, &state->s_operator_stack) {
|
|
||||||
struct ivy_ast_node *n
|
|
||||||
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
|
||||||
fputc(' ', stdout);
|
|
||||||
print_operand(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\noperands:");
|
|
||||||
b_queue_foreach (&it, &state->s_output_queue) {
|
|
||||||
struct ivy_ast_node *n
|
|
||||||
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
|
||||||
fputc(' ', stdout);
|
|
||||||
print_operand(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool op_node_is_complete(struct ivy_ast_op_node *node)
|
static bool op_node_is_complete(struct ivy_ast_op_node *node)
|
||||||
@@ -517,7 +518,8 @@ static struct token_parse_result parse_ident(
|
|||||||
|
|
||||||
struct token_parse_result result;
|
struct token_parse_result result;
|
||||||
|
|
||||||
if (state->s_prev_component == EXPR_CMP_OPERAND) {
|
if (state->s_prev_component == EXPR_CMP_OPERAND
|
||||||
|
|| state->s_prev_component == EXPR_CMP_MSG) {
|
||||||
result = parse_operator(ctx, tok);
|
result = parse_operator(ctx, tok);
|
||||||
state->s_prev_component = EXPR_CMP_MSG;
|
state->s_prev_component = EXPR_CMP_MSG;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user