blob: 83ad2a7e9b5389fe7ab1d974f7f8b8cb01f7641e (
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
|
/*
* @LANG: indep
* @NEEDS_EOF: yes
*
* Test works with split code gen.
*/
%%{
machine eofact;
action a1 { print_str "a1\n"; }
action a2 { print_str "a2\n"; }
action a3 { print_str "a3\n"; }
action a4 { print_str "a4\n"; }
main := (
'hello' @eof a1 %eof a2 '\n'? |
'there' @eof a3 %eof a4
);
}%%
##### INPUT #####
""
"h"
"hell"
"hello"
"hello\n"
"t"
"ther"
"there"
"friend"
##### OUTPUT #####
a1
a3
FAIL
a1
FAIL
a1
FAIL
a2
ACCEPT
ACCEPT
a3
FAIL
a3
FAIL
a4
ACCEPT
FAIL
|