aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/stmt.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-10-01 01:04:30 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-10-11 00:14:35 +0200
commit4ce39e4fc1de9536de7dedfe91b6dee38dec76ae (patch)
treef9820f96b8eab624430c3700f32a2878a7036ee2 /src/prc1/stmt.c
parent9140988be4e5bb028b7140aca1a67af1370c72a7 (diff)
downloadprc-4ce39e4fc1de9536de7dedfe91b6dee38dec76ae.tar.gz
WIP sym + cgen
Diffstat (limited to 'src/prc1/stmt.c')
-rw-r--r--src/prc1/stmt.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/prc1/stmt.c b/src/prc1/stmt.c
index 8d2fdd4..babe5a8 100644
--- a/src/prc1/stmt.c
+++ b/src/prc1/stmt.c
@@ -14,7 +14,8 @@ void stmt_free(struct stmt *s)
switch (s->type)
{
case DISPLAY:
- display_free(&s->u.display);
+ case WARN:
+ print_free(&s->u.print);
break;
case SET:
set_free(&s->u.set);
@@ -22,9 +23,6 @@ void stmt_free(struct stmt *s)
case CALL:
call_free(&s->u.call);
break;
- case WARN:
- warn_free(&s->u.warn);
- break;
case FROM:
from_free(&s->u.from);
break;
@@ -39,13 +37,13 @@ int stmt_cgen(const struct stmt *s, struct cgen *c)
switch (s->type)
{
case DISPLAY:
- return display_cgen(&s->u.display, c);
+ return display_cgen(&s->u.print, c);
case SET:
return set_cgen(&s->u.set, c);
case CALL:
return call_cgen(&s->u.call, c);
case WARN:
- return warn_cgen(&s->u.warn, c);
+ return warn_cgen(&s->u.print, c);
case FROM:
return from_cgen(&s->u.from, c);
case END:
@@ -65,14 +63,8 @@ struct stmt *stmt_cur(const struct prv *p)
const struct seq stmts[] =
{
- {(struct step[]){
- {ID, "display"}, {ANY, NULL, 1}, {ID, "etc"}, {0}}, .fn = display},
- {(struct step[])
- {{ID, "display"}, {ANY, NULL, 1}, {0}}, .fn = display},
- {(struct step[]){
- {ID, "warn"}, {ANY, NULL, 1}, {ID, "etc"}, {0}}, .fn = warn},
- {(struct step[])
- {{ID, "warn"}, {ANY, NULL, 1}, {0}}, .fn = warn},
+ {(struct step[]){{ID, "display"}, {0}}, .fn = display},
+ {(struct step[]){{ID, "warn"}, {0}}, .fn = warn},
{(struct step[])
{{ID, "from"}, {ANY}, {ID, "to"}, {ANY}, {ID, "using"}, {ID},
{ID, "by"}, {ANY}, {0}}, .fn = from_idby},
@@ -84,9 +76,9 @@ const struct seq stmts[] =
.fn = from_id},
{(struct step[])
{{ID, "from"}, {ANY}, {ID, "to"}, {ANY}, {0}}, .fn = from},
+ {(struct step[]){{ID, "call"}, {0}}, .fn = call},
{(struct step[]){{ID, "exit"}, {0}}, .fn = s_exit},
{(struct step[]){{ID, "set"}, {0}}, .fn = set},
- {(struct step[]){{ID, "call"}, {0}}, .fn = call},
{(struct step[]){{ID, "end"}, {0}}, .fn = end},
{0}
};