Overview
Comment: | [build][core][bug] generate rules with multiple tokens |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core | build | rg |
Files: | files | file ages | folders |
SHA3-256: |
667266b24847c95d156a3b4fa2f19b07 |
User & Date: | olr on 2018-06-02 15:21:52 |
Other Links: | branch diff | manifest | tags |
Context
2018-06-02
| ||
18:58 | [graphspell] default suggestions check-in: 8974c2f6d0 user: olr tags: new_feature, graphspell, rg | |
15:21 | [build][core][bug] generate rules with multiple tokens check-in: 667266b248 user: olr tags: core, build, rg | |
14:01 | [core] token offset for correct token positioning check-in: 38cd64c0b9 user: olr tags: core, rg | |
Changes
Modified compile_rules_graph.py from [80b17b07ae] to [e2184e369e].
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 | lToken = sTokenLine.split() lTokenRules = None for i, sToken in enumerate(lToken): if sToken.startswith("{") and sToken.endswith("}") and sToken in dDEF: lToken[i] = dDEF[sToken] if ( (sToken.startswith("[") and sToken.endswith("]")) or (sToken.startswith("([") and sToken.endswith("])")) ): bSelectedGroup = sToken.startswith("(") and sToken.endswith(")") # multiple token if not lTokenRules: | > > | | < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | lToken = sTokenLine.split() lTokenRules = None for i, sToken in enumerate(lToken): if sToken.startswith("{") and sToken.endswith("}") and sToken in dDEF: lToken[i] = dDEF[sToken] if ( (sToken.startswith("[") and sToken.endswith("]")) or (sToken.startswith("([") and sToken.endswith("])")) ): bSelectedGroup = sToken.startswith("(") and sToken.endswith(")") if bSelectedGroup: sToken = sToken[1:-1] # multiple token if not lTokenRules: lTokenRules = [ [s] for s in sToken[1:-1].split("|") ] else: lNewTemp = [] for aRule in lTokenRules: lElem = sToken[1:-1].split("|") sElem1 = lElem.pop(0) if bSelectedGroup: sElem1 = "(" + sElem1 + ")" for sElem in lElem: if bSelectedGroup: sElem = "(" + sElem + ")" aNew = list(aRule) aNew.append(sElem) lNewTemp.append(aNew) aRule.append(sElem1) lTokenRules.extend(lNewTemp) else: # simple token if not lTokenRules: lTokenRules = [[sToken]] else: for aRule in lTokenRules: aRule.append(sToken) for aRule in lTokenRules: yield aRule def createRule (iLine, sRuleName, sTokenLine, sActions, nPriority): # print(iLine, "//", sRuleName, "//", sTokenLine, "//", sActions, "//", nPriority) for lToken in genTokenRules(sTokenLine): # Calculate positions |
︙ | ︙ |