lang: ast: re-write expression parser to support keyword messages

also adjust some parser state callbackss to better support sub-parsers returning
 results to their parents.
This commit is contained in:
2024-12-02 07:56:27 +00:00
parent 1c73e1d37b
commit 1c5b23d968
11 changed files with 605 additions and 613 deletions

View File

@@ -1,6 +1,6 @@
#include "ctx.h"
#include "node.h"
#include "iterate.h"
#include "node.h"
#include <blue/object/string.h>
#include <ivy/lang/lex.h>
@@ -15,7 +15,8 @@ struct class_parser_state {
int s_prev_token;
};
static struct token_parse_result parse_dollar(struct ivy_parser *ctx, struct ivy_token *tok)
static struct token_parse_result parse_dollar(
struct ivy_parser *ctx, struct ivy_token *tok)
{
struct class_parser_state *state
= parser_get_state(ctx, struct class_parser_state);
@@ -123,9 +124,9 @@ static struct token_parse_result parse_linefeed(
}
static enum ivy_status add_child(
struct ivy_ast_node *parent, struct ivy_ast_node *child)
struct parser_state *state, struct ivy_ast_node *child)
{
struct ivy_ast_class_node *c = (struct ivy_ast_class_node *)parent;
struct ivy_ast_class_node *c = (struct ivy_ast_class_node *)state->s_node;
switch (child->n_type) {
case IVY_AST_MSGH: