private static byte[] getSubBusAndCheck(HDLTokenizer input, String pinName, int busWidth)
     throws HDLException {
        byte[] result = null;

        try {
            result = getSubBus(pinName);
        } catch (Exception e) {
            input.HDLError(pinName + " has an invalid sub bus specification");
        }

        if (result != null) {
            if (result[0] < 0 || result[1] < 0)
                input.HDLError(pinName + ": negative bit numbers are illegal");
            else if (result[0] > result[1])
                input.HDLError(pinName + ": left bit number should be lower than the right one");
            else if (result[1] >= busWidth)
                input.HDLError(pinName + ": the specified sub bus is not in the bus range");
        }

        return result;
    }