Add ~x.y.z and ^x.y.z parsing

Out of curiosity, are there parts of the spec that this function could link to as well?