public static Constant parseHex(final String orig, boolean negate) { String string = orig; string = string.trim().toLowerCase(); if (!string.startsWith("0x")) throw new IllegalArgumentException("Expected hex literal, got " + string); try { return parseInteger(string.substring(2), 16, IntForm.Hex, negate, orig); } catch (NumberFormatException ex) { throw new NumberFormatException("Parsing hex : \"" + string +"\""); } }
public static Constant parseOctal(String string, boolean negate) { string = string.trim().toLowerCase(); if (!string.startsWith("0")) throw new IllegalArgumentException("Expected octal literal, got " + string); return parseInteger(string.substring(1), 8, IntForm.Octal, negate); }
public static Constant parseInteger(final String string, int radix, IntForm form, boolean negate) { return parseInteger(string, radix, form, negate, string); } public static Constant parseInteger(String string, int radix, IntForm form, boolean negate, final String orig) {
public static Constant parseDecimal(String string) { return parseInteger(string, 10, IntForm.Decimal, false); }