blob: fb7836126e58169f7f7a476bc5463edc5a158b8a (
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
|
(*
* @LANG: ocaml
* @GENERATED: true
*)
let ts = ref 0
let te = ref 0
let act = ref 0
let token = ref 0
%%{
machine scanner;
# Warning: changing the patterns or the input string will affect the
# coverage of the scanner action types.
main := |*
'a' => {print_string( "pat1\n" );
};
'b' => {print_string( "pat2\n" );
};
[ab] any* => {print_string( "pat3\n" );
};
*|;
}%%
%% write data;
let exec data =
let buffer = String.create(1024) in
let blen :int ref = ref 0 in
let cs = ref 0 in
let p = ref 0 in
let pe = ref (String.length data) in
let eof = pe in
%% write init;
%% write exec;
if !cs >= scanner_first_final then
print_string "ACCEPT\n"
else
print_string "FAIL\n"
;;
let () =
exec "ab89";
()
;;
|