OutputFileStream = 0b10100,
NamedTcpStream = 0b011100,
NamedTlsStream = 0b100000,
- // PausedPrologStream = 0b101100,
ReadlineStream = 0b110000,
StaticStringStream = 0b110100,
ByteStream = 0b111000,
- // StandardInputStream = 0b100,
StandardOutputStream = 0b1100,
StandardErrorStream = 0b11000,
NullStream = 0b111100,
set_cp(B) :- '$set_cp'(B).
+:- non_counted_backtracking comma_dispatch/3.
+
+comma_dispatch(G1, G2, B) :-
+ comma_dispatch_prep((G1, G2), B, Conts),
+ comma_dispatch_call_list(Conts).
+
:- non_counted_backtracking comma_dispatch_prep/3.
comma_dispatch_prep(Gs, B, [Cont|Conts]) :-
( functor(Gs, ',', 2) ->
arg(1, Gs, G1),
arg(2, Gs, G2),
- ( G1 == ! ->
+ ( nonvar(G1), ( G1 = ! ; G1 = _:! ) ->
Cont = builtins:set_cp(B)
- ; callable(G1) ->
- Cont = G1
- ; Cont = throw(error(type_error(callable, G1), call/1))
+ ; Cont = G1
),
comma_dispatch_prep(G2, B, Conts)
+ ; ( Gs = ! ; Gs = _:! ) ->
+ Cont = builtins:set_cp(B),
+ Conts = []
; Cont = Gs,
Conts = []
)
- ; Gs == ! ->
- Cont = builtins:set_cp(B),
- Conts = []
- ; Cont = throw(error(type_error(callable, Gs), call/1)),
+ ; Cont = Gs,
Conts = []
).
'$call'(G1).
-:- non_counted_backtracking comma_dispatch/3.
-
-comma_dispatch(G1, G2, B) :-
- comma_dispatch_prep((G1, G2), B, Conts),
- comma_dispatch_call_list(Conts).
-
-
% univ.
:- non_counted_backtracking univ_errors/3.
expand_goal_cases((Module:Goals0), _, ExpandedGoals, HeadVars) :-
expand_goal(Goals0, Module, Goals1, HeadVars),
ExpandedGoals = (Module:Goals1).
+expand_goal_cases(call(Goals0), _, ExpandedGoals, HeadVars) :-
+ expand_goal(Goals0, Module, Goals1, HeadVars),
+ ExpandedGoals = call(Goals1).
expand_goal(UnexpandedGoals, Module, ExpandedGoals, HeadVars) :-
( var(UnexpandedGoals) ->
- expand_module_names(call(UnexpandedGoals), [0], Module, ExpandedGoals, HeadVars)
+ UnexpandedGoals = ExpandedGoals
+ % expand_module_names(call(UnexpandedGoals), [0], Module, ExpandedGoals, HeadVars)
; goal_expansion(UnexpandedGoals, Module, UnexpandedGoals1),
( Module \== user ->
goal_expansion(UnexpandedGoals1, user, Goals)
( functor(Term0, call, _) ->
Term = Term0 % prevent pre-mature expansion of incomplete goal
% in the first argument, which is done by call/N
- ; expand_goal(call(Term0), user, call(Term))
+ ; expand_goal(Term0, user, Term)
),
setup_call_cleanup(bb_put('$first_answer', true),
submit_query_and_print_results_(Term, VarList),
// &mut wam.machine_st.arena,
// ),
// );
- //
+ //
// let output = output.bytes().unwrap();
// expected.assert_eq(output.as_slice());
}