blob: 32db0d8d870bb7e445690670255d3b70389ef84d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* @LANG: indep
* @PROHIBIT_LANGUAGES: cv ruby ocaml rust crack
* @NEEDS_EOF: yes
*/
ptr ts;
ptr te;
int act;
int token;
%%{
machine scanner;
# Warning: changing the patterns or the input string will affect the
# coverage of the scanner action types.
main := |*
'a' => {
print_str "on last ";
if ( p+1 == te ) {
print_str "yes";
}
print_str "\n";
};
'b'+ => {
print_str "on next ";
if ( p+1 == te ) {
print_str "yes";
}
print_str "\n";
};
'c1' 'dxxx'? => {
print_str "on lag ";
if ( p+1 == te ) {
print_str "yes";
}
print_str "\n";
};
'd1' => {
print_str "lm switch1 ";
if ( p+1 == te ) {
print_str "yes";
}
print_str "\n";
};
'd2' => {
print_str "lm switch2 ";
if ( p+1 == te ) {
print_str "yes";
}
print_str "\n";
};
[d0-9]+ '.';
'\n';
*|;
}%%
##### INPUT #####
"abbc1d1d2\n"
##### OUTPUT #####
on last yes
on next yes
on lag yes
lm switch1 yes
lm switch2 yes
ACCEPT
|