mirror of
https://github.com/Noratrieb/calculator.git
synced 2026-01-15 14:15:02 +01:00
this will calculate you
This commit is contained in:
parent
9f525cd2c7
commit
033db1664d
1 changed files with 3 additions and 3 deletions
6
calc.c
6
calc.c
|
|
@ -71,7 +71,6 @@ Expr parse_factor(char *input, size_t *offset) {
|
||||||
const Expr lhs_expr = parse_literal(input, offset);
|
const Expr lhs_expr = parse_literal(input, offset);
|
||||||
|
|
||||||
const char op = input[*offset];
|
const char op = input[*offset];
|
||||||
(*offset)++;
|
|
||||||
|
|
||||||
ExprKind kind;
|
ExprKind kind;
|
||||||
|
|
||||||
|
|
@ -85,10 +84,11 @@ Expr parse_factor(char *input, size_t *offset) {
|
||||||
kind = DIV;
|
kind = DIV;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Invalid operator: %c\n", op);
|
return lhs_expr;
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*offset)++;
|
||||||
|
|
||||||
const Expr rhs_expr = parse_factor(input, offset);
|
const Expr rhs_expr = parse_factor(input, offset);
|
||||||
|
|
||||||
Expr *lhs = malloc(sizeof(Expr));
|
Expr *lhs = malloc(sizeof(Expr));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue