198e10ce17ca332c70b533aaac4c97289f9951ae
[external/ragel.git] / test / export2.rl
1 /*
2  * @LANG: java
3  * @ALLOW_GENFLAGS: -T0
4  */
5
6 class export2
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' @{ System.out.println( "c1" );} |
17                         c2 . alpha* '\n' @{ System.out.println( "c2" );}|
18                         c3 . '.'* '\n' @{ System.out.println( "c3" );}
19                 )*;
20                         
21                 other := any*;
22         }%%
23
24         %% write exports;
25         %% write data;
26
27         static void test( char data[] )
28         {
29                 int cs = test_en_commands, p = 0, pe = data.length;
30                 int top;
31
32                 %% write init nocs;
33                 %% write exec;
34
35                 if ( cs >= test_first_final )
36                         System.out.println( "ACCEPT" );
37                 else
38                         System.out.println( "FAIL" );
39         }
40
41         public static void main( String args[] )
42         {
43                 char data[] = { 
44                         test_ex_c1, '1', '2', '\n', 
45                         test_ex_c2, 'a', 'b', '\n', 
46                         test_ex_c3, '.', '.', '\n',
47                 };
48                 test( data );
49         }
50 }
51
52
53 /* _____OUTPUT_____
54 c1
55 c2
56 c3
57 ACCEPT
58 */