File tree 1 file changed +7
-16
lines changed
1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change 9
9
val parse_channel : in_channel -> t
10
10
end
11
11
12
- let provider buf () =
13
- let tok = Lexer. token buf in
14
- let start = Lexing. lexeme_start_p buf in
15
- let stop = Lexing. lexeme_end_p buf in
16
- tok, start, stop
17
-
18
- let convert_pos buf =
19
- { Source. left = Lexer. convert_pos buf.Lexing. lex_start_p;
20
- Source. right = Lexer. convert_pos buf.Lexing. lex_curr_p
12
+ let convert_pos lexbuf =
13
+ { Source. left = Lexer. convert_pos lexbuf.Lexing. lex_start_p;
14
+ Source. right = Lexer. convert_pos lexbuf.Lexing. lex_curr_p
21
15
}
22
16
23
17
let make (type a ) (start : _ -> _ -> a ) : (module S with type t = a) =
24
18
(module struct
25
19
type t = a
26
20
27
- let parse name buf =
28
- Lexing. set_filename buf name;
29
- try
30
- MenhirLib.Convert.Simplified. traditional2revised start (provider buf)
31
- with
32
- | Parser. Error ->
33
- raise (Syntax (convert_pos buf, " unexpected token" ))
21
+ let parse name lexbuf =
22
+ Lexing. set_filename lexbuf name;
23
+ try start Lexer. token lexbuf with Parser. Error ->
24
+ raise (Syntax (convert_pos lexbuf, " unexpected token" ))
34
25
35
26
let parse_string s =
36
27
parse " string" (Lexing. from_string ~with_positions: true s)
You can’t perform that action at this time.
0 commit comments