implement token parser