(self)
return new
Copy the grammar.
Copy the grammar.
Copy the grammar .
def copy(self):
        """
        Copy the grammar.
        """
        new = self.__class__()
        for dict_attr in ("symbol2number", "number2symbol", "dfas", "keywords",
                          "tokens", "symbol2label"):
            setattr(new, dict_attr, getattr(self, dict_attr).copy())
        new.labels = self.labels[:]
        new.states = self.states[:]
        new.start = self.start
        return new
def copy ( self ) : new = self . __class__ ( ) for dict_attr in ( "symbol2number" , "number2symbol" , "dfas" , "keywords" , "tokens" , "symbol2label" ) : setattr ( new , dict_attr , getattr ( self , dict_attr ) . copy ( ) ) new . labels = self . labels [ : ] new . states = self . states [ : ] new . start = self . start return new