summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthew@masot.net>2024-03-19 13:47:55 -0700
committerMatthew Sotoudeh <matthew@masot.net>2024-03-19 13:47:55 -0700
commit22bf0d39d5fb4c8ca532639ed6f84cdc8ad0673f (patch)
tree0a4e67087137b8fcf363fc2abbaf785c87efd1d8
parentbcd0394801eee9bc1cdd1535cd25c5b98a20023c (diff)
try to fix regex but not entirely sure why it fixed it
-rw-r--r--parsers.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/parsers.py b/parsers.py
index 4924fbc..f3c66bd 100644
--- a/parsers.py
+++ b/parsers.py
@@ -50,8 +50,12 @@ def parse_regex(path):
nfa.transitions[end1][EPSILON].add(start2)
return start1, end2
elif node[0] == "KLEENE":
- start, end = visit(node[1])
+ start = nfa.add_state(nfa.count(), False, False)
+ end = nfa.add_state(nfa.count(), False, False)
+ start1, end1 = visit(node[1])
nfa.transitions[start][EPSILON].add(end)
+ nfa.transitions[start][EPSILON].add(start1)
+ nfa.transitions[end1][EPSILON].add(end)
nfa.transitions[end][EPSILON].add(start)
return start, end
elif node[0] == "OR":
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback