Open SoftTimur opened 2 years ago
The code of lexer_lexbuf_to_supplier is as follows:
let lexer_lexbuf_to_supplier
(lexer : Lexing.lexbuf -> token)
(lexbuf : Lexing.lexbuf)
: supplier =
fun () ->
let token = lexer lexbuf in
let startp = lexbuf.Lexing.lex_start_p
and endp = lexbuf.Lexing.lex_curr_p in
token, startp, endp
So I made a lexer_lexbuf_to_supplier_sedlex
:
let lexer_lexbuf_to_supplier_sedlex
(lexer: Sedlexing.lexbuf -> token)
(lexbuf : Sedlexing.lexbuf)
: supplier =
fun () ->
let token = lexer lexbuf in
let startp, endp = Sedlexing.lexing_positions lexbuf in
token, startp, endp
It works so far.
I would like to enable error handling and incremental API of menhir in my project by sedlex+menhir; I'm trying to adopt
attempt2
andfail
of this sample to my code. Here is theattempt2
of the sample:In my code, I tried:
However, the compilation gave me an error:
Could anyone help?
( link in StackOvereflow )