-
-
Notifications
You must be signed in to change notification settings - Fork 288
Open
Labels
Description
What is the Idea
Pairs has a readonly shared LineIndex field. I would like to have access to that as an user of this library.
I would suggest a getter function to that field like
pub fn line_index(&self) -> Rc<LineIndex> {
// .. ....
}Are open to this idea ?
pub struct Pairs<'i, R> {
queue: Rc<Vec<QueueableToken<'i, R>>>,
input: &'i str,
start: usize,
end: usize,
pairs_count: usize,
line_index: Rc<LineIndex>, // <= Want that ^^
}Reason
I develop a parser for the scripting language of Ion shell.
I currently just save at which byte a token starts and end. However for a LSP server using this parser, I need to map these bytes to their according line and column number for the LSP protocol. I currently get the line and column number by using a HashMap whose keys are bytes mapping to its respective column and line number. Since the pest parser has already done the work, I could use this line index information instead.
Reactions are currently unavailable