Initialize Tizen 2.3
[external/ragel.git] / test / export3.rl
1 #
2 # @LANG: ruby
3 #
4
5 %%{
6         machine test;
7
8         export c1 = 'c';
9         export c2 = 'z';
10         export c3 = 't';
11
12         commands := (
13                 c1 . digit* '\n' @{ puts "c1"; } |
14                 c2 . alpha* '\n' @{ puts "c2"; }|
15                 c3 . '.'* '\n' @{ puts "c3"; }
16         )*;
17                         
18         other := any*;
19 }%%
20
21 %% write exports;
22 %% write data;
23
24 def run_machine( data )
25         p = 0;
26         pe = data.length
27         cs = test_en_commands
28         val = 0;
29         neg = false;
30
31         %% write init nocs;
32         %% write exec;
33         if  cs >= test_first_final
34                 puts "ACCEPT"
35         else
36                 puts "FAIL"
37         end
38 end
39
40 inp = [
41                 test_ex_c1, ?1, ?2, ?\n, 
42                 test_ex_c2, ?a, ?b, ?\n, 
43                 test_ex_c3, ?., ?., ?\n
44 ]
45
46 run_machine( inp );
47
48 =begin _____OUTPUT_____
49 c1
50 c2
51 c3
52 ACCEPT
53 =end _____OUTPUT_____