[bugfix] is_quote family don't stop when circular object is given
This commit is contained in:
parent
3a8aa3e728
commit
ceef33af8a
12
src/write.c
12
src/write.c
|
@ -13,32 +13,28 @@ static void write(pic_state *, pic_value, XFILE *file);
|
||||||
static bool
|
static bool
|
||||||
is_quote(pic_state *pic, pic_value pair)
|
is_quote(pic_state *pic, pic_value pair)
|
||||||
{
|
{
|
||||||
return pic_list_p(pic, pair)
|
return pic_nil_p(pic_cddr(pic, pair))
|
||||||
&& pic_length(pic, pair) == 2
|
|
||||||
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sQUOTE));
|
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sQUOTE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_unquote(pic_state *pic, pic_value pair)
|
is_unquote(pic_state *pic, pic_value pair)
|
||||||
{
|
{
|
||||||
return pic_list_p(pic, pair)
|
return pic_nil_p(pic_cddr(pic, pair))
|
||||||
&& pic_length(pic, pair) == 2
|
|
||||||
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sUNQUOTE));
|
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sUNQUOTE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_unquote_splicing(pic_state *pic, pic_value pair)
|
is_unquote_splicing(pic_state *pic, pic_value pair)
|
||||||
{
|
{
|
||||||
return pic_list_p(pic, pair)
|
return pic_nil_p(pic_cddr(pic, pair))
|
||||||
&& pic_length(pic, pair) == 2
|
|
||||||
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sUNQUOTE_SPLICING));
|
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sUNQUOTE_SPLICING));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_quasiquote(pic_state *pic, pic_value pair)
|
is_quasiquote(pic_state *pic, pic_value pair)
|
||||||
{
|
{
|
||||||
return pic_list_p(pic, pair)
|
return pic_nil_p(pic_cddr(pic, pair))
|
||||||
&& pic_length(pic, pair) == 2
|
|
||||||
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sQUASIQUOTE));
|
&& pic_eq_p(pic_car(pic, pair), pic_symbol_value(pic->sQUASIQUOTE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue