230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
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
for iAction, (iActionLine, sAction) in enumerate(lActions):
sAction = sAction.strip()
if sAction:
sActionId = self.sGraphCode + "__" + sRuleName + "__b" + str(iActionBlock) + "_a" + str(iAction)
aAction = self.createAction(sActionId, sAction, nPriority, len(lToken), dPos, iActionLine)
if aAction:
sActionName = self.storeAction(sActionId, aAction)
lResult = list(lToken)
|
|
|
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
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
for iAction, (iActionLine, sAction) in enumerate(lActions, 1):
sAction = sAction.strip()
if sAction:
sActionId = self.sGraphCode + "__" + sRuleName + "__b" + str(iActionBlock) + "_a" + str(iAction)
aAction = self.createAction(sActionId, sAction, nPriority, len(lToken), dPos, iActionLine)
if aAction:
sActionName = self.storeAction(sActionId, aAction)
lResult = list(lToken)
|
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
sAction = self.createFunction("da", sAction)
return [sLineId, sOption, sCondition, cAction, sAction]
print("\n# Unknown action.", sActionId)
return None
def storeAction (self, sActionId, aAction):
"store <aAction> in <self.dActions> avoiding duplicates and return action name"
nVar = 0
while True:
sActionName = sActionId + "_" + str(nVar)
if sActionName not in self.dActions:
self.dActions[sActionName] = aAction
return sActionName
if aAction == self.dActions[sActionName]:
return sActionName
|
|
|
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
sAction = self.createFunction("da", sAction)
return [sLineId, sOption, sCondition, cAction, sAction]
print("\n# Unknown action.", sActionId)
return None
def storeAction (self, sActionId, aAction):
"store <aAction> in <self.dActions> avoiding duplicates and return action name"
nVar = 1
while True:
sActionName = sActionId + "_" + str(nVar)
if sActionName not in self.dActions:
self.dActions[sActionName] = aAction
return sActionName
if aAction == self.dActions[sActionName]:
return sActionName
|