summaryrefslogtreecommitdiff
path: root/test/ragel.d/ruby1.rl
blob: 8c42cce583cb8339604cd3940bceb2edd77aa8bc (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
#
# @LANG: ruby
#
# Test the host language scanning for ruby.
#

# %%{
a = 1
b = /%%\{\}/;

%%{
    machine ruby1;

    main := lower+ digit+ '\n' @{

		# }
		c = 1
		d = /\}/
		puts "NL"
	};
}%%

# %%{
e = 1
f = /%%\{\}/;

%% write data;

# %%{
g = 1
h = /%%\{\}/;

def run_machine( data )
	p = 0;
	pe = data.length
	cs = 0

	%% write init;
	%% write exec;
	if  cs >= ruby1_first_final
		puts "ACCEPT"
	else
		puts "FAIL"
	end
end

inp = [
		"abc1231\n",
]

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

##### OUTPUT #####
NL
ACCEPT