Grammalecte  Diff

Differences From Artifact [de8212efb3]:

To Artifact [0ecbd40da7]:


163
164
165
166
167
168
169
170

171



172


173
174
175
176
177
    def __eq__ (self, other):
        # Used as a key in a python dictionary.
        # Nodes are equivalent if they have identical arcs, and each identical arc leads to identical states.
        return self.__str__() == other.__str__()        

    def getNodeAsDict (self):
        "returns the node as a dictionary structure"
        dNode = { }

        for arc, oNode in self.dArcs.items():



            dNode[arc] = oNode.__hash__()


        if self.bFinal:
            dNode["<final>"] = ""
        if self.bInfo:
            dNode["<info>"] = ""
        return dNode







|
>

>
>
>
|
>
>





163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
    def __eq__ (self, other):
        # Used as a key in a python dictionary.
        # Nodes are equivalent if they have identical arcs, and each identical arc leads to identical states.
        return self.__str__() == other.__str__()        

    def getNodeAsDict (self):
        "returns the node as a dictionary structure"
        dNode = {}
        dRegex = {}
        for arc, oNode in self.dArcs.items():
            if type(arc) == str and arc.startswith("~"):
                dRegex[arc[1:]] = oNode.__hash__()
            else:
                dNode[arc] = oNode.__hash__()
        if dRegex:
            dNode["<regex>"] = dRegex
        if self.bFinal:
            dNode["<final>"] = ""
        if self.bInfo:
            dNode["<info>"] = ""
        return dNode