fix scanning of integers starting with 0b and 0o (ISO, obs from Paulo Moura).

This commit is contained in:
Vitor Santos Costa 2010-04-18 20:48:25 +01:00
parent d68c7854bd
commit 7593a9ec78
2 changed files with 12 additions and 10 deletions

View File

@ -548,17 +548,15 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted
}
*chp = ch;
}
else if ((ch == 'o') && base == 0) {
else if ((ch == 'o' || ch == 'O') && base == 0) {
might_be_float = FALSE;
base = 8;
if (--max_size == 0) {
Yap_ErrorMessage = "Number Too Long";
return (TermNil);
}
*sp++ = ch;
*chp = Nxtch(inp_stream);
}
else {
ch = Nxtch(inp_stream);
} else if ((ch == 'b' || ch == 'B') && base == 0) {
might_be_float = FALSE;
base = 2;
ch = Nxtch(inp_stream);
} else {
val = base;
base = 10;
}
@ -666,6 +664,10 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted
*chp = ch;
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
return read_int_overflow(s+2,16,val,sign);
else if (s[0] == '0' && (s[1] == 'o' || s[1] == 'O'))
return read_int_overflow(s+2,8,val,sign);
else if (s[0] == '0' && (s[1] == 'b' || s[1] == 'B'))
return read_int_overflow(s+2,2,val,sign);
if (s[1] == '\'')
return read_int_overflow(s+2,base,val,sign);
if (s[2] == '\'')

@ -1 +1 @@
Subproject commit 9efaf4ce7063fbdae534b4555a80fa1373bb7e9a
Subproject commit 3823a8b909e99c8f0a581d14c9505a4fbd9a2853