diff options
author | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-07-23 00:50:18 +0000 |
---|---|---|
committer | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-07-23 00:50:18 +0000 |
commit | c85de58a2047c4858825d03977e490db6168fbe3 (patch) | |
tree | 8856e5d3e8ac67ca9404bd6b0541d3652f37973d /loader.pl | |
parent | 43f65cbe02b3a2512c3a797862196d693b3a9f11 (diff) |
Simplify parsing a bit, and make sure the prolog loader calls read_term with the correct module to pick up the correct operators
Diffstat (limited to 'loader.pl')
-rw-r--r-- | loader.pl | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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(' '). |