2018-11-16 03:56:55 -08:00
|
|
|
|
2018-11-16 04:12:07 -08:00
|
|
|
#[derive(Debug, Clone)]
|
2018-11-16 03:56:55 -08:00
|
|
|
pub struct SourceMap<T> {
|
2018-11-16 04:12:07 -08:00
|
|
|
pub node: T,
|
2018-11-16 12:53:33 -08:00
|
|
|
pub data: Option<SourceData>
|
2018-11-16 03:56:55 -08:00
|
|
|
}
|
|
|
|
|
2018-11-16 04:12:07 -08:00
|
|
|
impl<T> SourceMap<T> {
|
|
|
|
pub fn get(&self) -> &T {
|
|
|
|
&self.node
|
|
|
|
}
|
|
|
|
|
2018-11-16 12:53:33 -08:00
|
|
|
pub fn get_source_data(&self) -> Option<SourceData> {
|
2018-11-16 12:46:29 -08:00
|
|
|
self.data.clone()
|
|
|
|
}
|
2018-11-16 04:12:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct SourceData {
|
|
|
|
pub line_number: usize,
|
|
|
|
pub char_idx: usize
|
2018-11-16 03:56:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|