blob: 6cd5f4e563c5573f0de617beede33d245d436796 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#
# @LANG: ruby
# @GENERATED: true
#
%%{
machine eofact;
action a1 {print( "a1\n" );
}
action a2 {print( "a2\n" );
}
action a3 {print( "a3\n" );
}
action a4 {print( "a4\n" );
}
main := (
'hello' @eof a1 %eof a2 '\n'? |
'there' @eof a3 %eof a4
);
}%%
%% write data;
def run_machine( data )
p = 0
pe = data.length
eof = data.length
cs = 0;
_m =
_a =
buffer = Array.new
blen = 0
%% write init;
%% write exec;
if cs >= eofact_first_final
puts "ACCEPT"
else
puts "FAIL"
end
end
inp = [
"",
"h",
"hell",
"hello",
"hello\n",
"t",
"ther",
"there",
"friend",
]
inplen = 9
inp.each { |str| run_machine(str) }
|