When in top level SWI-Prolog reads the user's queries using
read_history/6
rather than read/1.
This predicate first reads the current input stream up to a full stop.
While doing so it maps all contiguous blank space onto a single space
and deletes
/* ... */ and % ...<cr>
comments. Parts between double quotes (") or single quotes
(') are left unaltered. Note that a Prolog full stop
consists of a `non-symbol' character, followed by a period (),
followed by a blank character. `Symbol' characters are: .#$&*+-./:<=>?@^`~.
A single quote immediately preceded by a digit (0-9) is considered part
of the <digit>'<digit>... (e.g. 2'101;
binary number 101) sequence.
After this initial parsing the result is first checked for the
special
^<old>^<new>.
construction. If this fails the string is checked for all occurrences of
the , followed by a
!, !, a digit, a
letter or an underscore. These special sequences are analysed and the
appropriate substitution from the history list is made.
?
From the above it follows that it is hard or impossible to correct quotation with single or double quotes, comment delimiters and spacing.