diff options
author | Matthew Sotoudeh <matthew@masot.net> | 2024-03-19 13:47:55 -0700 |
---|---|---|
committer | Matthew Sotoudeh <matthew@masot.net> | 2024-03-19 13:47:55 -0700 |
commit | 22bf0d39d5fb4c8ca532639ed6f84cdc8ad0673f (patch) | |
tree | 0a4e67087137b8fcf363fc2abbaf785c87efd1d8 | |
parent | bcd0394801eee9bc1cdd1535cd25c5b98a20023c (diff) |
try to fix regex but not entirely sure why it fixed it
-rw-r--r-- | parsers.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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": |