tokstart => ts and tokend => te
[ragel.git] / test / java1.rl
blob461d177985b5a5f02ef4278a4a6cf072522bf150
1 /*
2  * @LANG: java
3  */
5 class java1
7         %%{
8                 machine java1;
10                 one := 'one\n';
11                 two := 'two\n';
12                 four := 'four\n';
14                 main := 
15                         ( 'hello' | 'there' | 'friend' ) 
16                         '\n' @{int s = fentry(one); fgoto *s; char c = fc;}
17                         ( 'one' | 'two' | 'four' ) '\n';
18         }%%
20         %% write data;
22         static void test( char data[] )
23         {
24                 int cs, p = 0, pe = data.length;
25                 int top;
27                 %% write init;
28                 %% write exec;
30                 if ( cs >= java1_first_final )
31                         System.out.println( "ACCEPT" );
32                 else
33                         System.out.println( "FAIL" );
34         }
36         public static void main( String args[] )
37         {
38                 test( "hello\none\n".toCharArray() );
39                 test( "there\ntwo\n".toCharArray() );
40                 test( "friend\nfour\n".toCharArray() );
41         }
44 /* _____OUTPUT_____
45 ACCEPT
46 FAIL
47 FAIL