Escapes in Backquoted Strings

Jan Burse <[email protected]> Sat, 19 Mar 2011 18:32:10 +0100
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Dear All

I am working with
	GNU Prolog 1.3.1
	By Daniel Diaz
	Copyright (C) 1999-2009 Daniel Diaz

It seems that escapes in backquoted strings are
detected, but not converted.

Normal single quotes:

   ?- X = 'abc'.
   X = abc
   | ?- X = '\''.
   X = ''''
   ?- X = '\x61\'.
   X = a

Back quotes:

   ?- X = `abc`.
   X = abc
   ?- X = `\'`.
   X = '\\'''
   ?- X = `\x61\`.
   X = '\\x61\\'

It seems that the escapes are not converted. But
they are detected during parsing of backquoted
strings, at least the first escaped character is
always expected:

   ?- X = `\`.
   .
   uncaught exception: error(syntax_error('user_input:10 (char:8)
   expression expected or previous operator needs brackets'),read_term/3)

But the closing escape character of a noctal or
hexadecimal constant seems not to be not expected:

   ?- X = `\x61`.
   X = '\\x61'.
   ?- X = `\0`.
   X = '\\0'

 From my understanding of ISO standard for back quoted strings,
the same escaping rules should hold as for single quoted
strings. I am referening to non quote char (* 6.4.2.1 *).

Is this a bug or a feature?

Bye