Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv16753/src/bossa/syntax
Modified Files:
ConstantExp.java
Log Message:
Allow unsigned hexadecimal constants that represent negative values.
Index: ConstantExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ConstantExp.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** ConstantExp.java 21 Oct 2003 14:46:10 -0000 1.47
--- ConstantExp.java 24 Nov 2003 13:20:44 -0000 1.48
***************
*** 236,250 ****
throw new NumberFormatException("Negative sign in wrong position");
! try {
! result = Long.parseLong(rep.substring(index), radix);
! if (negative)
! result = -result;
! } catch (NumberFormatException e) {
! // Handle the case Long.MIN_VALUE:
! // the absolute value overflows, but it should be valid
! String constant = negative ? new String("-" + rep.substring(index))
! : rep.substring(index);
! result = Long.parseLong(constant, radix);
! }
return result;
}
--- 236,244 ----
throw new NumberFormatException("Negative sign in wrong position");
! result = new java.math.BigInteger(rep.substring(index), radix).longValue();
!
! if (negative)
! result = -result;
!
return result;
}
|