You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking if move my parsing to rowan, and one thing looks complicated. I wish to also have nice error reporting, like using codespan, but have trouble making the integration. As I see it today, I need to keep 2 copies of the whole source code to make both:
pubtypeFile = SimpleFile<String,String>; <-- Copyfor reports
pub structFilesDb{files:SlotMap<FileId,File>,}//Interface to my source code, this is where I need to mix...impl<'a>Files<'a>forFilesDb{typeFileId = FileId;typeName = String;typeSource = &'a str;fnname(&self,file_id:FileId) -> Result<Self::Name,Error>{Ok(self.get(file_id)?.name().to_string())}fnsource(&'a self,file_id:FileId) -> Result<Self::Source,Error>{Ok(self.get(file_id)?.source().as_ref())}fnline_index(&self,file_id:Self::FileId,byte_index:usize) -> Result<usize,Error>{self.get(file_id)?.line_index((), byte_index)}fnline_range(&self,file_id:Self::FileId,line_index:usize) -> Result<Range<usize>,Error>{self.get(file_id)?.line_range((), line_index)}}
Now, I see I can allocate the code from the green_nodes:
parser.green_node.to_string()
But then is again a double-copy. How I can get the nodes that are part of the range of an error? Or index into the line/col, etc?
The text was updated successfully, but these errors were encountered:
I'm looking if move my parsing to rowan, and one thing looks complicated. I wish to also have nice error reporting, like using codespan, but have trouble making the integration. As I see it today, I need to keep 2 copies of the whole source code to make both:
Now, I see I can allocate the code from the green_nodes:
But then is again a double-copy. How I can get the nodes that are part of the range of an error? Or index into the line/col, etc?
The text was updated successfully, but these errors were encountered: