Skip to content

Commit

Permalink
add state_machine updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Courtney Peverley committed Sep 1, 2023
1 parent 104e18f commit bbdf0d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class StateMachine:
>>> StateMachine([('ab','a','b','a')]).final_state('ab')
'b'
>>> StateMachine([('ab','a','b','a')]).transition_regex('ab')
re.compile('a$')
re.compile('a$', re.IGNORECASE)
>>> StateMachine([('ab','a','b','a')]).function_match('foo_a', transition='ab')
('foo', 'a', 'ab')
>>> StateMachine([('ab','a','b',r'ax?')]).function_match('foo_a', transition='ab')
Expand Down Expand Up @@ -162,8 +162,9 @@ def __setitem__(self, key, value):
if len(value) != 3:
raise ValueError("Invalid transition ({}), should be of the form (inital_state, final_state, regex).".format(value))
# end if
regex = re.compile(value[2] + r"$")
function = re.compile(FORTRAN_ID + r"_(" + value[2] + r")$")
regex = re.compile(value[2] + r"$", re.IGNORECASE)
function = re.compile(FORTRAN_ID + r"_(" + value[2] + r")$",
re.IGNORECASE)
self.__stt__[key] = (value[0], value[1], regex, function)

def __delitem__(self, key):
Expand Down

0 comments on commit bbdf0d0

Please sign in to comment.