Index: compile_rules.py ================================================================== --- compile_rules.py +++ compile_rules.py @@ -9,10 +9,11 @@ dDEF = {} lFUNCTIONS = [] aRULESET = set() # set of rule-ids to check if there is several rules with the same id +nRULEWITHOUTNAME = 0 dJSREGEXES = {} sWORDLIMITLEFT = r"(?<![\w.,–-])" # r"(?<![-.,—])\b" seems slower sWORDLIMITRIGHT = r"(?![\w–-])" # r"\b(?!-—)" seems slower @@ -163,10 +164,11 @@ def createRule (s, nIdLine, sLang, bParagraph, dOptPriority): "returns rule as list [option name, regex, bCaseInsensitive, identifier, list of actions]" global dJSREGEXES + global nRULEWITHOUTNAME #### OPTIONS sLineId = str(nIdLine) + ("p" if bParagraph else "s") sRuleId = sLineId sOption = False # False or [a-z0-9]+ name @@ -185,10 +187,12 @@ sRuleId = m.group('ruleid')[1:-1] if sRuleId in aRULESET: print("# Error. Several rules have the same id: " + sRuleId) exit() aRULESET.add(sRuleId) + else: + nRULEWITHOUTNAME += 1 nPriority = dOptPriority.get(sOption, 4) if m.group('priority'): nPriority = int(m.group('priority')[1:]) s = s[m.end(0):] else: @@ -636,10 +640,12 @@ sJSCallables += " return " + py2js(sReturn) + ";\n" sJSCallables += " },\n" sJSCallables += "}\n" displayStats(lParagraphRules, lSentenceRules) + + print("Unnamed rules: " + str(nRULEWITHOUTNAME)) d = { "callables": sPyCallables, "callablesJS": sJSCallables, "gctests": sGCTests, "gctestsJS": sGCTestsJS,