update(add) packaging directory and spec file from OBSTF:Private, OBS
[external/ragel.git] / test / ruby1.rl
1 #
2 # @LANG: ruby
3 #
4 # Test the host language scanning for ruby.
5 #
6
7 # %%{
8 a = 1
9 b = /%%\{\}/;
10
11 %%{
12     machine ruby1;
13
14     main := lower+ digit+ '\n' @{
15
16                 # }
17                 c = 1
18                 d = /\}/
19                 puts "NL"
20         };
21 }%%
22
23 # %%{
24 e = 1
25 f = /%%\{\}/;
26
27 %% write data;
28
29 # %%{
30 g = 1
31 h = /%%\{\}/;
32
33 def run_machine( data )
34         p = 0;
35         pe = data.length
36         cs = 0
37
38         %% write init;
39         %% write exec;
40         if  cs >= ruby1_first_final
41                 puts "ACCEPT"
42         else
43                 puts "FAIL"
44         end
45 end
46
47 inp = [
48                 "abc1231\n",
49 ]
50
51 inp.each { |str| run_machine(str) }
52
53 =begin _____OUTPUT_____
54 NL
55 ACCEPT
56 =end _____OUTPUT_____