Refactor qualifier tokenizing to easily add more qualifiers.
Fix parsing error when segment is empty.