summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-06-29 18:46:18 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-06-29 18:46:18 +0000
commit9799fbd9e8c7fd186365c628bf2024d458dafc75 (patch)
treebc077b6dd46e3922dd1b7ac38631e7039d4cc9bf /parser.c
parenta27a5c52f5efeac5165b4dddcb90f207853cc1f5 (diff)
Understand :-initialization(Goal) directive
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index df05037..63da254 100644
--- a/parser.c
+++ b/parser.c
@@ -86,6 +86,7 @@ parse(int fd)
print("Could not open file\n");
return nil;
}
+ initgoals = nil;
initoperators();
nexttoken();
@@ -105,8 +106,13 @@ prologtext(void)
syntaxerror("prologtext");
if(t->tag == CompoundTerm && runestrcmp(t->text, L":-") == 0 && t->arity == 1){
- /* A Directive */
- print("Got directive: %S\n", prettyprint(t));
+ Term *body = t->children;
+ print("Got directive: %S\n", prettyprint(body));
+ if(body->tag == CompoundTerm && body->arity == 1 && runestrcmp(body->text, L"initialization") == 0){
+ Term *tmp = initgoals;
+ initgoals = body->children;
+ initgoals->next = tmp;
+ }
t = prologtext();
}else if(t->tag == CompoundTerm && runestrcmp(t->text, L":-") == 0 && t->arity == 2){
t->next = prologtext();