@classmethod
def duplicate(cls, symbol, new_symbol, **kwargs):
    """Duplicate a token class with a new symbol."""
    token_class = cls.symbol_table[symbol]
    new_token_class = cls.register(new_symbol, **kwargs)
    for key, value in token_class.__dict__.items():
        if key in kwargs or key in ('symbol', 'pattern') or key.startswith('_'
            ):
            continue
        setattr(new_token_class, key, value)
    return new_token_class
