'hm'
This commit is contained in:
parent
ef4606bf92
commit
12ee630892
@ -8,6 +8,10 @@ class automata:
|
||||
self.storage = []
|
||||
self.accepting_states = []
|
||||
self.state = '0'
|
||||
|
||||
def __repr__(self):
|
||||
return('%s\n\n%s\n\n%s\n\n' % (self.storage, self.accepting_states, self.state))
|
||||
|
||||
|
||||
def add_node(self, line):
|
||||
node = line.split(' ')
|
||||
@ -17,7 +21,7 @@ class automata:
|
||||
self.accepting_states.append(node)
|
||||
|
||||
def test_string(self, text):
|
||||
|
||||
self.state = '0'
|
||||
for i in text:
|
||||
self.state = self.get_node_transition([self.state, i])
|
||||
if self.state == None:
|
||||
@ -44,3 +48,4 @@ f = open(sys.argv[1], 'r')
|
||||
|
||||
for line in f:
|
||||
print(auto.test_string(line))
|
||||
print(auto)
|
||||
|
Loading…
Reference in New Issue
Block a user