216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
elif cAction == ">":
## no action, break loop if condition is False
return [sOption, sCondition, cAction, ""]
else:
print("# Unknown action at line " + sIdAction)
return None
def make (spLang, sLang, bJavaScript):
"compile rules, returns a dictionary of values"
# for clarity purpose, don’t create any file here
print("> read graph rules file...")
try:
|
>
>
>
>
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
elif cAction == ">":
## no action, break loop if condition is False
return [sOption, sCondition, cAction, ""]
else:
print("# Unknown action at line " + sIdAction)
return None
def printBookmark (nLevel, sComment, nLine):
print(" {:>6}: {}".format(nLine, " " * nLevel + sComment))
def make (spLang, sLang, bJavaScript):
"compile rules, returns a dictionary of values"
# for clarity purpose, don’t create any file here
print("> read graph rules file...")
try:
|
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
exit()
for j, sTokenLine in lTokenLine:
dAllGraph[sGraphName].append((j, sRuleName, sTokenLine, sActions, nPriority))
lTokenLine.clear()
sActions = ""
sRuleName = ""
nPriority = 4
elif sLine.startswith((" ")):
# actions
sActions += " " + sLine.strip()
else:
lTokenLine.append([i, sLine.strip()])
# tests
print(" list tests...")
sGCTests = "\n".join(lTest)
sGCTestsJS = '{ "aData2": ' + json.dumps(lTest, ensure_ascii=False) + " }\n"
# processing rules
|
|
>
>
>
|
|
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
exit()
for j, sTokenLine in lTokenLine:
dAllGraph[sGraphName].append((j, sRuleName, sTokenLine, sActions, nPriority))
lTokenLine.clear()
sActions = ""
sRuleName = ""
nPriority = 4
elif sLine.startswith((" <<-", " <<-")):
# actions
sActions += " " + sLine.strip()
elif sLine.startswith((" ")):
lTokenLine.append([i, sLine.strip()])
else:
print("Unknown line:")
print(sLine)
# tests
print(" list tests...")
sGCTests = "\n".join(lTest)
sGCTestsJS = '{ "aData2": ' + json.dumps(lTest, ensure_ascii=False) + " }\n"
# processing rules
|