Generate transitions text file for all parsers
import os
import re
-parser = hlir.parsers[0]
-
+for parser in hlir.parsers:
def fmt_key(key):
if key.node_type == 'DefaultExpression':
return '_'
@@ -96,6 +95,6 @@ def simplify_infos(txts):
short_infos = [simplify_infos(info) for info in infos if info != []]
if short_infos != []:
- with open(os.path.join(targetdir, '..', 'parser_state_transitions.txt'), 'w', encoding='utf8') as file:
+ with open(os.path.join(targetdir, '..', f'parser_state_transitions_{parser.name}.txt'), 'w', encoding='utf8') as file:
for info in short_infos:
file.write(' '.join(info) + '\n')
