Initialize Tizen 2.3
[external/ragel.git] / test / export1.rl
1 /*
2  * @LANG: c
3  */
4
5 #include <stdio.h>
6 #include <string.h>
7
8 %%{
9         machine test;
10
11         export c1 = 'c';
12         export c2 = 'z';
13         export c3 = 't';
14
15         commands := (
16                 c1 . digit* '\n' @{ printf( "c1\n" );} |
17                 c2 . alpha* '\n' @{ printf( "c2\n" );}|
18                 c3 . '.'* '\n' @{ printf( "c3\n" );}
19         )*;
20                 
21         some_other := any*;
22 }%%
23
24 %% write exports;
25 %% write data;
26
27 int test( const char *data, int len )
28 {
29         int cs = test_en_commands;
30         const char *p = data, *pe = data + len;
31
32         %% write init nocs;
33         %% write exec;
34
35         if ( cs >= test_first_final )
36                 printf("ACCEPT\n");
37         else
38                 printf("ERROR\n");
39         return 0;
40 }
41
42 char data[] = { 
43         test_ex_c1, '1', '2', '\n', 
44         test_ex_c2, 'a', 'b', '\n', 
45         test_ex_c3, '.', '.', '\n', 0 
46 };
47
48 int main()
49 {
50         test( data, strlen( data ) );
51         return 0;
52 }
53
54 #ifdef _____OUTPUT_____
55 c1
56 c2
57 c3
58 ACCEPT
59 #endif