Commit b8953c3fe79de90c0f9723e646e5a5a2d908a3e3

Thomas de Grivel 2022-12-06T22:40:53

wip buf_parse_call_args_paren

diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index 7392d05..86d96d6 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -63,7 +63,7 @@ sw buf_parse_call (s_buf *buf, s_call *dest)
   if ((r = buf_parse_ident(buf, &dest->ident)) <= 0)
     goto clean;
   result += r;
-  if ((r = buf_parse_call_args(buf, dest)) <= 0)
+  if ((r = buf_parse_call_args_paren(buf, dest)) <= 0)
     goto restore;
   result += r;
   r = result;
@@ -75,18 +75,19 @@ sw buf_parse_call (s_buf *buf, s_call *dest)
   return r;
 }
 
-sw buf_parse_call_args (s_buf *buf, s_call *dest)
+sw buf_parse_call_args_paren (s_buf *buf, s_call *dest)
 {
   s_list **args;
   sw r;
   sw result = 0;
   s_buf_save save;
+  s_tag tag;
   assert(buf);
   assert(dest);
   buf_save_init(buf, &save);
   if ((r = buf_read_1(buf, "(")) <= 0)
     goto clean;
-  args = &dest->args;
+  args = &dest->arguments;
   *args = NULL;
   result += r;
   if ((r = buf_parse_comments(buf)) < 0)
@@ -104,7 +105,7 @@ sw buf_parse_call_args (s_buf *buf, s_call *dest)
   }
   while (1) {
     *args = list_new();
-    if ((r = buf_parse_tag(buf, &(*args)->tag)) <= 0)
+    if ((r = buf_parse_tag(buf, &tag)) <= 0)
       goto restore;
     result += r;
     if ((r = buf_parse_comments(buf)) < 0)
@@ -152,7 +153,7 @@ sw buf_parse_call_args (s_buf *buf, s_call *dest)
       if ((r = buf_ignore_spaces(buf)) < 0)
         goto restore;
       result += r;
-      if ((r = buf_read_1(buf, "]")) <= 0)
+      if ((r = buf_read_1(buf, ")")) <= 0)
         goto restore;
       result += r;
       r = result;
diff --git a/libc3/buf_parse.h b/libc3/buf_parse.h
index d3c69c7..baaf11f 100644
--- a/libc3/buf_parse.h
+++ b/libc3/buf_parse.h
@@ -44,7 +44,7 @@ sw buf_parse_fn (s_buf *buf, s_fn *dest);
 sw buf_parse_fn_algo (s_buf *buf, s_list **dest);
 sw buf_parse_fn_args (s_buf *buf, s_arg **dest);
 sw buf_parse_call (s_buf *buf, s_call *dest);
-sw buf_parse_call_args (s_buf *buf, s_list **dest);
+sw buf_parse_call_args_paren (s_buf *buf, s_call *dest);
 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);