Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocamllex -ml does not generate code compilable with -safe-string #7323

vicuna opened this issue Aug 8, 2016 · 2 comments


None yet
1 participant
Copy link

commented Aug 8, 2016

Original bug ID: 7323
Reporter: @bobzhang
Assigned to: @bobzhang
Status: closed (set by @xavierleroy on 2017-09-24T15:33:25Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: tools (ocaml{lex,yacc,dep,debug,...})
Tags: junior_job
Monitored by: @gasche

Bug description

It generates code like this

let c = lexbuf.Lexing.lex_buffer.[i] in

where lex_buffer is a buffer, and .[i] syntax expect string


This comment has been minimized.

Copy link

commented Aug 9, 2016

Comment author: @gasche

Good point, and should be relatively easy to fix (by using Bytes.get instead).

Using Bytes.get means that code generated from new versions of ocamllex will not compile under old versions of the standard library, but I think this is just fine -- people using an old compiler can use an old ocamllex to regenerate the parser.


This comment has been minimized.

Copy link

commented Aug 15, 2016

Comment author: @bobzhang

A pull request is available: #750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.