Overview
| Comment: | [build] fix rules parser |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | build |
| Files: | files | file ages | folders |
| SHA3-256: |
e537d819dcdc644f183b1d0818179e20 |
| User & Date: | olr on 2018-10-26 18:12:05 |
| Other Links: | manifest | tags |
Context
|
2018-10-26
| ||
| 18:12 | [fr] faux positif: énumérations check-in: e8abf20a54 user: olr tags: trunk, fr | |
| 18:12 | [build] fix rules parser check-in: e537d819dc user: olr tags: trunk, build | |
|
2018-10-24
| ||
| 09:49 | [fr] faux positifs: énumération check-in: 9df50f20d9 user: olr tags: trunk, fr | |
Changes
Modified compile_rules_graph.py from [f9c246b8ef] to [eb2b3da492].
| ︙ | ︙ | |||
136 137 138 139 140 141 142 |
def createRule (iLine, sRuleName, sTokenLine, iActionBlock, sActions, nPriority, dOptPriority, dDef):
"generator: create rule as list"
# print(iLine, "//", sRuleName, "//", sTokenLine, "//", sActions, "//", nPriority)
for lToken in genTokenLines(sTokenLine, dDef):
# Calculate positions
dPos = {} # key: iGroup, value: iToken
iGroup = 0
| | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
def createRule (iLine, sRuleName, sTokenLine, iActionBlock, sActions, nPriority, dOptPriority, dDef):
"generator: create rule as list"
# print(iLine, "//", sRuleName, "//", sTokenLine, "//", sActions, "//", nPriority)
for lToken in genTokenLines(sTokenLine, dDef):
# Calculate positions
dPos = {} # key: iGroup, value: iToken
iGroup = 0
#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
dPos[iGroup] = i + 1 # we add 1, for we count tokens from 1 to n (not from 0)
|
| ︙ | ︙ | |||
165 166 167 168 169 170 171 172 |
else:
print(" # Error on action at line:", iLine)
print(sTokenLine, "\n", sActions)
def changeReferenceToken (sText, dPos):
"change group reference in <sText> with values in <dPos>"
for i in range(len(dPos), 0, -1):
| > > | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
else:
print(" # Error on action at line:", iLine)
print(sTokenLine, "\n", sActions)
def changeReferenceToken (sText, dPos):
"change group reference in <sText> with values in <dPos>"
if "\\" not in sText:
return sText
for i in range(len(dPos), 0, -1):
sText = re.sub("\\\\"+str(i)+"(?![0-9])", "\\\\"+str(dPos[i]), sText)
return sText
def checkTokenNumbers (sText, sActionId, nToken):
"check if token references in <sText> greater than <nToken> (debugging)"
for x in re.finditer(r"\\(\d+)", sText):
if int(x.group(1)) > nToken:
|
| ︙ | ︙ |