Commit dcc39a39fe355987dfaa225b93d46258e56d0b08

Thomas de Grivel 2023-03-13T07:07:04

wip

diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index 67683be..b9393fe 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -178,12 +178,11 @@ sw buf_parse_call_op (s_buf *buf, s_call *dest)
   sw r;
   sw result = 0;
   s_buf_save save;
-  s_tag tag;
   assert(buf);
   assert(dest);
   buf_save_init(buf, &save);
   call_init_op(&tmp);
-  if ((r = buf_parse_tag_primary(buf, &tmp->arguments->tag)) <= 0)
+  if ((r = buf_parse_tag_primary(buf, &tmp.arguments->tag)) <= 0)
     goto restore;
   result += r;
   if ((r = buf_ignore_spaces(buf)) < 0)
@@ -203,7 +202,7 @@ sw buf_parse_call_op (s_buf *buf, s_call *dest)
   return r;
 }
 
-sw buf_parse_call_op_rec (s_buf *buf, s_call *tmp, u8 min_precedence)
+sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, u8 min_precedence)
 {
   s_tag *new_left = NULL;
   s_ident next_op;
@@ -216,6 +215,7 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *tmp, u8 min_precedence)
   s_tag *right_first = NULL;
   s_tag *right_left = NULL;
   s_buf_save save;
+  s_call tmp;
   assert(buf);
   assert(dest);
   buf_save_init(buf, &save);
@@ -227,7 +227,7 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *tmp, u8 min_precedence)
     if ((r = buf_ignore_spaces(buf)) < 0)
       goto restore;
     op = next_op;
-    right = right_first = tag_new();
+    right = tag_new();
     if ((r = buf_parse_tag_primary(buf, right)) <= 0)
       goto restore;
     result += r;
@@ -246,7 +246,7 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *tmp, u8 min_precedence)
       right_left = right;
       right = tag_new();
       if ((r = buf_parse_call_op_rec(buf, &right->data.call,
-                                     right_left, op_precedence)) <= 0)
+                                     op_precedence)) <= 0)
         goto restore;
       free(right_left);
       result += r;
diff --git a/libc3/buf_parse.h b/libc3/buf_parse.h
index fc37050..bdd6206 100644
--- a/libc3/buf_parse.h
+++ b/libc3/buf_parse.h
@@ -32,8 +32,13 @@
  */
 
 sw buf_parse_bool (s_buf *buf, bool *dest);
+sw buf_parse_call (s_buf *buf, s_call *dest);
+sw buf_parse_call_args_paren (s_buf *buf, s_call *dest);
+sw buf_parse_call_op (s_buf *buf, s_call *dest);
+sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, u8 min_precedence);
 sw buf_parse_cfn (s_buf *buf, s_cfn *dest);
 sw buf_parse_character (s_buf *buf, character *dest);
+sw buf_parse_comments (s_buf *buf);
 sw buf_parse_digit_bin(s_buf *buf, u8 *dest);
 sw buf_parse_digit_hex (s_buf *buf, u8 *dest);
 sw buf_parse_digit_oct (s_buf *buf, u8 *dest);
@@ -45,12 +50,6 @@ sw buf_parse_fn (s_buf *buf, s_fn **dest);
 sw buf_parse_fn_clause (s_buf *buf, s_fn *dest);
 sw buf_parse_fn_algo (s_buf *buf, s_list **dest);
 sw buf_parse_fn_pattern (s_buf *buf, s_list **dest);
-sw buf_parse_call (s_buf *buf, s_call *dest);
-sw buf_parse_call_args_paren (s_buf *buf, s_call *dest);
-sw buf_parse_call_op (s_buf *buf, s_call *dest);
-sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, s_tag *left,
-                          u8 min_precedence);
-sw buf_parse_comments (s_buf *buf);
 sw buf_parse_integer (s_buf *buf, s_integer *dest);
 sw buf_parse_integer_unsigned_bin (s_buf *buf, s_integer *dest);
 sw buf_parse_integer_unsigned_dec (s_buf *buf, s_integer *dest);