[Nice-commit] Nice/src/bossa/syntax ConstantExp.java,1.52,1.53
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-09-02 18:23:37
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27251/F:/nice/src/bossa/syntax Modified Files: ConstantExp.java Log Message: Allow underscores in literal numbers. Index: ConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ConstantExp.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** ConstantExp.java 2 Sep 2004 15:46:32 -0000 1.52 --- ConstantExp.java 2 Sep 2004 18:23:25 -0000 1.53 *************** *** 198,202 **** try{ ! long value = parse(rep); return makeInt(value, isLong, representation.location()); } --- 198,202 ---- try{ ! long value = parse(removeUnderscores(rep)); return makeInt(value, isLong, representation.location()); } *************** *** 259,265 **** } public static ConstantExp makeFloating(LocatedString representation) { ! String repres = representation.toString(); if (repres.endsWith("F") || repres.endsWith("f")) { --- 259,275 ---- } + static String removeUnderscores(String s) + { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i<s.length(); i++) + if (s.charAt(i) != '_') + sb.append(s.charAt(i)); + + return sb.toString(); + } + public static ConstantExp makeFloating(LocatedString representation) { ! String repres = removeUnderscores(representation.toString()); if (repres.endsWith("F") || repres.endsWith("f")) { |