summaryrefslogtreecommitdiff
path: root/test/trans.d/case/scan2_ruby.rl
blob: ba082b3f352f516b6fbe33cbde836d1cbacfef08 (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
#
# @LANG: ruby
# @GENERATED: true
#


%%{
	machine scanner;

	# Warning: changing the patterns or the input string will affect the
	# coverage of the scanner action types.
	main := |*
        'a' => {print( "pat1\n" );
};

        [ab]+ . 'c' => {print( "pat2\n" );
};

        any => {print( "any\n" );
};
	*|;
}%%



%% write data;

def run_machine( data )
	p = 0
	pe = data.length
	eof = data.length
	cs = 0;
	_m = 
	_a = 
	buffer = Array.new
	blen = 0
ts = 1
te = 1
act = 1
token = 1
	%% write init;
	%% write exec;
	if cs >= scanner_first_final
		puts "ACCEPT"
	else
		puts "FAIL"
	end
end

inp = [
"a",
]

inplen = 1

inp.each { |str| run_machine(str) }