Commit 77062d22fabf826a82fc929d7905f99e4685a5d9

Thomas de Grivel 2024-02-02T11:09:17

quote unquote

diff --git a/ic3/.ic3_history b/ic3/.ic3_history
index d5456cd..cdbbd1b 100644
--- a/ic3/.ic3_history
+++ b/ic3/.ic3_history
@@ -37,3 +37,6 @@ type(0x193a838c800)
 "abc#{1}"
 hello = fn (name) { "Hello, #{name} !" }
 hello("Thomas")
+quote "abc"
+quote "abc #{unquote name} !"
+quote "abc #{name} !"
diff --git a/libc3/array.c b/libc3/array.c
index 33c7a12..70775cc 100644
--- a/libc3/array.c
+++ b/libc3/array.c
@@ -261,7 +261,7 @@ s_array * array_init_cast (s_array *array, const s_tag *tag)
 s_array * array_init_copy_shallow (s_array *array, const s_array *src)
 {
   s_array tmp = {0};
-  assert(a);
+  assert(array);
   assert(src);
   tmp.array_type   = src->array_type;
   tmp.count        = src->count;
diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index 5528aca..43345ec 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -351,6 +351,7 @@ sw buf_inspect_call_op (s_buf *buf, const s_call *call, s8 op_precedence)
   sw result = 0;
   s_tag *right;
   left = &call->arguments->tag;
+  assert(list_next(call->arguments));
   right = &list_next(call->arguments)->tag;
   if (left->type == TAG_CALL &&
       operator_find(&left->data.call.ident) &&
diff --git a/libc3/env.c b/libc3/env.c
index a3d1bb1..ea6a355 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -805,24 +805,6 @@ bool env_eval_quote_quote (s_env *env, const s_quote *quote, s_tag *dest)
   return true;
 }
 
-bool env_eval_quote_str (s_env *env, const s_str *str, s_tag *dest)
-{
-  bool r = true;
-  s_tag tmp;
-  if (! str_parse_eval(str, &tmp)) {
-    err_puts("env_eval_str: invalid Str");
-    assert(! "env_eval_str: invalid Str");
-    return false;
-  }
-  if (tmp.type == TAG_STR) {
-    *dest = tmp;
-    return true;
-  }
-  r = env_eval_quote_tag(env, &tmp, dest);
-  tag_clean(&tmp);
-  return r;
-}
-
 bool env_eval_quote_struct (s_env *env, const s_struct *s, s_tag *dest)
 {
   uw i;
@@ -876,8 +858,6 @@ bool env_eval_quote_tag (s_env *env, const s_tag *tag, s_tag *dest)
     return env_eval_quote_map(env, &tag->data.map, dest);
   case TAG_QUOTE:
     return env_eval_quote_quote(env, &tag->data.quote, dest);
-  case TAG_STR:
-    return env_eval_quote_str(env, &tag->data.str, dest);
   case TAG_STRUCT:
     return env_eval_quote_struct(env, &tag->data.struct_, dest);
   case TAG_TUPLE:
@@ -902,8 +882,9 @@ bool env_eval_quote_tag (s_env *env, const s_tag *tag, s_tag *dest)
   case TAG_S16:
   case TAG_S32:
   case TAG_S64:
-  case TAG_SW:
+  case TAG_STR:
   case TAG_STRUCT_TYPE:
+  case TAG_SW:
   case TAG_SYM:
   case TAG_U8:
   case TAG_U16:
diff --git a/libc3/env.h b/libc3/env.h
index c9011e2..948e071 100644
--- a/libc3/env.h
+++ b/libc3/env.h
@@ -67,8 +67,6 @@ bool          env_eval_quote_map (s_env *env, const s_map *map,
                                   s_tag *dest);
 bool          env_eval_quote_quote (s_env *env, const s_quote *quote,
                                     s_tag *dest);
-bool          env_eval_quote_str (s_env *env, const s_str *str,
-                                  s_tag *dest);
 bool          env_eval_quote_struct (s_env *env, const s_struct *s,
                                      s_tag *dest);
 bool          env_eval_quote_tag (s_env *env, const s_tag *tag,