-
Notifications
You must be signed in to change notification settings - Fork 8
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
Suggest providing byte position spans #13
Comments
Thank you for suggestion and creating this issue. |
Well, I implemented to return |
I work at master...suma:use-byte-offset . Almost functions are done, but |
I've released v0.8.0 which uses |
I noticed that generated
yytext
is a freshly allocatedString
copying from the original'&'a str
passed to the lexer, and also the internal token positionszz_start_read
andzz_marked_pos
arechar
indices. I suggest an additional interface in which byte offsets are also stored, by means of using https://doc.rust-lang.org/std/primitive.str.html#method.char_indices to keep track of byte offsets, and then it would be possible to provide a method that returns aRange
https://doc.rust-lang.org/std/ops/struct.Range.html instead ofyytext
, and then the client could use that along with the original&'a str
to read a substring if desired, all without any new allocation (except for aRange
pair of byte offsets).The text was updated successfully, but these errors were encountered: