From c16497a80f419abc83817668381b6a6ba02a3a11 Mon Sep 17 00:00:00 2001 From: skaller Date: Sat, 3 Sep 2022 13:45:37 +1000 Subject: [PATCH] Try to fix the dypgen lexer. See #171. --- src/compiler/dypgen/dypgen/extract_type.mll | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/dypgen/dypgen/extract_type.mll b/src/compiler/dypgen/dypgen/extract_type.mll index 53528f384..8526d4ec5 100644 --- a/src/compiler/dypgen/dypgen/extract_type.mll +++ b/src/compiler/dypgen/dypgen/extract_type.mll @@ -126,7 +126,7 @@ and replace_tpar oldtp newtp = parse if s = Bytes.of_string oldtp then (let s = Bytes.of_string ("'"^newtp^" ") in let len2 = Bytes.length s in - s.[len2-1] <- r.[len-1]; + Bytes.set s (len2-1) r.[len-1]; Buffer.add_bytes string_buf s) else Buffer.add_string string_buf r; @@ -140,11 +140,11 @@ and fix_variant fun_typ = parse | [^'_''['] * eof { () } | "_[" ['<''>'] { let i = Lexing.lexeme_start lexbuf in - fun_typ.[i] <- byte_of_char ' '; fun_typ.[i+2] <- byte_of_char ' '; + Bytes.set fun_typ i ' '; Bytes.set fun_typ (i+2) ' '; fix_variant fun_typ lexbuf} | "[" ['<''>'] { let i = Lexing.lexeme_start lexbuf in - fun_typ.[i+1] <- byte_of_char ' '; + Bytes.set fun_typ (i+1) ' '; fix_variant fun_typ lexbuf} | [^'_''['] + { fix_variant fun_typ lexbuf } | ['_''['] { fix_variant fun_typ lexbuf }