Support slices of all the types otherwise supported

This moves parsing of the value into a separate method, so that it can
be used both for slices and normal values.