use std::{collections::HashMap, io, path::Path};
use crate::{definitions::Definition, error::Result};
#[cfg_attr(docsrs, doc(cfg(feature = "slang")))]
#[cfg(feature = "slang")]
pub mod slang;
#[cfg_attr(docsrs, doc(cfg(feature = "solar")))]
#[cfg(feature = "solar")]
pub mod solar;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
pub struct DocumentId(uuid::Uuid);
impl DocumentId {
#[must_use]
pub fn new() -> Self {
DocumentId(uuid::Uuid::new_v4())
}
}
#[derive(Debug)]
pub struct ParsedDocument {
pub id: DocumentId,
pub definitions: Vec<Definition>,
}
pub trait Parse: Clone {
fn parse_document(
&mut self,
input: impl io::Read,
path: Option<impl AsRef<Path>>,
keep_contents: bool,
) -> Result<ParsedDocument>;
fn get_sources(self) -> Result<HashMap<DocumentId, String>>;
}