Fixed a problem reading hex numbers that have the high bit set when the
[external/ragel.git] / test / erract8.rl
1 /*
2  * @LANG: java
3  */
4
5 class erract8
6 {
7         %%{
8                 machine erract8;
9
10                 action on_char  { System.out.println("char: " + data[p]); }
11                 action on_err   { System.out.println("err: " + data[p]); }
12                 action to_state { System.out.println("to state: " + data[p]); }
13
14                 main := 'heXXX' $on_char $err(on_err) $to(to_state);
15         }%%
16
17         %% write data;
18
19         static void test( char data[] )
20         {
21                 int cs, p = 0, pe = data.length;
22                 int eof = pe;
23                 int top;
24
25                 %% write init;
26                 %% write exec;
27
28                 System.out.println("rest: " + data[p] + data[p+1] + data[p+2]);
29         }
30
31         public static void main( String args[] )
32         {
33                 test( "hello".toCharArray() );
34         }
35 }
36
37 /* _____OUTPUT_____
38 char: h
39 to state: h
40 char: e
41 to state: e
42 err: l
43 rest: llo
44 */