summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-08-06 18:24:28 +0100
committerubq323 <ubq323@ubq323.website>2024-08-06 18:24:28 +0100
commita701883f4ea83022261304d225eb8225af52b302 (patch)
treed95127abc4cfa953653bdc550ebada0061678d16
parent0cc8e1fd89aacd54926b61ac3b9c4a2810024b4a (diff)
fix failing tests
-rw-r--r--com.c11
-rw-r--r--read.c2
-rw-r--r--state.h1
3 files changed, 10 insertions, 4 deletions
diff --git a/com.c b/com.c
index 3b2260d..57e600c 100644
--- a/com.c
+++ b/com.c
@@ -619,10 +619,10 @@ static void cpl_expr(Compiler *C, Val v, int flags) {
if (form) {
size_t nargs = len - 1;
if (form->ellipsis)
- CHECK(nargs >= form->min_params, "%s requires at least %d args",
+ CHECK(nargs >= form->min_params, "%s requires at least %d parameters",
form->name, form->min_params);
else
- CHECK(nargs == form->min_params, "%s requires exactly %d args",
+ CHECK(nargs == form->min_params, "%s requires exactly %d parameters",
form->name, form->min_params);
form->action(C, a, form->op, flags);
} else {
@@ -654,6 +654,7 @@ int main(int argc, char **argv) {
S->do_disasm = false;
S->do_trace = false;
+ S->do_dumpsexpr = false;
char *infile_names[16];
int infile_name_n = 0;
@@ -669,6 +670,7 @@ int main(int argc, char **argv) {
switch (argv[i][2]) {
case 'l': S->do_disasm = true; break;
case 't': S->do_trace = true; break;
+ case 's': S->do_dumpsexpr = true; break;
default: ERROR("unknown option b");
}
break;
@@ -699,9 +701,12 @@ int main(int argc, char **argv) {
fread(buf, 1, 8192, infile);
buf[8192] = '\0';
ObjArr *top = read_exprs(S, buf);
+
+ if (S->do_dumpsexpr)
+ println_val(VAL_OBJ(top));
+
cpl_body(&com, top, 0, 0);
- // println_val(VAL_OBJ(top));
// pcc_destroy(parser);
// compile_body(&com, top.as.list, 0, 0);
diff --git a/read.c b/read.c
index b3fc5a3..5b3f43e 100644
--- a/read.c
+++ b/read.c
@@ -18,7 +18,7 @@ static bool is_ws(char x) { return x == ' ' || x == '\t' || x == '\n';}
static bool is_num(char x) { return '0' <= x && x <= '9'; }
static bool is_special(char x) {
switch(x) {
- case '(': case ')': case '[': case ']': case '\'': case '"':
+ case '(': case ')': case '[': case ']': case '"':
return true; break;
default: return false; break;
}
diff --git a/state.h b/state.h
index 762d519..b59e4d5 100644
--- a/state.h
+++ b/state.h
@@ -13,6 +13,7 @@ struct _state {
bool do_disasm;
bool do_trace;
+ bool do_dumpsexpr;
};
State state_new();