pub mod definition;
pub mod oid;
pub mod syntax;
pub use definition::*;
pub use oid::{OidAssignment, OidComponent};
pub use syntax::*;
use crate::types::{Diagnostic, Language, Span};
#[derive(Debug, Clone)]
pub struct Module {
pub name: String,
pub language: Language,
pub imports: Vec<Import>,
pub definitions: Vec<Definition>,
pub span: Span,
pub diagnostics: Vec<Diagnostic>,
pub source_path: String,
pub line_table: Vec<usize>,
}
impl Module {
pub fn new(name: String, span: Span) -> Self {
Module {
name,
language: Language::Unknown,
imports: Vec::new(),
definitions: Vec::new(),
span,
diagnostics: Vec::new(),
source_path: String::new(),
line_table: Vec::new(),
}
}
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 span: Span,
}