use crate::source::Comment;
use crate::source::DecodedInput;
use crate::source::MagicComment;
use crate::Diagnostic;
use crate::Node;
use crate::Token;
#[derive(Debug)]
#[repr(C)]
pub struct ParserResult {
pub ast: Option<Box<Node>>,
pub tokens: Vec<Token>,
pub diagnostics: Vec<Diagnostic>,
pub comments: Vec<Comment>,
pub magic_comments: Vec<MagicComment>,
pub input: DecodedInput,
}
impl ParserResult {
pub(crate) fn new(
ast: Option<Box<Node>>,
tokens: Vec<Token>,
diagnostics: Vec<Diagnostic>,
comments: Vec<Comment>,
magic_comments: Vec<MagicComment>,
input: DecodedInput,
) -> Self {
Self {
ast,
tokens,
diagnostics,
comments,
magic_comments,
input,
}
}
pub fn ast(&self) -> &Option<Box<Node>> {
&self.ast
}
pub fn tokens(&self) -> &Vec<Token> {
&self.tokens
}
pub fn diagnostics(&self) -> &Vec<Diagnostic> {
&self.diagnostics
}
pub fn comments(&self) -> &Vec<Comment> {
&self.comments
}
pub fn magic_comments(&self) -> &Vec<MagicComment> {
&self.magic_comments
}
pub fn input(&self) -> &DecodedInput {
&self.input
}
}