summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-06-30 21:56:41 +0100
committerubq323 <ubq323@ubq323.website>2024-06-30 21:57:58 +0100
commit567f2ebc2d467b5fc6fdff36c1c7c276fb80adf1 (patch)
tree7292c671d2f69cd89e8b80205178600d5e160e1c
parentcc9a8ae5495550f2a2b1f6e66ffa60504ad03c1a (diff)
fix parsing logic bug (for newer versions of packcc)
-rw-r--r--com.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/com.c b/com.c
index 521adec..4b65ca3 100644
--- a/com.c
+++ b/com.c
@@ -569,12 +569,10 @@ int main(int argc, char **argv) {
AstNode an;
memset(&an, 0, sizeof an);
pcc_context_t *parser = pcc_create(infile);
- int rv;
- do {
- astnode_free(&an);
- rv = pcc_parse(parser, &an);
+ while (pcc_parse(parser, &an)) {
compile_node(&com, an, 0);
- } while (rv != 0);
+ astnode_free(&an);
+ }
pcc_destroy(parser);
}