Skip to content

Commit

Permalink
fix: string lexing advances based on char boundaries.
Browse files Browse the repository at this point in the history
instead of incrementing 1 byte at the time, advance to the next
boundary. this prevents slicing into an invalid byte index.
  • Loading branch information
Demonstrandum committed Nov 23, 2024
1 parent 7fae4c9 commit f6dc991
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Symbolic Expressions As Markup."
keywords = ["markup", "lisp", "macro", "symbolic-expression", "sexp"]
license-file = "LICENSE"
homepage = "https://git.knutsen.co/seam"
version = "0.2.7"
version = "0.2.8"
authors = ["Demonstrandum <samuel@knutsen.co>"]
edition = "2021"

Expand Down
4 changes: 2 additions & 2 deletions src/parse/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl<'a> Lexer {
} else {
reading_escape = false;
}
self.increment_byte_offsets(1);
let _ = self.consume_char();
}
let end_of_string = self.byte_offset.get();
self.increment_byte_offsets(3);
Expand Down Expand Up @@ -273,7 +273,7 @@ impl<'a> Lexer {
} else {
reading_escape = false;
}
self.increment_byte_offsets(1);
let _ = self.consume_char();
}
let end_of_string = self.byte_offset.get();
self.increment_byte_offsets(1);
Expand Down

0 comments on commit f6dc991

Please sign in to comment.