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
Added Mitchell Foral.
[ragel.git]
/
test
/
scan1.rl
blob
df0971a16a0c0453881a912a6cf8709a60dc7bc5
1
/*
2
* @LANG: indep
3
*/
4
ptr ts;
5
ptr te;
6
int act;
7
int token;
8
%%
9
%%{
10
machine scanner;
11
12
# Warning: changing the patterns or the input string will affect the
13
# coverage of the scanner action types.
14
main := |*
15
'a' => {
16
prints "on last ";
17
if ( p+1 == te )
18
prints "yes";
19
prints "\n";
20
};
21
22
'b'+ => {
23
prints "on next ";
24
if ( p+1 == te )
25
prints "yes";
26
prints "\n";
27
};
28
29
'c1' 'dxxx'? => {
30
prints "on lag ";
31
if ( p+1 == te )
32
prints "yes";
33
prints "\n";
34
};
35
36
'd1' => {
37
prints "lm switch1 ";
38
if ( p+1 == te )
39
prints "yes";
40
prints "\n";
41
};
42
'd2' => {
43
prints "lm switch2 ";
44
if ( p+1 == te )
45
prints "yes";
46
prints "\n";
47
};
48
49
[d0-9]+ '.';
50
51
'\n';
52
*|;
53
}%%
54
/* _____INPUT_____
55
"abbc1d1d2\n"
56
_____INPUT_____ */
57
/* _____OUTPUT_____
58
on last yes
59
on next yes
60
on lag yes
61
lm switch1 yes
62
lm switch2 yes
63
ACCEPT
64
_____OUTPUT_____ */