add ambiguity check for period printing, remove extraneous space between last goal and period (#237)
This commit is contained in:
@@ -72,13 +72,46 @@
|
|||||||
; write_term(G, [quoted(true), variable_names(VarList)])
|
; write_term(G, [quoted(true), variable_names(VarList)])
|
||||||
).
|
).
|
||||||
|
|
||||||
|
'$write_last_goal'(G, VarList) :-
|
||||||
|
( G = (Var = Value) ->
|
||||||
|
write(Var),
|
||||||
|
write(' = '),
|
||||||
|
( '$needs_bracketing'(Value, (=)) ->
|
||||||
|
write('('),
|
||||||
|
write_term(Value, [quoted(true), variable_names(VarList)]),
|
||||||
|
write(')')
|
||||||
|
; write_term(Value, [quoted(true), variable_names(VarList)]),
|
||||||
|
( '$trailing_period_is_ambiguous'(Value) ->
|
||||||
|
write(' ')
|
||||||
|
; true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
; G == [] ->
|
||||||
|
write('true')
|
||||||
|
; write_term(G, [quoted(true), variable_names(VarList)])
|
||||||
|
).
|
||||||
|
|
||||||
'$write_eq'((G1, G2), VarList) :-
|
'$write_eq'((G1, G2), VarList) :-
|
||||||
!,
|
!,
|
||||||
'$write_goal'(G1, VarList),
|
'$write_goal'(G1, VarList),
|
||||||
write(', '),
|
write(', '),
|
||||||
'$write_eq'(G2, VarList).
|
'$write_eq'(G2, VarList).
|
||||||
'$write_eq'(G, VarList) :-
|
'$write_eq'(G, VarList) :-
|
||||||
'$write_goal'(G, VarList).
|
'$write_last_goal'(G, VarList).
|
||||||
|
|
||||||
|
'$graphic_token_char'(C) :-
|
||||||
|
memberchk(C, ['#', '$', '&', '*', '+', '-', '.', ('/'), ':',
|
||||||
|
'<', '=', '>', '?', '@', '^', '~', ('\\')]).
|
||||||
|
|
||||||
|
'$list_last_item'([C], C) :- !.
|
||||||
|
'$list_last_item'([_|Cs], D) :-
|
||||||
|
'$list_last_item'(Cs, D).
|
||||||
|
|
||||||
|
'$trailing_period_is_ambiguous'(Value) :-
|
||||||
|
atom(Value),
|
||||||
|
atom_chars(Value, ValueChars),
|
||||||
|
'$list_last_item'(ValueChars, Char),
|
||||||
|
'$graphic_token_char'(Char).
|
||||||
|
|
||||||
'$write_eqs_and_read_input'(B, VarList) :-
|
'$write_eqs_and_read_input'(B, VarList) :-
|
||||||
sort(VarList, SortedVarList),
|
sort(VarList, SortedVarList),
|
||||||
|
|||||||
Reference in New Issue
Block a user