diff options
| author | WormHeamer | 2025-08-02 03:54:21 -0400 |
|---|---|---|
| committer | WormHeamer | 2025-08-02 03:54:21 -0400 |
| commit | dbfb6ab16c6ff83291b9401a0432d814f9c6fda0 (patch) | |
| tree | 0ce6272b4b4749f7b94e74fd08950ba9bbb250e4 /main.c | |
| parent | 70e5f31e4d5fa050447bb81b64f9573d421187e0 (diff) | |
bunch of stuff to make error messages look more like gcc lol
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 17 |
1 files changed, 2 insertions, 15 deletions
@@ -227,7 +227,6 @@ static inline int node_op_communative(NodeType t) { /* needs lexer for error reporting */ Node *node_peephole(Node *n, Proc *p, Lexer *l) { - return n; /* * Is there a method to convey these transformations a little more nicely? * @@ -253,7 +252,7 @@ Node *node_peephole(Node *n, Proc *p, Lexer *l) { case N_OP_MUL: r = node_new_lit_i64(p, in[0]->lit.i * in[1]->lit.i); break; case N_OP_DIV: if (in[1]->lit.i == 0) { - lex_error_at(l, n->src_pos, LE_ERROR, S("Division by zero")); + lex_error_at(l, in[1]->src_pos, LE_ERROR, S("divisor always evaluates to zero")); } r = node_new_lit_i64(p, in[0]->lit.i / in[1]->lit.i); break; @@ -364,21 +363,9 @@ Node *parse_term(Lexer *l, Proc *p) { return node_peephole(node, p, l); } +/* TODO: operator precedence would be kinda nice actually, sad to say */ Node *parse_expr(Lexer *l, Proc *p) { Node *lhs = parse_term(l, p); - if (l->tok == TOK_LPAREN) { - lex_next(l); - puts("args_start"); - for (;;) { - parse_expr(l, p); - lex_expected(l, TM_COMMA | TM_RPAREN); - if (l->tok == TOK_RPAREN) break; - lex_next(l); - } - lex_next(l); - puts("args_end"); - puts("func_call"); - } if (TMASK(l->tok) & (TM_PLUS | TM_MINUS | TM_ASTERISK | TM_SLASH | TM_NOT | TM_AND | TM_XOR | TM_OR)) { Token t = l->tok; lex_next(l); |
