blob: de7cd87a6e50f2bbe2d0c2bc40b55b59d9ba8022 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
let rec token buf =
match%sedlex buf with
| white_space -> token buf
| "a" -> token buf
| "b" -> 2
| eof -> 0
| _ -> failwith "Unknown token"
let () =
let lexbuf = Sedlexing.Utf8.from_string "ab" in
print_newline (print_int (token lexbuf))
|