blob: ae8b6ded6ab75d2c03708055f3637c2e3f4a55b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
module VFSM
class Machine
attr_reader :currentnodes
def initialize(machineDefinition)
@currentnodes = []
end
def handleinput(inputString)
end
class << self
def printnodes nodes
print "{ "
(0..(nodes.length - 1)).each do |x|
if nodes[x].accepting? then
print "((#{nodes[x].id}))"
else
print "(#{nodes[x].id})"
end
print ", " unless x == (nodes.length - 1)
end
print " }"
end
def recurse nodeslist
begin
oldlist = nodeslist.dup
oldlist.each do |node|
tmp = node.goto :lambda
unless tmp == :reject then
tmp.each do |x|
nodeslist.push x
end
end
end
nodeslist.uniq!
end while oldlist != nodeslist
end
end
end
end
|