shithub: femtolisp

Download patch

ref: 7b7d22126219a215b941b4b40fe05ac90a46a0ed
parent: 547836a03d5d3cd2dc0d7459edafeb4c6d677415
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Dec 1 08:31:10 EST 2024

do_read_sexpr: move unexpected cases down

--- a/read.c
+++ b/read.c
@@ -591,14 +591,6 @@
 		PUSH(FL(Nil));
 		read_list(ctx, &FL(stack)[FL(sp)-1], label, TOK_CLOSEC);
 		return POP();
-	case TOK_CLOSE:
-		parse_error("unexpected ')'");
-	case TOK_CLOSEB:
-		parse_error("unexpected ']'");
-	case TOK_CLOSEC:
-		parse_error("unexpected '}'");
-	case TOK_DOT:
-		parse_error("unexpected '.'");
 	case TOK_COMMA:
 		head = &FL(comma); goto listwith;
 	case TOK_COMMAAT:
@@ -684,6 +676,14 @@
 		return *pv;
 	case TOK_DOUBLEQUOTE:
 		return read_string(ctx);
+	case TOK_CLOSE:
+		parse_error("unexpected ')'");
+	case TOK_CLOSEB:
+		parse_error("unexpected ']'");
+	case TOK_CLOSEC:
+		parse_error("unexpected '}'");
+	case TOK_DOT:
+		parse_error("unexpected '.'");
 	}
 	return FL(unspecified);
 }