1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-01 04:19:55 +00:00

Fix parser/insert.

We need to add the tuple wrapping code there as well.
This commit is contained in:
Calvin Rose 2021-02-02 18:55:24 -06:00
parent 259d5fabd9
commit dd117e81c2
2 changed files with 8 additions and 3 deletions

View File

@ -2047,7 +2047,7 @@
(defn bad-compile (defn bad-compile
"Default handler for a compile error." "Default handler for a compile error."
[msg macrof where line col] [msg macrof where &opt line col]
(def ec (dyn :err-color)) (def ec (dyn :err-color))
(eprin (eprin
(if ec "\e[31m" "") (if ec "\e[31m" "")

View File

@ -930,8 +930,13 @@ static Janet cfun_parse_insert(int32_t argc, Janet *argv) {
if (s->flags & PFLAG_COMMENT) s--; if (s->flags & PFLAG_COMMENT) s--;
if (s->flags & PFLAG_CONTAINER) { if (s->flags & PFLAG_CONTAINER) {
s->argn++; s->argn++;
if (p->statecount == 1) p->pending++; if (p->statecount == 1) {
p->pending++;
Janet tup = janet_wrap_tuple(janet_tuple_n(argv + 1, 1));
push_arg(p, tup);
} else {
push_arg(p, argv[1]); push_arg(p, argv[1]);
}
} else if (s->flags & (PFLAG_STRING | PFLAG_LONGSTRING)) { } else if (s->flags & (PFLAG_STRING | PFLAG_LONGSTRING)) {
const uint8_t *str = janet_to_string(argv[1]); const uint8_t *str = janet_to_string(argv[1]);
int32_t slen = janet_string_length(str); int32_t slen = janet_string_length(str);