summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
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();