Make line-parsing code more DRY.