repo.or.cz
/
ragel.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
A fix to the documentation makefile from John D. Mitchell.
[ragel.git]
/
test
/
cond7.rl
blob
3951af0f92f16581af576df0500490ce51082024
1
/*
2
* @LANG: indep
3
*/
4
int i;
5
int c;
6
%%
7
8
%%{
9
machine foo;
10
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
}
19
20
count = [0-9] @{
21
i = fc - '0';
22
prints "count: ";
23
printi i;
24
prints "\n";
25
};
26
27
sub =
28
count # record the number of digits
29
( digit when testi @inc )* outwhen !testi;
30
31
main := sub sub '\n';
32
}%%
33
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_____ */