tokstart => ts and tokend => te
[ragel.git] / test / cond7.rl
blob3951af0f92f16581af576df0500490ce51082024
1 /* 
2  * @LANG: indep
3  */
4 int i;
5 int c;
6 %%
8 %%{
9         machine foo;
11         action testi {i > 0}
12         action inc {
13                 i = i - 1;
14                 c = fc;
15                 prints "item: ";
16                 printi c;
17                 prints "\n";
18         }
20         count = [0-9] @{ 
21                 i = fc - '0'; 
22                 prints "count: ";
23                 printi i;
24                 prints "\n";
25         };
27     sub =       
28                 count # record the number of digits 
29                 ( digit when testi @inc )* outwhen !testi;
30         
31     main := sub sub '\n';
32 }%%
34 /* _____INPUT_____ 
35 "00\n"
36 "019\n"
37 "190\n"
38 "1719\n"
39 "1040000\n"
40 "104000a\n"
41 "104000\n"
42 _____INPUT_____ */
43 /* _____OUTPUT_____
44 count: 0
45 count: 0
46 ACCEPT
47 count: 0
48 count: 1
49 item: 57
50 ACCEPT
51 count: 1
52 item: 57
53 count: 0
54 ACCEPT
55 count: 1
56 item: 55
57 count: 1
58 item: 57
59 ACCEPT
60 count: 1
61 item: 48
62 count: 4
63 item: 48
64 item: 48
65 item: 48
66 item: 48
67 ACCEPT
68 count: 1
69 item: 48
70 count: 4
71 item: 48
72 item: 48
73 item: 48
74 FAIL
75 count: 1
76 item: 48
77 count: 4
78 item: 48
79 item: 48
80 item: 48
81 FAIL
82 _____OUTPUT_____ */