6 sys
.stderr
.write("""Usage: {} [INPUT [OUTPUT]
7 als input/output niet specificeerd pakt hij stdin/stdout
9 \t$ < file.dot ./van_learnlib_naar_dot.py | dot -Tpdf > file.pdf
10 """.format(sys
.argv
[0]))
12 if len(sys
.argv
) == 1:
14 outputfile
= sys
.stdout
15 elif len(sys
.argv
) == 2:
16 inputfile
= open(sys
.argv
[1], 'r')
17 outputfile
= sys
.stdout
19 inputfile
= open(sys
.argv
[1], 'r')
20 outputfile
= open(sys
.argv
[2], 'w')
23 pat
= r
's(?P<f>\d+) -> s(?P<t>\d+) \[label="(?P<i>\S+) / (?P<o>\S+)"\];'
25 for line
in inputfile
:
26 match
= re
.search(pat
, line
)
28 outputfile
.write('\ts{0} -> s{0}_{1} [label="{2}?"]\n'.format(
29 match
.group('f'), match
.group('t'), match
.group('i')))
30 outputfile
.write('\ts{0}_{1} -> s{1} [label="{2}!"]\n'.format(
31 match
.group('f'), match
.group('t'), match
.group('o')))
33 outputfile
.write(line
)
35 if inputfile
!= sys
.stdin
:
37 if outputfile
!= sys
.stdout
: