Re: Literal quote character causes exception.

Paulo Moura <[email protected]> Tue, 6 Oct 2009 15:54:42 +0100
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
On 2009/10/06, at 13:18, Nicolas Pelletier wrote:

> Hello,
>
> On Tue, Oct 6, 2009 at 19:46, Daniel Diaz <Daniel.Diaz@univ- 
> paris1.fr> wrote:
>>
>> after looking carefully at the ISO standard, there is no bug here.  
>> ISO says
>> the syntax is:
>>
>> 0'<single quoted char>
>>
>> where <single quoted char> is a character that could appear in a  
>> quoted
>> string. So if you want to use ' inside either you have to write it  
>> twice
>> ('') or to escape it \'
>>
>> You should use one of the valid forms: 0''' or 0'\'
>
> I see... Yes, on re-reading, I was wrong.

I don't have the standard with me right now, but I seem to remember  
that the ('') and \' is only used within quoted atoms.

>> I agree the result is not very nice...
>> In 1.3.2 I will relax the lexer to also accept 0'' (to remain  
>> compatible
>> with other Prolog systems).
>
> Thank you. Compatibility is indeed how I ran into this case: Logtalk
> includes in its contributions directory a XML parser, which loaded
> fine when used over SWI Prolog, but failed to load when user over GNU
> Prolog. Running further tests now with XSB shows there are varying
> interpretations on what the standard says...


Unfortunately, yes. Nevertheless, GNU Prolog is the first compiler I  
have found that chokes on 0''. Relaxing the lexer seems the sensible  
thing to do until the standard is clarified/rectified/updated.

Best regards,

Paulo


-----------------------------------------------------------------
Paulo Jorge Lopes de Moura, PhD
Assistant Professor
Dep. of Computer Science, University of Beira Interior
6201-001 Covilhã, Portugal

Office 3.18  Ext. 3276
Phone: +351 275319891 Fax: +351 275319899
Email: <mailto:[email protected]>

Home page: <http://www.di.ubi.pt/~pmoura>
Research:  <http://logtalk.org/> Blog: <http://blog.logtalk.org/>
-----------------------------------------------------------------