From bda66837a59ef30c3b2ff2513879e5762e5bec06 Mon Sep 17 00:00:00 2001 From: Hongbo Zhang Date: Fri, 26 Aug 2016 03:11:55 -0400 Subject: [PATCH] fix ocamllex -ml, works with -safe-string option (#750) --- Changes | 3 +++ lex/outputbis.ml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 994958d4a..93348d97a 100644 --- a/Changes +++ b/Changes @@ -166,6 +166,9 @@ OCaml 4.04.0: ### Tools: +- MPR#7323: ocamllex -ml work with (-safe-string) + (Hongbo Zhang) + - MPR#7189: toplevel #show, follow chains of module aliases (Gabriel Scherer, report by Daniel Bünzli, review by Thomas Refis) diff --git a/lex/outputbis.ml b/lex/outputbis.ml index 6de3103a9..fc8dfac88 100644 --- a/lex/outputbis.ml +++ b/lex/outputbis.ml @@ -44,7 +44,7 @@ let output_auto_defs oc has_refill = \n end\ \n end else begin\ \n let i = lexbuf.Lexing.lex_curr_pos in\ -\n let c = lexbuf.Lexing.lex_buffer.[i] in\ +\n let c = Bytes.get lexbuf.Lexing.lex_buffer i in\ \n lexbuf.Lexing.lex_curr_pos <- i+1 ;\ \n state lexbuf k (Char.code c)\ \n end\ @@ -61,7 +61,7 @@ let output_auto_defs oc has_refill = \n end\ \n end else begin\ \n let i = lexbuf.Lexing.lex_curr_pos in\ -\n let c = lexbuf.Lexing.lex_buffer.[i] in\ +\n let c = Bytes.get lexbuf.Lexing.lex_buffer i in\ \n lexbuf.Lexing.lex_curr_pos <- i+1 ;\ \n Char.code c\ \n end\