diff --git a/client/main.c b/client/main.c index d126b67d..d3400522 100644 --- a/client/main.c +++ b/client/main.c @@ -159,6 +159,9 @@ static void runfile(const uint8_t *src, int32_t len) { case DST_PARSE_ERROR: dst_puts(dst_formatc("syntax error at %d: %S\n", s - src + res.bytes_read + 1, res.error)); + if (res.bytes_read == 0) { + s++; + } break; case DST_PARSE_OK: { diff --git a/core/parse.c b/core/parse.c index daa0ecd0..13be3ee4 100644 --- a/core/parse.c +++ b/core/parse.c @@ -79,6 +79,7 @@ static int is_symbol_char_gen(uint8_t c) { c == '/' || c == ':' || c == '<' || + c == '?' || c == '=' || c == '>' || c == '@' || @@ -94,7 +95,7 @@ if the corresponding ascci code is a symbol char, and 0 if not. The upper characters are also considered symbol chars and are then checked for utf-8 compliance. */ static uint32_t symchars[8] = { - 0x00000000, 0x77ffec72, 0xd7ffffff, 0x57fffffe, + 0x00000000, 0xF7ffec72, 0xd7ffffff, 0x57fffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; diff --git a/dsttest/suite0.dst b/dsttest/suite0.dst index 4b0ab2a0..0e1777ba 100644 --- a/dsttest/suite0.dst +++ b/dsttest/suite0.dst @@ -178,6 +178,35 @@ (assert (= (string "🐼" 🦊 🐮) "🐼foxcow") "emojis 🙉 :)") (assert (not= 🦊 :🦊) "utf8 strings are not symbols and vice versa") +# Merge sort + +(def empty? (fn [xs] (= 0 (length xs)))) + +(def merge (fn [xs ys] + (def ret []) + (def xlen (length xs)) + (def ylen (length ys)) + (var i 0) + (var j 0) + # Main merge + (while (if (< i xlen) (< j ylen)) + (def xi (get xs i)) + (def yj (get ys j)) + (if (< xi yj) + (do (push ret xi) (varset! i (+ i 1))) + (do (push ret yj) (varset! j (+ j 1))))) + # Push rest of xs + (while (< i xlen) + (def xi (get xs i)) + (push ret xi) + (varset! i (+ i 1))) + # Push rest of ys + (while (< j ylen) + (def yj (get ys j)) + (push ret yj) + (varset! j (+ j 1))) + ret)) + # Gensym tests (assert (not= (gensym) (gensym)) "two gensyms not equal")