[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Escapes in Backquoted Strings

From: Jan Burse
Subject: Escapes in Backquoted Strings
Date: Sat, 19 Mar 2011 18:32:10 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv: Gecko/20110123 SeaMonkey/2.0.12

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 (* *).

Is this a bug or a feature?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]