Applied java data array encoding patch from Colin Fleming. Only works with byte
[external/ragel.git] / test / java2.rl
1 /*
2  * @LANG: java
3  * @ALLOW_GENFLAGS: -T0
4  *
5  * Need unpacking of integer types for this to work.
6  * @IGNORE: yes
7  */
8
9 class java2
10 {
11         %%{
12                 machine java1;
13                 alphtype int;
14
15                 main := 1 2 3 4 (
16                         5 6 7 8 | 
17                         9 10 11 12
18                         ) 1073741824;
19                 
20         }%%
21
22         %% write data;
23
24         static void test( int data[] )
25         {
26                 int cs, p = 0, pe = data.length;
27                 int top;
28
29                 %% write init;
30                 %% write exec;
31
32                 if ( cs >= java1_first_final )
33                         System.out.println( "ACCEPT" );
34                 else
35                         System.out.println( "FAIL" );
36         }
37
38         static final int t1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 1073741824 };
39         static final int t2[] = { 1, 2, 3, 4, 9, 10, 11, 12, 1073741824 };
40         static final int t3[] = { 1, 2, 3, 4, 1073741824 };
41
42         public static void main( String args[] )
43         {
44                 test( t1 );
45                 test( t2 );
46                 test( t3 );
47         }
48 }
49
50 /* _____OUTPUT_____
51 ACCEPT
52 ACCEPT
53 FAIL
54 */