core api redesign
This commit is contained in:
@@ -62,7 +62,7 @@ ast_t *create_ast_binary(parser_t *par, lex_t *pos, ast_t *left, lex_kind_t op,
|
||||
ast_append(result, left);
|
||||
ast_append(result, right);
|
||||
result->integer = op;
|
||||
result->string = s8_serial_simple_lex_kind_t(op);
|
||||
result->string = lex_kind_to_simple_s8(op);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ ast_t *parse_lit_expr(parser_t *par) {
|
||||
parser_expect(par, lex_kind_close_paren);
|
||||
return result;
|
||||
} else {
|
||||
lex_panicf(token, "got invalid token of kind: %S while parsing expression", s8_serial_lex_kind_t(token->kind));
|
||||
lex_panicf(token, "got invalid token of kind: %S while parsing expression", lex_kind_to_s8(token->kind));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ i64 eval_const_expr(ast_t *expr) {
|
||||
case lex_kind_modulo: return left % right;
|
||||
case lex_kind_and: return left && right;
|
||||
case lex_kind_or: return left || right;
|
||||
default: lex_panicf(expr->pos, "unhandled binary operator: %S", s8_serial_lex_kind_t(expr->integer));
|
||||
default: lex_panicf(expr->pos, "unhandled binary operator: %S", lex_kind_to_s8(expr->integer));
|
||||
}
|
||||
} else {
|
||||
ma_temp_t scratch = ma_begin_scratch();
|
||||
@@ -299,7 +299,7 @@ ast_t *parse_table(ma_arena_t *arena, char *file, char *code) {
|
||||
} else if (parser_match(par, lex_kind_bit_or) || parser_match(par, lex_kind_eof)) {
|
||||
break;
|
||||
} else {
|
||||
lex_panicf(par->at, "invalid token: %S", s8_serial_lex_kind_t(par->at->kind));
|
||||
lex_panicf(par->at, "invalid token: %S", lex_kind_to_s8(par->at->kind));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user