Grammalecte  Check-in [b270803a20]

Overview
Comment:[build] compile rule graph: fix action indexing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | build | rg
Files: files | file ages | folders
SHA3-256: b270803a2040c8061496273f08af7ab847090c582676da111b0a7e1161eabdfb
User & Date: olr on 2018-06-29 20:31:59
Other Links: branch diff | manifest | tags
Context
2018-06-29
22:43
[fr] conversion: regex rules -> graph rules check-in: e7335f789f user: olr tags: fr, rg
20:31
[build] compile rule graph: fix action indexing check-in: b270803a20 user: olr tags: build, rg
19:33
[fr] conversion: regex rules -> graph rules check-in: ff486c8bc9 user: olr tags: fr, rg
Changes

Modified compile_rules_graph.py from [4e3eba14a0] to [846da89f7e].

109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123







-
+







        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, sAction in enumerate(sActions.split(" <<- "), 1):
        for iAction, sAction in enumerate(sActions.split(" <<- ")):
            sAction = sAction.strip()
            if sAction:
                sActionId = sRuleName + "__b" + str(iActionBlock) + "_a" + str(iAction) + "_" + str(len(lToken))
                aAction = createAction(sActionId, sAction, nPriority, len(lToken), dPos)
                if aAction:
                    dACTIONS[sActionId] = aAction
                    lResult = list(lToken)
340
341
342
343
344
345
346


347
348
349
350
351
352
353
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355







+
+







                lPreparedRule.append(lRule)
        # Graph creation
        oDARG = darg.DARG(lPreparedRule, sLang)
        dAllGraph[sGraphName] = oDARG.createGraph()
        # Debugging
        #print("\nGRAPH:", sGraphName)
        #for e in lPreparedRule:
        #    if e[-2] == "##4239":
        #        print(e)
        #    print(e)
        #for k, v in dAllGraph[sGraphName].items():
        #    print(k, "\t", v)

    # creating file with all functions callable by rules
    print("  creating callables...")
    sPyCallables = "# generated code, do not edit\n"