Closed Larsouille25 closed 1 year ago
The new struct shouldn't pass a Position to the new struct but instead a much lighter one without the filename and filetext parameters. But instead put those parameters in the new struct.
I'm definitely not happy with the result, I think I need to found a new implementation, it's too bulky. I've two ideas how to do it more efficiently :
get_pos_token(&mut self, tok_idx: usize) -> Option<(Position, Position)>
with the first Position be the start and the second, the end.This is done.
The "reverse lexer" is just dumb, we can instead store a span in tokens, and in the AST
Is your feature request related to a problem? Please describe. Add error that clearly point to the code.
Describe the solution you'd like
Token
enum intoTokenType
Token
that stores a TokenType and a range, named the span.After that the token stream has the location in the code.
CodeLocation
that will have a functionspan()
that return the span of the AST.CodeLocation
)