This commit is contained in:
HOME-VM-TOSCHOOL 2023-11-16 02:04:16 +01:00
parent 3f3c3da759
commit 2f22706c0b

View File

@ -17,9 +17,9 @@ def print_debug(*args, **kwargs):
if len(sys.argv) == 1:
print("Default arguments parsed\n")
sys.argv.append("long.arg")
sys.argv.append("long.in")
sys.argv.append("long.exp")
sys.argv.append("testnfa.arg")
sys.argv.append("testnfa.in")
sys.argv.append("testnfa.exp")
with open(sys.argv[1], mode="r", newline="", encoding="utf8") as csvfile:
filereader = csv.reader(csvfile, delimiter="\t", quotechar="|")
@ -47,14 +47,13 @@ with open(sys.argv[1], mode="r", newline="", encoding="utf8") as csvfile:
print_debug(
"WARNING - letter not in alfabet: ", letter, "| line:", num + 1
)
tuple = (item[0], letter)
if (item[0], letter) in fsa_description_map:
print_debug(
f"WARNING - duplicate letter: key = ({item[0]} | {letter}) | line: {num + 1}"
)
fsa_description_map[tuple].append(item[1])
tuple = (item[0], letter)
# fsa_description_map[tuple].append(item[1])
fsa_description_map[tuple] = [item[1]]
# append to description map or create it if it doesn't exist
fsa_description_map[tuple] = fsa_description_map.get(tuple, []) + [item[1]]
if is_error:
exit(-1)