Overview
Comment: | [build] parameter names harmonisation |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | build | rg |
Files: | files | file ages | folders |
SHA3-256: |
616c280e2d6f1d0e9c621178534b37e2 |
User & Date: | olr on 2018-09-16 19:26:41 |
Other Links: | branch diff | manifest | tags |
Context
2018-09-16
| ||
19:27 | [build] parameter names harmonisation check-in: 2e5ccfe8ea user: olr tags: build, rg | |
19:26 | [build] parameter names harmonisation check-in: 616c280e2d user: olr tags: build, rg | |
07:28 | [build] useless code check-in: 2f5d63f1a3 user: olr tags: build, rg | |
Changes
Modified compile_rules.py from [3dbf42c3e0] to [1079fd02f6].
︙ | ︙ | |||
48 49 50 51 52 53 54 | s = re.sub(r"isEnd0 *\(\)", 'after0("^ *$|^,")', s) s = re.sub(r"isRealEnd0 *\(\)", 'after0("^ *$")', s) s = re.sub(r"(select|exclude)[(][\\](\d+)", '\\1(dTokenPos, m.start(\\2), m.group(\\2)', s) s = re.sub(r"define[(][\\](\d+)", 'define(dTokenPos, m.start(\\1)', s) s = re.sub(r"(morph|morphex|displayInfo)[(][\\](\d+)", '\\1((m.start(\\2), m.group(\\2))', s) s = re.sub(r"(morph|morphex|displayInfo)[(]", '\\1(dTokenPos, ', s) s = re.sub(r"(sugg\w+|switch\w+)\(@", '\\1(m.group(i[4])', s) | | | | | | | | | | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | s = re.sub(r"isEnd0 *\(\)", 'after0("^ *$|^,")', s) s = re.sub(r"isRealEnd0 *\(\)", 'after0("^ *$")', s) s = re.sub(r"(select|exclude)[(][\\](\d+)", '\\1(dTokenPos, m.start(\\2), m.group(\\2)', s) s = re.sub(r"define[(][\\](\d+)", 'define(dTokenPos, m.start(\\1)', s) s = re.sub(r"(morph|morphex|displayInfo)[(][\\](\d+)", '\\1((m.start(\\2), m.group(\\2))', s) s = re.sub(r"(morph|morphex|displayInfo)[(]", '\\1(dTokenPos, ', s) s = re.sub(r"(sugg\w+|switch\w+)\(@", '\\1(m.group(i[4])', s) s = re.sub(r"word\(\s*1\b", 'nextword1(sSentence, m.end()', s) # word(1) s = re.sub(r"word\(\s*-1\b", 'prevword1(sSentence, m.start()', s) # word(-1) s = re.sub(r"word\(\s*(\d)", 'nextword(sSentence, m.end(), \\1', s) # word(n) s = re.sub(r"word\(\s*-(\d)", 'prevword(sSentence, m.start(), \\1', s) # word(-n) s = re.sub(r"before\(\s*", 'look(sSentence[:m.start()], ', s) # before(sSentence) s = re.sub(r"after\(\s*", 'look(sSentence[m.end():], ', s) # after(sSentence) s = re.sub(r"textarea\(\s*", 'look(sSentence, ', s) # textarea(sSentence) s = re.sub(r"/0", 'sSentence0[m.start():m.end()]', s) # /0 s = re.sub(r"before0\(\s*", 'look(sSentence0[:m.start()], ', s) # before0(sSentence) s = re.sub(r"after0\(\s*", 'look(sSentence0[m.end():], ', s) # after0(sSentence) s = re.sub(r"textarea0\(\s*", 'look(sSentence0, ', s) # textarea0(sSentence) s = re.sub(r"\bspell *[(]", '_oSpellChecker.isValid(', s) s = re.sub(r"[\\](\d+)", 'm.group(\\1)', s) return s def uppercase (s, sLang): "(flag i is not enough): converts regex to uppercase regex: 'foo' becomes '[Ff][Oo][Oo]', but 'Bar' becomes 'B[Aa][Rr]'." |
︙ | ︙ | |||
557 558 559 560 561 562 563 | # creating file with all functions callable by rules print(" creating callables for regex rules...") sPyCallables = "" sJSCallables = "" for sFuncName, sReturn in lFUNCTIONS: if sFuncName.startswith("_c_"): # condition | | | | | | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | # creating file with all functions callable by rules print(" creating callables for regex rules...") sPyCallables = "" sJSCallables = "" for sFuncName, sReturn in lFUNCTIONS: if sFuncName.startswith("_c_"): # condition sParams = "sSentence, sSentence0, m, dTokenPos, sCountry, bCondMemo" elif sFuncName.startswith("_m_"): # message sParams = "sSentence, m" elif sFuncName.startswith("_s_"): # suggestion sParams = "sSentence, m" elif sFuncName.startswith("_p_"): # preprocessor sParams = "sSentence, m" elif sFuncName.startswith("_d_"): # disambiguator sParams = "sSentence, m, dTokenPos" else: print("# Unknown function type in [" + sFuncName + "]") continue # Python sPyCallables += "def {} ({}):\n".format(sFuncName, sParams) sPyCallables += " return " + sReturn + "\n" # JavaScript |
︙ | ︙ |