Grammalecte  Check-in [873f3e7060]

Overview
Comment:[build] enumerate actions from 1 not from 0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: 873f3e70603391b3d44a2989b061cf1cb92660372d3ffa2415e5e08c9761af2b
User & Date: olr on 2020-04-17 17:31:19
Other Links: manifest | tags
Context
2020-04-18
05:24
[fr] change Thunderbird path check-in: 1bec71a54f user: olr tags: trunk, fr
2020-04-17
18:37
merge trunk (empty): conflict solved before check-in: f69a4ea6d7 user: olr tags: gcerw
18:07
cherrypick from trunk: [build] enumerate actions from 1 not from 0 check-in: 570dda15fe user: olr tags: gcerw
17:31
[build] enumerate actions from 1 not from 0 check-in: 873f3e7060 user: olr tags: trunk, build
16:40
[fr] ajustements check-in: 6ecd98e581 user: olr tags: trunk, fr
Changes

Modified compile_rules_graph.py from [d5b25a4036] to [b7d9668574].

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