Initialize Tizen 2.3
[external/ragel.git] / test / patact.rl
1 /*
2  * @LANG: indep
3  */
4
5 char comm;
6 int top;
7 int stack[32];
8 ptr ts;
9 ptr te;
10 int act;
11 int val;
12 %%
13 %%{
14         machine patact;
15
16         other := |* 
17                 [a-z]+ => { prints "word\n"; };
18                 [0-9]+ => { prints "num\n"; };
19                 [\n ] => { prints "space\n"; };
20         *|;
21
22         exec_test := |* 
23                 [a-z]+ => { prints "word (w/lbh)\n"; fexec te-1; fgoto other; };
24                 [a-z]+ ' foil' => { prints "word (c/lbh)\n"; };
25                 [\n ] => { prints "space\n"; };
26                 '22' => { prints "num (w/switch)\n"; };
27                 [0-9]+ => { prints "num (w/switch)\n"; fexec te-1; fgoto other;};
28                 [0-9]+ ' foil' => {prints "num (c/switch)\n"; };
29                 '!';# => { prints "immdiate\n"; fgoto exec_test; };
30         *|;
31
32         semi := |* 
33                 ';' => { prints "in semi\n"; fgoto main; };
34         *|;
35
36         main := |* 
37                 [a-z]+ => { prints "word (w/lbh)\n"; fhold; fgoto other; };
38                 [a-z]+ ' foil' => { prints "word (c/lbh)\n"; };
39                 [\n ] => { prints "space\n"; };
40                 '22' => { prints "num (w/switch)\n"; };
41                 [0-9]+ => { prints "num (w/switch)\n"; fhold; fgoto other;};
42                 [0-9]+ ' foil' => {prints "num (c/switch)\n"; };
43                 ';' => { prints "going to semi\n"; fhold; fgoto semi;};
44                 '!' => { prints "immdiate\n"; fgoto exec_test; };
45         *|;
46 }%%
47 /* _____INPUT_____
48 "abcd foix\n"
49 "abcd\nanother\n"
50 "123 foix\n"
51 "!abcd foix\n"
52 "!abcd\nanother\n"
53 "!123 foix\n"
54 ";"
55 _____INPUT_____ */
56 /* _____OUTPUT_____
57 word (w/lbh)
58 word
59 space
60 word
61 space
62 ACCEPT
63 word (w/lbh)
64 word
65 space
66 word
67 space
68 ACCEPT
69 num (w/switch)
70 num
71 space
72 word
73 space
74 ACCEPT
75 immdiate
76 word (w/lbh)
77 word
78 space
79 word
80 space
81 ACCEPT
82 immdiate
83 word (w/lbh)
84 word
85 space
86 word
87 space
88 ACCEPT
89 immdiate
90 num (w/switch)
91 num
92 space
93 word
94 space
95 ACCEPT
96 going to semi
97 in semi
98 ACCEPT
99 _____OUTPUT_____ */
100