314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
# processing rules
print(" preparing rules...")
for sGraphName, lRuleLine in dAllGraph.items():
lPreparedRule = []
for i, sRuleGroup, sTokenLine, iActionBlock, sActions, nPriority in lRuleLine:
for lRule in createRule(i, sRuleGroup, sTokenLine, iActionBlock, sActions, nPriority, dDef):
lPreparedRule.append(lRule)
# Show rules
#for e in lPreparedRule:
# print(e)
# Graph creation
oDARG = darg.DARG(lPreparedRule, sLang)
dAllGraph[sGraphName] = oDARG.createGraph()
# creating file with all functions callable by rules
print(" creating callables...")
sPyCallables = "# generated code, do not edit\n"
#sJSCallables = "// generated code, do not edit\nconst oEvalFunc = {\n"
for sFuncName, sReturn in dFUNCTIONS.items():
if sFuncName.startswith("g_c_"): # condition
|
<
<
<
>
>
>
>
>
>
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
# processing rules
print(" preparing rules...")
for sGraphName, lRuleLine in dAllGraph.items():
lPreparedRule = []
for i, sRuleGroup, sTokenLine, iActionBlock, sActions, nPriority in lRuleLine:
for lRule in createRule(i, sRuleGroup, sTokenLine, iActionBlock, sActions, nPriority, dDef):
lPreparedRule.append(lRule)
# Graph creation
oDARG = darg.DARG(lPreparedRule, sLang)
dAllGraph[sGraphName] = oDARG.createGraph()
# Debugging
#print("\nGRAPH:", sGraphName)
#for e in lPreparedRule:
# 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"
#sJSCallables = "// generated code, do not edit\nconst oEvalFunc = {\n"
for sFuncName, sReturn in dFUNCTIONS.items():
if sFuncName.startswith("g_c_"): # condition
|