5CYTH3 / karm_parser

A parser / maybe compiler that I am proud of
1 stars 2 forks source link

Make the lexer take &str instead of a String #23

Closed RHL120 closed 6 months ago

RHL120 commented 7 months ago

This PR removes the need to copy the program string when creating the lexer. This fixes the issue pointed to by the comment at src/lexer.rs:90. This is done by using a lifetime on the lexer. As far as I can see, this also removes the need to copy out of the program string for things such as if statements, parentheses and numbers.

5CYTH3 commented 6 months ago

Thanks for that ! I reviewed your PR and it seems pretty LGTM to me. I didn´t think that this type of fix could also fix the issue that I got in lexer.rs.