Index: compile_rules.py ================================================================== --- compile_rules.py +++ compile_rules.py @@ -418,13 +418,20 @@ def printBookmark (nLevel, sComment, nLine): print(" {:>6}: {}".format(nLine, " " * nLevel + sComment)) -def make (lRules, sLang, bJavaScript): +def make (spLang, sLang, bJavaScript): "compile rules, returns a dictionary of values" # for clarity purpose, don’t create any file here + + print("> read rules file...") + try: + lRules = open(spLang + "/rules_g.grx", 'r', encoding="utf-8").readlines() + except: + print("Error. Rules file in project [" + sLang + "] not found.") + exit() # removing comments, zeroing empty lines, creating definitions, storing tests, merging rule lines print(" parsing rules...") global dDEF lLine = [] Index: gc_lang/fr/rules.grx ================================================================== --- gc_lang/fr/rules.grx +++ gc_lang/fr/rules.grx @@ -17,10 +17,12 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Grammalecte. If not, see # + +# RÈGLES PAR EXPRESSIONS RÉGULIÈRES # DOCUMENTATION # Expressions régulières en Python : http://docs.python.org/library/re.html # [++] : séparateur des règles pour le paragraphe et des règles pour la phrase. Index: make.py ================================================================== --- make.py +++ make.py @@ -191,17 +191,12 @@ dVars = xConfig._sections['args'] dVars['locales'] = dVars["locales"].replace("_", "-") dVars['loc'] = str(dict([ [s, [s[0:2], s[3:5], ""]] for s in dVars["locales"].split(" ") ])) ## COMPILE RULES - print("> read rules file...") - try: - lRules = open(spLang + "/rules.grx", 'r', encoding="utf-8").readlines() - except: - print("Rules file in project [" + sLang + "] not found") - return - dVars.update(compile_rules.make(lRules, dVars['lang'], bJavaScript)) + dResult = compile_rules.make(spLang, dVars['lang'], bJavaScript) + dVars.update(dResult) ## READ GRAMMAR CHECKER PLUGINS print("PYTHON:") print("+ Plugins: ", end="") sCodePlugins = ""