Index: compile_rules_graph.py ================================================================== --- compile_rules_graph.py +++ compile_rules_graph.py @@ -138,11 +138,11 @@ # print(iLine, "//", sRuleName, "//", sTokenLine, "//", sActions, "//", nPriority) for lToken in genTokenLines(sTokenLine, dDef): # Calculate positions dPos = {} # key: iGroup, value: iToken iGroup = 0 - #if iLine == 3971: # debug + #if iLine == 15818: # debug # print(" ".join(lToken)) for i, sToken in enumerate(lToken): if sToken.startswith("(") and sToken.endswith(")"): lToken[i] = sToken[1:-1] iGroup += 1 @@ -167,12 +167,14 @@ print(sTokenLine, "\n", sActions) def changeReferenceToken (sText, dPos): "change group reference in with values in " + if "\\" not in sText: + return sText for i in range(len(dPos), 0, -1): - sText = sText.replace("\\"+str(i), "\\"+str(dPos[i])) + sText = re.sub("\\\\"+str(i)+"(?![0-9])", "\\\\"+str(dPos[i]), sText) return sText def checkTokenNumbers (sText, sActionId, nToken): "check if token references in greater than (debugging)"