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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user