diff --git a/ikc3/.ikc3_history b/ikc3/.ikc3_history
index 7b40b56..bed1738 100644
--- a/ikc3/.ikc3_history
+++ b/ikc3/.ikc3_history
@@ -1,4 +1,3 @@
-Facts.with(Facts.env_facts(), quote [[KC3, :operator, ^ op], [^ op, :symbol_value, value]], fn (fact) { puts(op); 1 })
op = ?
Facts.with(Facts.env_facts(), quote [[KC3, :operator, ^ op], [^ op, :symbol_value, value]], fn (fact) { puts(op); 1 })
op = ?
@@ -97,3 +96,4 @@ a = ? <- 1 ; 2
quote a = ? <- 1 ; 2
KC3.Operator.find(:xxx)
KC3.Operator.find(:+)
+quote 1 + 20 / 3 * 4 - 5
diff --git a/libkc3/buf_parse.c b/libkc3/buf_parse.c
index 00e0433..f8f235d 100644
--- a/libkc3/buf_parse.c
+++ b/libkc3/buf_parse.c
@@ -944,17 +944,18 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, sw min_precedence)
if ((r = buf_peek_ident(buf, &next_op)) <= 0)
goto restore;
if (! operator_resolve(&next_op, 2, &next_op) ||
- ! operator_precedence(&next_op, &op_precedence)) {
+ ! operator_precedence(&next_op, &next_op_precedence)) {
r = 0;
goto restore;
}
- while (r > 0 && op_precedence >= min_precedence) {
+ while (r > 0 && next_op_precedence >= min_precedence) {
if ((r = buf_parse_ident(buf, &next_op)) <= 0)
goto restore;
result += r;
if (! operator_resolve(&next_op, 2, &next_op))
goto restore;
op = next_op;
+ op_precedence = next_op_precedence;
tmp.ident = op;
if ((r = buf_ignore_spaces(buf)) < 0)
goto restore;
@@ -982,9 +983,10 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, sw min_precedence)
break;
if (next_op_precedence <= op_precedence) {
if (! operator_is_right_associative(&next_op, &b))
- goto ok;
- if (! b ||
- next_op_precedence != op_precedence)
+ goto restore;
+ if (! b)
+ break;
+ if (next_op_precedence != op_precedence)
break;
}
call_init_op(&tmp2);
@@ -1004,17 +1006,14 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, sw min_precedence)
result += r;
if ((r = buf_peek_character_utf8(buf, &c)) <= 0)
goto ok;
- if (r > 0 && c == '\n') {
+ if (r > 0 && c == '\n')
goto ok;
- }
r = buf_peek_ident(buf, &next_op);
if (r <= 0 ||
(! operator_resolve(&next_op, 2, &next_op) ||
! operator_precedence(&next_op, &next_op_precedence)))
goto ok;
}
- if (r <= 0)
- goto ok;
call_init_op(&tmp3);
tmp3.ident = op;
tmp3.arguments->tag = *left;
@@ -3684,9 +3683,9 @@ sw buf_parse_tag (s_buf *buf, s_tag *dest)
goto end;
goto restore;
default:
- if ((r = buf_parse_tag_special_operator(buf, dest)) != 0 ||
- (r = buf_parse_tag_call_op(buf, dest)) != 0 ||
- (r = buf_parse_tag_primary(buf, dest)) != 0)
+ if ((r = buf_parse_tag_special_operator(buf, dest)) ||
+ (r = buf_parse_tag_call_op(buf, dest)) ||
+ (r = buf_parse_tag_primary(buf, dest)))
goto end;
}
goto restore;
diff --git a/test/ikc3/to_lisp.kc3 b/test/ikc3/to_lisp.kc3
index aae2ea6..5ee84da 100644
--- a/test/ikc3/to_lisp.kc3
+++ b/test/ikc3/to_lisp.kc3
@@ -1,5 +1,4 @@
quote (a = ? <- 1 ; 2)
-quote to_lisp(quote (a = ? <- 1 ; 2))
-to_lisp(quote (a = ? <- 1 ; 2))
+quote a = ? <- 1; 2
quote to_lisp(quote a = ? <- 1 ; 2)
to_lisp(quote a = ? <- 1 ; 2)
diff --git a/test/ikc3/to_lisp.out.expected b/test/ikc3/to_lisp.out.expected
index e834640..5301bd2 100644
--- a/test/ikc3/to_lisp.out.expected
+++ b/test/ikc3/to_lisp.out.expected
@@ -1,5 +1,4 @@
(a = ? <- 1 ; 2)
-to_lisp(quote (a = ? <- 1 ; 2))
-[operator_paren [operator_semicolumn, [operator_equal, a, [operator_assign ?, 1]], 2]]
+a = ? <- 1 ; 2
to_lisp(quote a = ? <- 1 ; 2)
-[operator_semicolumn, [operator_equal, a, [operator_assign ?, 1]], 2]
+[operator_semicolumn, [operator_equal, a, [operator_assign, ?, 1]], 2]