Overview
| Comment: | [build] changeReferenceToken before prepareFunction |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | build | rg |
| Files: | files | file ages | folders |
| SHA3-256: |
7d80af29a61ee4e8183db6f2e40b8f21 |
| User & Date: | olr on 2018-07-16 13:37:36 |
| Other Links: | branch diff | manifest | tags |
Context
|
2018-07-16
| ||
| 13:56 | [fr] conversion: regex rules -> graph rules check-in: ac99c335d9 user: olr tags: fr, rg | |
| 13:37 | [build] changeReferenceToken before prepareFunction check-in: 7d80af29a6 user: olr tags: build, rg | |
|
2018-07-15
| ||
| 11:33 | [build] fix rules generation when first token was multiple and a selected group check-in: 9d39408049 user: olr tags: build, rg | |
Changes
Modified compile_rules_graph.py from [60e97fc2e5] to [4a6b055c8f].
| ︙ | ︙ | |||
97 98 99 100 101 102 103 |
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
| | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
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 == 2211: # debug
# print(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)
# Parse actions
|
| ︙ | ︙ | |||
160 161 162 163 164 165 166 |
m = re.search(r"(?P<action>[-~=/>])(?P<start>\d+\.?|)(?P<end>:\.?\d+|)>>", sAction)
if not m:
print(" # Error. No action found at: ", sActionId)
return None
# Condition
sCondition = sAction[:m.start()].strip()
if sCondition:
| < > | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
m = re.search(r"(?P<action>[-~=/>])(?P<start>\d+\.?|)(?P<end>:\.?\d+|)>>", sAction)
if not m:
print(" # Error. No action found at: ", sActionId)
return None
# Condition
sCondition = sAction[:m.start()].strip()
if sCondition:
sCondition = changeReferenceToken(sCondition, dPos)
sCondition = prepareFunction(sCondition)
dFUNCTIONS["_g_c_"+sActionId] = sCondition
sCondition = "_g_c_"+sActionId
else:
sCondition = ""
# Action
cAction = m.group("action")
sAction = sAction[m.end():].strip()
|
| ︙ | ︙ |