From c85de58a2047c4858825d03977e490db6168fbe3 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Fri, 23 Jul 2021 00:50:18 +0000 Subject: Simplify parsing a bit, and make sure the prolog loader calls read_term with the correct module to pick up the correct operators --- loader.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'loader.pl') diff --git a/loader.pl b/loader.pl index a0af62c..e459738 100644 --- a/loader.pl +++ b/loader.pl @@ -55,17 +55,21 @@ print_initialization_goal_error(Module, Goal, Exception) :- read_and_handle_terms(Stream, Module0, Module) :- - ( read_one_term(Stream, Term, Singles) + ( read_one_term(Stream, Term, Module0, Singles) -> handle_term(Term, Singles, Module0, Module1), read_and_handle_terms(Stream, Module1, Module) ; Module = Module0 ). -read_one_term(Stream, Term, Singles) :- +read_one_term(Stream, Term, Module0, Singles) :- consume_whitespace(Stream), peek_char(Stream, NextCh), NextCh \= end_of_file, - read_term(Stream, Term, [singletons(Singletons)]), + ( Module0 == system + -> read_term(Stream, Term, [singletons(Singletons)]) + ; Module0:read_term(Stream, Term, [singletons(Singletons)]) + % For all other modules than system use Mod:read_term, to use the correct operators + ), singleton_names(Singletons, Singles). whitespace(' '). -- cgit v1.2.3