public static int parseHexValue(String cstr, int startOff, int endOff) {
		if (startOff < 0 || endOff < 0) {
			return -1;
		}
		String unicodeChars = cstr.substring(startOff, endOff);
		int result = -1;
		try {
			result = Integer.parseInt(unicodeChars, 16);
		}
		catch (NumberFormatException e) {
		}
		return result;
	}
Given char x or \\t or \\u1234 return the char value;
 Unnecessary escapes like '\{' yield -1.
tool/src/org/antlr/v4/misc/CharSupport.java