Index: compile_rules_graph.py ================================================================== --- compile_rules_graph.py +++ compile_rules_graph.py @@ -66,11 +66,11 @@ sActionId = sRuleName + "_a" + str(nAction) sCondition, tAction = createAction(sActionId, sAction, nGroup, nPriority, dPos) if tAction: dACTIONS[sActionId] = tAction lResult = list(lToken) - lResult.extend([iLine, sRuleName, sCondition, sActionId]) + lResult.extend(["##"+str(iLine), sRuleName, sCondition, sActionId]) yield lResult def createAction (sIdAction, sAction, nGroup, nPriority, dPos): m = re.search("([-~=])(\\d+|)(:\\d+|)>> ", sAction) Index: datg.py ================================================================== --- datg.py +++ datg.py @@ -72,11 +72,10 @@ oNextNode = Node() oNode.dArcs[token] = oNextNode self.lUncheckedNodes.append((oNode, token, oNextNode)) if iToken == (len(aRule) - 4): oNode.bFinal = True - oNextNode.bInfo = True iToken += 1 oNode = oNextNode oNode.bFinal = True self.aPreviousRule = aRule @@ -137,22 +136,20 @@ def __init__ (self): self.i = Node.NextId Node.NextId += 1 self.bFinal = False - self.bInfo = False self.dArcs = {} # key: arc value; value: a node @classmethod def resetNextId (cls): cls.NextId = 0 def __str__ (self): # Caution! this function is used for hashing and comparison! cFinal = "1" if self.bFinal else "0" - cInfo = "1" if self.bInfo else "0" - l = [cFinal, cInfo] + l = [cFinal] for (key, oNode) in self.dArcs.items(): l.append(str(key)) l.append(str(oNode.i)) return "_".join(l) @@ -167,17 +164,20 @@ def getNodeAsDict (self): "returns the node as a dictionary structure" dNode = {} dRegex = {} + dRules = {} for arc, oNode in self.dArcs.items(): if type(arc) == str and arc.startswith("~"): dRegex[arc[1:]] = oNode.__hash__() + elif arc.startswith("##"): + dRules[arc[1:]] = oNode.__hash__() else: dNode[arc] = oNode.__hash__() if dRegex: dNode[""] = dRegex - if self.bFinal: - dNode[""] = 1 - if self.bInfo: - dNode[""] = 1 + if dRules: + dNode[""] = dRules + #if self.bFinal: + # dNode[""] = 1 return dNode