bug-prolog
[Top][All Lists]
Advanced

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

number_codes breaks if handling unmatched-doublequote error


From: Jasper Taylor
Subject: number_codes breaks if handling unmatched-doublequote error
Date: Mon, 16 Nov 2009 12:50:44 +0000
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hi Daniel and everyone.
I am using gprolog 1.3.2 on Linux and I have this problem. In certain circumstances, number_codes is raising an exception when it should succeed. This only happens if: * number_codes has a string matching a valid number as the 2nd arg and a variable as the first
* number_codes is called in the exception handling clause of 'catch'
* the exception clause is executing because the goal of 'catch' contained a read_term which caused a parse error
* the parse error was due to an unmatched double quote.

This example produces the bug. It looks like the read_term is producing two errors, one of which hangs around and causes an exception in number_codes. The string of codes converts to sin("foo).


catch(read_from_codes([115,105,110,40,34,102,111,111,41,47], Term),
     Bug,
     number_codes(G, [51,49])).

note that if you replace number_codes with name, the example executes and catches the exception correctly, but G gets set to the atom '31' rather than the number 31, which I guess is because the implementation of name calls number_codes internally, and calls atom_codes when that raises an exception.
Hope you enjoy this challenge!
   --Jasper





reply via email to

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