lang: fix lots of compiler warnings/errors
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
#include "ctx.h"
|
#include "ctx.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
static void print(struct ivy_ast_node *node)
|
static void print(struct ivy_ast_node *node)
|
||||||
{
|
{
|
||||||
struct ivy_ast_double_node *v = (struct ivy_ast_double_node *)node;
|
struct ivy_ast_double_node *v = (struct ivy_ast_double_node *)node;
|
||||||
|
|
||||||
printf("%s (%.2lf)\n", ivy_ast_node_type_to_string(node->n_type), v->n_value->t_double);
|
printf("%s (%.2lf)\n", ivy_ast_node_type_to_string(node->n_type),
|
||||||
|
v->n_value->t_double);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ast_node_type double_node_ops = {
|
struct ast_node_type double_node_ops = {
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ static void print_operand(struct ivy_ast_node *node)
|
|||||||
{
|
{
|
||||||
switch (node->n_type) {
|
switch (node->n_type) {
|
||||||
case IVY_AST_IDENT: {
|
case IVY_AST_IDENT: {
|
||||||
struct ivy_ast_ident_node *ident = (struct ivy_ast_ident_node *)node;
|
struct ivy_ast_ident_node *ident
|
||||||
|
= (struct ivy_ast_ident_node *)node;
|
||||||
printf("%s", ident->n_content->t_str);
|
printf("%s", ident->n_content->t_str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -100,7 +101,8 @@ static void print_operand(struct ivy_ast_node *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum ivy_status finalise_expr(struct expr_parser_state *state, struct ivy_ast_node **root)
|
static enum ivy_status finalise_expr(
|
||||||
|
struct expr_parser_state *state, struct ivy_ast_node **root)
|
||||||
{
|
{
|
||||||
b_queue_iterator it = {0};
|
b_queue_iterator it = {0};
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -109,7 +111,8 @@ static enum ivy_status finalise_expr(struct expr_parser_state *state, struct ivy
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ivy_ast_node *node = b_unbox(struct ivy_ast_node, entry, n_entry);
|
struct ivy_ast_node *node
|
||||||
|
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
/* this should never happen */
|
/* this should never happen */
|
||||||
return IVY_ERR_INTERNAL_FAILURE;
|
return IVY_ERR_INTERNAL_FAILURE;
|
||||||
@@ -149,9 +152,11 @@ static enum ivy_status finalise_expr(struct expr_parser_state *state, struct ivy
|
|||||||
const struct ivy_operator *op = NULL;
|
const struct ivy_operator *op = NULL;
|
||||||
|
|
||||||
if (item->n_type == IVY_AST_MSG) {
|
if (item->n_type == IVY_AST_MSG) {
|
||||||
struct ivy_ast_msg_node *msg = (struct ivy_ast_msg_node *)item;
|
struct ivy_ast_msg_node *msg
|
||||||
|
= (struct ivy_ast_msg_node *)item;
|
||||||
tmp = b_queue_pop_back(&q);
|
tmp = b_queue_pop_back(&q);
|
||||||
msg->n_recipient = b_unbox(struct ivy_ast_node, tmp, n_entry);
|
msg->n_recipient
|
||||||
|
= b_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||||
b_queue_push_back(&q, &msg->n_base.n_entry);
|
b_queue_push_back(&q, &msg->n_base.n_entry);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -163,7 +168,8 @@ static enum ivy_status finalise_expr(struct expr_parser_state *state, struct ivy
|
|||||||
|
|
||||||
if (op->op_arity == IVY_OP_BINARY) {
|
if (op->op_arity == IVY_OP_BINARY) {
|
||||||
tmp = b_queue_pop_back(&q);
|
tmp = b_queue_pop_back(&q);
|
||||||
op_node->n_left = b_unbox(struct ivy_ast_node, tmp, n_entry);
|
op_node->n_left
|
||||||
|
= b_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
b_queue_push_back(&q, &op_node->n_base.n_entry);
|
b_queue_push_back(&q, &op_node->n_base.n_entry);
|
||||||
@@ -179,19 +185,21 @@ static const struct ivy_operator *get_operator(struct ivy_token *tok)
|
|||||||
{
|
{
|
||||||
switch (tok->t_type) {
|
switch (tok->t_type) {
|
||||||
case IVY_TOK_IDENT:
|
case IVY_TOK_IDENT:
|
||||||
return ivy_operator_get(tok->t_type);
|
return ivy_operator_get_by_token(tok->t_type);
|
||||||
case IVY_TOK_KEYWORD:
|
case IVY_TOK_KEYWORD:
|
||||||
return ivy_operator_get(tok->t_keyword);
|
return ivy_operator_get_by_token(tok->t_keyword);
|
||||||
case IVY_TOK_SYMBOL:
|
case IVY_TOK_SYMBOL:
|
||||||
return ivy_operator_get(tok->t_symbol);
|
return ivy_operator_get_by_token(tok->t_symbol);
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ivy_ast_selector_node *create_unary_selector_from_ident(struct ivy_token *tok)
|
static struct ivy_ast_selector_node *create_unary_selector_from_ident(
|
||||||
|
struct ivy_token *tok)
|
||||||
{
|
{
|
||||||
struct ivy_ast_selector_node *sel = (struct ivy_ast_selector_node *)ast_node_create(IVY_AST_SELECTOR);
|
struct ivy_ast_selector_node *sel
|
||||||
|
= (struct ivy_ast_selector_node *)ast_node_create(IVY_AST_SELECTOR);
|
||||||
if (!sel) {
|
if (!sel) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -203,7 +211,8 @@ static struct ivy_ast_selector_node *create_unary_selector_from_ident(struct ivy
|
|||||||
}
|
}
|
||||||
|
|
||||||
static enum ivy_status push_operator(
|
static enum ivy_status push_operator(
|
||||||
struct expr_parser_state *state, struct ivy_token *tok, const struct ivy_operator *op)
|
struct expr_parser_state *state, struct ivy_token *tok,
|
||||||
|
const struct ivy_operator *op)
|
||||||
{
|
{
|
||||||
if (!op) {
|
if (!op) {
|
||||||
op = get_operator(tok);
|
op = get_operator(tok);
|
||||||
@@ -214,12 +223,11 @@ static enum ivy_status push_operator(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((op->op_location == IVY_OP_INFIX || op->op_location == IVY_OP_POSTFIX)
|
if ((op->op_location == IVY_OP_INFIX || op->op_location == IVY_OP_POSTFIX)
|
||||||
&& state->s_prev_part != EXPR_OPERAND) {
|
&& state->s_prev_part != EXPR_OPERAND) {
|
||||||
return IVY_ERR_BAD_SYNTAX;
|
return IVY_ERR_BAD_SYNTAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op->op_location == IVY_OP_PREFIX
|
if (op->op_location == IVY_OP_PREFIX && state->s_prev_part == EXPR_OPERAND) {
|
||||||
&& state->s_prev_part == EXPR_OPERAND) {
|
|
||||||
return IVY_ERR_BAD_SYNTAX;
|
return IVY_ERR_BAD_SYNTAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,11 +243,12 @@ static enum ivy_status push_operator(
|
|||||||
|
|
||||||
const struct ivy_operator *top_op = NULL;
|
const struct ivy_operator *top_op = NULL;
|
||||||
if (top->n_type == IVY_AST_OP) {
|
if (top->n_type == IVY_AST_OP) {
|
||||||
struct ivy_ast_op_node *op_node = (struct ivy_ast_op_node *)top;
|
struct ivy_ast_op_node *op_node
|
||||||
|
= (struct ivy_ast_op_node *)top;
|
||||||
top_op = op_node->n_op;
|
top_op = op_node->n_op;
|
||||||
} else if (top->n_type == IVY_AST_MSG) {
|
} else if (top->n_type == IVY_AST_MSG) {
|
||||||
top_op = ivy_operator_get(IVY_TOK_IDENT);
|
top_op = ivy_operator_get_by_token(IVY_TOK_IDENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top_op->op_id == IVY_OP_LEFT_PAREN) {
|
if (top_op->op_id == IVY_OP_LEFT_PAREN) {
|
||||||
break;
|
break;
|
||||||
@@ -259,19 +268,22 @@ static enum ivy_status push_operator(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tok->t_type == IVY_TOK_IDENT) {
|
if (tok->t_type == IVY_TOK_IDENT) {
|
||||||
struct ivy_ast_msg_node *msg_node = (struct ivy_ast_msg_node *)ast_node_create(IVY_AST_MSG);
|
struct ivy_ast_msg_node *msg_node
|
||||||
|
= (struct ivy_ast_msg_node *)ast_node_create(IVY_AST_MSG);
|
||||||
msg_node->n_sel = create_unary_selector_from_ident(tok);
|
msg_node->n_sel = create_unary_selector_from_ident(tok);
|
||||||
b_queue_push_back(&state->s_operator_stack, &msg_node->n_base.n_entry);
|
b_queue_push_back(
|
||||||
|
&state->s_operator_stack, &msg_node->n_base.n_entry);
|
||||||
} else {
|
} else {
|
||||||
struct ivy_ast_op_node *op_node = (struct ivy_ast_op_node *)ast_node_create(IVY_AST_OP);
|
struct ivy_ast_op_node *op_node
|
||||||
|
= (struct ivy_ast_op_node *)ast_node_create(IVY_AST_OP);
|
||||||
op_node->n_op = op;
|
op_node->n_op = op;
|
||||||
b_queue_push_back(&state->s_operator_stack, &op_node->n_base.n_entry);
|
b_queue_push_back(
|
||||||
|
&state->s_operator_stack, &op_node->n_base.n_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return IVY_OK;
|
return IVY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static enum ivy_status push_operand(
|
static enum ivy_status push_operand(
|
||||||
struct expr_parser_state *state, struct ivy_token *tok)
|
struct expr_parser_state *state, struct ivy_token *tok)
|
||||||
{
|
{
|
||||||
@@ -279,25 +291,32 @@ static enum ivy_status push_operand(
|
|||||||
|
|
||||||
switch (tok->t_type) {
|
switch (tok->t_type) {
|
||||||
case IVY_TOK_INT: {
|
case IVY_TOK_INT: {
|
||||||
struct ivy_ast_int_node *v = (struct ivy_ast_int_node *)ast_node_create(IVY_AST_INT);
|
struct ivy_ast_int_node *v
|
||||||
|
= (struct ivy_ast_int_node *)ast_node_create(IVY_AST_INT);
|
||||||
v->n_value = tok;
|
v->n_value = tok;
|
||||||
node = (struct ivy_ast_node *)v;
|
node = (struct ivy_ast_node *)v;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IVY_TOK_DOUBLE: {
|
case IVY_TOK_DOUBLE: {
|
||||||
struct ivy_ast_double_node *v = (struct ivy_ast_double_node *)ast_node_create(IVY_AST_DOUBLE);
|
struct ivy_ast_double_node *v
|
||||||
|
= (struct ivy_ast_double_node *)ast_node_create(
|
||||||
|
IVY_AST_DOUBLE);
|
||||||
v->n_value = tok;
|
v->n_value = tok;
|
||||||
node = (struct ivy_ast_node *)v;
|
node = (struct ivy_ast_node *)v;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IVY_TOK_STRING: {
|
case IVY_TOK_STRING: {
|
||||||
struct ivy_ast_string_node *v = (struct ivy_ast_string_node *)ast_node_create(IVY_AST_STRING);
|
struct ivy_ast_string_node *v
|
||||||
|
= (struct ivy_ast_string_node *)ast_node_create(
|
||||||
|
IVY_AST_STRING);
|
||||||
v->n_value = tok;
|
v->n_value = tok;
|
||||||
node = (struct ivy_ast_node *)v;
|
node = (struct ivy_ast_node *)v;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IVY_TOK_IDENT: {
|
case IVY_TOK_IDENT: {
|
||||||
struct ivy_ast_ident_node *v = (struct ivy_ast_ident_node *)ast_node_create(IVY_AST_IDENT);
|
struct ivy_ast_ident_node *v
|
||||||
|
= (struct ivy_ast_ident_node *)ast_node_create(
|
||||||
|
IVY_AST_IDENT);
|
||||||
v->n_content = tok;
|
v->n_content = tok;
|
||||||
node = (struct ivy_ast_node *)v;
|
node = (struct ivy_ast_node *)v;
|
||||||
break;
|
break;
|
||||||
@@ -325,7 +344,7 @@ static struct token_parse_result parse_ident(
|
|||||||
} else {
|
} else {
|
||||||
push_operand(state, tok);
|
push_operand(state, tok);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_previous(state, tok);
|
set_previous(state, tok);
|
||||||
state->s_prev_part = EXPR_OPERAND;
|
state->s_prev_part = EXPR_OPERAND;
|
||||||
|
|
||||||
@@ -461,8 +480,9 @@ static struct token_parse_result parse_left_paren(
|
|||||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ivy_ast_op_node *paren_node = (struct ivy_ast_op_node *)ast_node_create(IVY_AST_OP);
|
struct ivy_ast_op_node *paren_node
|
||||||
paren_node->n_op = ivy_operator_get(tok->t_symbol);
|
= (struct ivy_ast_op_node *)ast_node_create(IVY_AST_OP);
|
||||||
|
paren_node->n_op = ivy_operator_get_by_token(tok->t_symbol);
|
||||||
b_queue_push_back(&state->s_operator_stack, &paren_node->n_base.n_entry);
|
b_queue_push_back(&state->s_operator_stack, &paren_node->n_base.n_entry);
|
||||||
set_previous(state, tok);
|
set_previous(state, tok);
|
||||||
|
|
||||||
@@ -597,10 +617,10 @@ static struct token_parse_result parse_bang(
|
|||||||
if (state->s_end != EXPR_END_DOT) {
|
if (state->s_end != EXPR_END_DOT) {
|
||||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ivy_ast_node *expr_tree = NULL;
|
struct ivy_ast_node *expr_tree = NULL;
|
||||||
enum ivy_status status = finalise_expr(state, &expr_tree);
|
enum ivy_status status = finalise_expr(state, &expr_tree);
|
||||||
|
|
||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
return PARSE_RESULT(status, 0);
|
return PARSE_RESULT(status, 0);
|
||||||
}
|
}
|
||||||
@@ -622,7 +642,7 @@ static struct token_parse_result parse_dot(
|
|||||||
|
|
||||||
struct ivy_ast_node *expr_tree = NULL;
|
struct ivy_ast_node *expr_tree = NULL;
|
||||||
enum ivy_status status = finalise_expr(state, &expr_tree);
|
enum ivy_status status = finalise_expr(state, &expr_tree);
|
||||||
|
|
||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
return PARSE_RESULT(status, 0);
|
return PARSE_RESULT(status, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
#include "ctx.h"
|
#include "ctx.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
static void print(struct ivy_ast_node *node)
|
static void print(struct ivy_ast_node *node)
|
||||||
{
|
{
|
||||||
struct ivy_ast_ident_node *ident = (struct ivy_ast_ident_node *)node;
|
struct ivy_ast_ident_node *ident = (struct ivy_ast_ident_node *)node;
|
||||||
|
|
||||||
printf("%s (%s)\n", ivy_ast_node_type_to_string(node->n_type), ident->n_content->t_str);
|
printf("%s (%s)\n", ivy_ast_node_type_to_string(node->n_type),
|
||||||
|
ident->n_content->t_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ast_node_type ident_node_ops = {
|
struct ast_node_type ident_node_ops = {
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
#include "ctx.h"
|
#include "ctx.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
static void print(struct ivy_ast_node *node)
|
static void print(struct ivy_ast_node *node)
|
||||||
{
|
{
|
||||||
struct ivy_ast_int_node *v = (struct ivy_ast_int_node *)node;
|
struct ivy_ast_int_node *v = (struct ivy_ast_int_node *)node;
|
||||||
|
|
||||||
printf("%s (%llu)\n", ivy_ast_node_type_to_string(node->n_type), v->n_value->t_int);
|
printf("%s (%llu)\n", ivy_ast_node_type_to_string(node->n_type),
|
||||||
|
v->n_value->t_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ast_node_type int_node_ops = {
|
struct ast_node_type int_node_ops = {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "ctx.h"
|
#include "ctx.h"
|
||||||
|
#include "iterate.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
static void collect_children(
|
static void collect_children(
|
||||||
@@ -11,12 +12,14 @@ static void collect_children(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg->n_sel) {
|
if (msg->n_sel) {
|
||||||
ast_node_iterator_enqueue_node(iterator, node, msg->n_sel);
|
ast_node_iterator_enqueue_node(
|
||||||
|
iterator, node, (struct ivy_ast_node *)msg->n_sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
b_queue_iterator it = {0};
|
b_queue_iterator it = {0};
|
||||||
b_queue_foreach (&it, &msg->n_arg) {
|
b_queue_foreach (&it, &msg->n_arg) {
|
||||||
struct ivy_ast_node *arg = b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
struct ivy_ast_node *arg
|
||||||
|
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||||
ast_node_iterator_enqueue_node(iterator, node, arg);
|
ast_node_iterator_enqueue_node(iterator, node, arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
#include "block.h"
|
||||||
#include "ctx.h"
|
#include "ctx.h"
|
||||||
|
#include "iterate.h"
|
||||||
#include "ivy/status.h"
|
#include "ivy/status.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "block.h"
|
|
||||||
#include "iterate.h"
|
|
||||||
|
|
||||||
#include <blue/object/string.h>
|
#include <blue/object/string.h>
|
||||||
#include <ivy/lang/lex.h>
|
#include <ivy/lang/lex.h>
|
||||||
@@ -37,7 +37,8 @@ static struct token_parse_result parse_linefeed(
|
|||||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct block_parser_state *block_state = (struct block_parser_state *)parser_push_state(ctx, IVY_AST_BLOCK);
|
struct block_parser_state *block_state
|
||||||
|
= (struct block_parser_state *)parser_push_state(ctx, IVY_AST_BLOCK);
|
||||||
block_state->s_terminator = IVY_SYM_BANG;
|
block_state->s_terminator = IVY_SYM_BANG;
|
||||||
|
|
||||||
return PARSE_RESULT(IVY_OK, 0);
|
return PARSE_RESULT(IVY_OK, 0);
|
||||||
@@ -56,7 +57,6 @@ static struct token_parse_result parse_bang(
|
|||||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
parser_pop_state(ctx, STATE_ADD_NODE_TO_PARENT);
|
parser_pop_state(ctx, STATE_ADD_NODE_TO_PARENT);
|
||||||
return PARSE_RESULT(IVY_OK, 0);
|
return PARSE_RESULT(IVY_OK, 0);
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ static void collect_children(
|
|||||||
{
|
{
|
||||||
struct ivy_ast_msgh_node *msgh = (struct ivy_ast_msgh_node *)node;
|
struct ivy_ast_msgh_node *msgh = (struct ivy_ast_msgh_node *)node;
|
||||||
ast_node_iterator_enqueue_node(iterator, node, &msgh->n_sel->n_base);
|
ast_node_iterator_enqueue_node(iterator, node, &msgh->n_sel->n_base);
|
||||||
ast_node_iterator_enqueue_node(iterator, node, &msgh->n_body->n_base);
|
ast_node_iterator_enqueue_node(iterator, node, msgh->n_body);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ast_node_type msgh_node_ops = {
|
struct ast_node_type msgh_node_ops = {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ enum token_expr_type get_token_expr_type(struct ivy_token *tok)
|
|||||||
case IVY_SYM_COMMA:
|
case IVY_SYM_COMMA:
|
||||||
return TOK_EXPR_ANY;
|
return TOK_EXPR_ANY;
|
||||||
default:
|
default:
|
||||||
op = ivy_operator_get(tok->t_symbol);
|
op = ivy_operator_get_by_token(tok->t_symbol);
|
||||||
return op ? TOK_EXPR_ANY : TOK_EXPR_NONE;
|
return op ? TOK_EXPR_ANY : TOK_EXPR_NONE;
|
||||||
}
|
}
|
||||||
case IVY_TOK_KEYWORD:
|
case IVY_TOK_KEYWORD:
|
||||||
@@ -82,7 +82,7 @@ enum token_expr_type get_token_expr_type(struct ivy_token *tok)
|
|||||||
case IVY_KW_THROW:
|
case IVY_KW_THROW:
|
||||||
return TOK_EXPR_BEGIN;
|
return TOK_EXPR_BEGIN;
|
||||||
default:
|
default:
|
||||||
op = ivy_operator_get(tok->t_keyword);
|
op = ivy_operator_get_by_token(tok->t_keyword);
|
||||||
return op ? TOK_EXPR_ANY : TOK_EXPR_NONE;
|
return op ? TOK_EXPR_ANY : TOK_EXPR_NONE;
|
||||||
return TOK_EXPR_NONE;
|
return TOK_EXPR_NONE;
|
||||||
}
|
}
|
||||||
@@ -98,25 +98,31 @@ token_parse_function get_token_parser(
|
|||||||
if (!type) {
|
if (!type) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
token_parse_function generic_parser = type->n_token_parsers[__TOK_PARSER_INDEX(tok->t_type)];
|
token_parse_function generic_parser
|
||||||
|
= type->n_token_parsers[__TOK_PARSER_INDEX(tok->t_type)];
|
||||||
|
|
||||||
if (!generic_parser) {
|
if (!generic_parser) {
|
||||||
generic_parser = type->n_token_parsers[__TOK_PARSER_FALLBACK_INDEX];
|
generic_parser
|
||||||
|
= type->n_token_parsers[__TOK_PARSER_FALLBACK_INDEX];
|
||||||
}
|
}
|
||||||
|
|
||||||
token_parse_function better_parser = NULL;
|
token_parse_function better_parser = NULL;
|
||||||
|
|
||||||
switch (tok->t_type) {
|
switch (tok->t_type) {
|
||||||
case IVY_TOK_KEYWORD:
|
case IVY_TOK_KEYWORD:
|
||||||
better_parser = type->n_keyword_parsers[__KW_PARSER_INDEX(tok->t_keyword)];
|
better_parser
|
||||||
|
= type->n_keyword_parsers[__KW_PARSER_INDEX(tok->t_keyword)];
|
||||||
if (type->n_keyword_parsers[__KW_PARSER_FALLBACK_INDEX]) {
|
if (type->n_keyword_parsers[__KW_PARSER_FALLBACK_INDEX]) {
|
||||||
generic_parser = type->n_keyword_parsers[__KW_PARSER_FALLBACK_INDEX];
|
generic_parser
|
||||||
|
= type->n_keyword_parsers[__KW_PARSER_FALLBACK_INDEX];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IVY_TOK_SYMBOL:
|
case IVY_TOK_SYMBOL:
|
||||||
better_parser = type->n_symbol_parsers[__SYM_PARSER_INDEX(tok->t_symbol)];
|
better_parser
|
||||||
|
= type->n_symbol_parsers[__SYM_PARSER_INDEX(tok->t_symbol)];
|
||||||
if (type->n_symbol_parsers[__SYM_PARSER_FALLBACK_INDEX]) {
|
if (type->n_symbol_parsers[__SYM_PARSER_FALLBACK_INDEX]) {
|
||||||
generic_parser = type->n_symbol_parsers[__SYM_PARSER_FALLBACK_INDEX];
|
generic_parser
|
||||||
|
= type->n_symbol_parsers[__SYM_PARSER_FALLBACK_INDEX];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ struct ivy_ast_msgh_node {
|
|||||||
struct ivy_ast_node n_base;
|
struct ivy_ast_node n_base;
|
||||||
struct ivy_ast_selector_node *n_sel;
|
struct ivy_ast_selector_node *n_sel;
|
||||||
/* expressions to evaluate when lambda is executed. */
|
/* expressions to evaluate when lambda is executed. */
|
||||||
struct ivy_ast_block_node *n_body;
|
struct ivy_ast_node *n_body;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ivy_ast_property_node {
|
struct ivy_ast_property_node {
|
||||||
|
|||||||
Reference in New Issue
Block a user