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

Avoid full buffer copy in map_lexeme #108

Merged
merged 2 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
- The function `to_file` now adds a newline at the end of the generated file. An
optional argument allows to return to the original behaviour (#124, @panglesd)

### Fix

- Avoid copying unnecessarily large amounts of strings when parsing (#85, #108,
@Leonidas-from-XIV)

## 1.7.0

*2019-02-14*
Expand Down
2 changes: 1 addition & 1 deletion lib/read.mll
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@

let map_lexeme f lexbuf =
let len = lexbuf.lex_curr_pos - lexbuf.lex_start_pos in
f (Bytes.to_string lexbuf.lex_buffer) lexbuf.lex_start_pos len
f (Bytes.sub_string lexbuf.lex_buffer lexbuf.lex_start_pos len) lexbuf.lex_start_pos len

type variant_kind = [ `Edgy_bracket | `Square_bracket | `Double_quote ]
type tuple_kind = [ `Parenthesis | `Square_bracket ]
Expand Down