A fix to the documentation makefile from John D. Mitchell.
[ragel.git] / test / erract7.rl
blob040ad73a2be1c60675862fec458ddeee7bca68ba
1 /*
2  * @LANG: c
3  */
5 #include <stdio.h>
6 #include <string.h>
8 %%{
9         machine foo;
11         action on_char  { printf("char: %c\n", *p); }
12         action on_err   { printf("err: %c\n", *p); }
13         action to_state { printf("to state: %c\n", *p); }
15         main := 'heXXX' $on_char $err(on_err) $to(to_state);
16 }%%
18 %% write data;
20 int main()
22         int cs;
23         char *p = "hello", *pe = p + strlen(p);
24         char *eof = pe;
25         %%{
26                 write init;
27                 write exec;
28         }%%
30         printf( "rest: %s\n", p );
32         return 0;
35 #ifdef _____OUTPUT_____
36 char: h
37 to state: h
38 char: e
39 to state: e
40 err: l
41 rest: llo
42 #endif