iter: StackfulPreOrderHeapIter<'a>,
atom_tbl: &'a mut AtomTable,
op_dir: &'a OpDir,
- flags: MachineFlags,
state_stack: Vec<TokenOrRedirect>,
toplevel_spec: Option<DirectedOp>,
last_item_idx: usize,
atom_tbl: &'a mut AtomTable,
stack: &'a mut Stack,
op_dir: &'a OpDir,
- flags: MachineFlags,
output: Outputter,
cell: HeapCellValue,
) -> Self {
iter: stackful_preorder_iter(heap, stack, cell),
atom_tbl,
op_dir,
- flags,
state_stack: vec![],
toplevel_spec: None,
last_item_idx: 0,
let at_cdr = self.outputter.ends_with("|");
- if self.double_quotes && self.flags.double_quotes == DoubleQuotes::Chars {
+ if self.double_quotes {
if !at_cdr && !self.ignore_ops && end_cell.is_string_terminator(&self.iter.heap) {
self.remove_list_children(focus.value() as usize);
return self.print_proper_string(focus.value() as usize, max_depth);
arity_specifier(1, S) :- atom_chars(S, [_,_]).
arity_specifier(2, S) :- atom_chars(S, [_,_,_]).
+double_quotes_option(DQ) :-
+ ( current_prolog_flag(double_quotes, chars) -> DQ = true
+ ; DQ = false
+ ).
+
write_goal(G, VarList, MaxDepth) :-
+ double_quotes_option(DQ),
( G = (Var = Value) ->
( var(Value) ->
select((Var = _), VarList, NewVarList)
write(' = '),
( needs_bracketing(Value, =) ->
write('('),
- write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(true)]),
+ write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(DQ)]),
write(')')
- ; write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(true)])
+ ; write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(DQ)])
)
; G == [] ->
write('true')
- ; write_term(G, [quoted(true), variable_names(VarList), max_depth(MaxDepth), double_quotes(true)])
+ ; write_term(G, [quoted(true), variable_names(VarList), max_depth(MaxDepth), double_quotes(DQ)])
).
write_last_goal(G, VarList, MaxDepth) :-
+ double_quotes_option(DQ),
( G = (Var = Value) ->
( var(Value) ->
select((Var = _), VarList, NewVarList)
write(' = '),
( needs_bracketing(Value, =) ->
write('('),
- write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(true)]),
+ write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(DQ)]),
write(')')
- ; write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(true)]),
+ ; write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth), double_quotes(DQ)]),
( trailing_period_is_ambiguous(Value) ->
write(' ')
; true
)
; G == [] ->
write('true')
- ; write_term(G, [quoted(true), variable_names(VarList), max_depth(MaxDepth), double_quotes(true)])
+ ; write_term(G, [quoted(true), variable_names(VarList), max_depth(MaxDepth), double_quotes(DQ)])
).
write_eq((G1, G2), VarList, MaxDepth) :-