diff options
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); |
