Grammalecte  Check-in [570dda15fe]

Overview
Comment:cherrypick from trunk: [build] enumerate actions from 1 not from 0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | gcerw
Files: files | file ages | folders
SHA3-256: 570dda15fe5b23597dd6b387df453b42a7e1a42f7fb275a17f1a4449f4cff50e
User & Date: olr on 2020-04-17 18:07:55
Other Links: branch diff | manifest | tags
Context
2020-04-17
18:09
[core][js] gc engine: bug fix > last index array check-in: 9a4522a381 user: olr tags: core, gcerw
18:07
cherrypick from trunk: [build] enumerate actions from 1 not from 0 check-in: 570dda15fe user: olr tags: gcerw
18:02
cherrypick from trunk: [fr] ajustements check-in: 91457464b6 user: olr tags: gcerw
17:31
[build] enumerate actions from 1 not from 0 check-in: 873f3e7060 user: olr tags: trunk, build
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