added item.
[ragel.git] / test / export1.rl
blobfe9614123236f16d6fc3a48847e653e54e43a382
1 /*
2  * @LANG: c
3  */
5 #include <stdio.h>
6 #include <string.h>
8 %%{
9         machine test;
11         export c1 = 'c';
12         export c2 = 'z';
13         export c3 = 't';
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 }%%
24 %% write exports;
25 %% write data;
27 int test( const char *data, int len )
29         int cs = test_en_commands;
30         const char *p = data, *pe = data + len;
32         %% write init nocs;
33         %% write exec;
35         if ( cs >= test_first_final )
36                 printf("ACCEPT\n");
37         else
38                 printf("ERROR\n");
39         return 0;
42 char data[] = { 
43         test_ex_c1, '1', '2', '\n', 
44         test_ex_c2, 'a', 'b', '\n', 
45         test_ex_c3, '.', '.', '\n', 0 
48 int main()
50         test( data, strlen( data ) );
51         return 0;
54 #ifdef _____OUTPUT_____
58 ACCEPT
59 #endif