Refactor parser assertions