pub mod definition;
pub mod oid;
pub mod syntax;
pub use definition::*;
pub use oid::{OidAssignment, OidComponent};
pub use syntax::*;
use crate::source::{SourceId, SourceRange};
use crate::types::{Diagnostic, Language};
#[derive(Debug, Clone)]
pub struct Module {
pub name: String,
pub language: Language,
pub imports: Vec<Import>,
pub definitions: Vec<Definition>,
pub range: Option<SourceRange>,
pub diagnostics: Vec<Diagnostic>,
pub(crate) source_id: Option<SourceId>,
}
impl Module {
pub fn new(name: String, range: Option<SourceRange>) -> Self {
let source_id = range.map(SourceRange::source);
Module {
name,
language: Language::Unknown,
imports: Vec::new(),
definitions: Vec::new(),
range,
diagnostics: Vec::new(),
source_id,
}
}
pub fn definition_names(&self) -> impl Iterator<Item = &str> {
self.definitions.iter().map(|d| d.name())
}
}
#[derive(Debug, Clone)]
pub struct Import {
pub module: String,
pub symbol: String,
pub range: SourceRange,
}