use std::sync::Arc;
use crate::err::TranslationErrors;
use crate::tree::typed_ast::context::StatementTranslationContext;
pub use crate::tree::options::{
ExpressionTypeCheckOptions, ParseOptions, TranslateOptions, TypeCheckOptions,
};
pub mod clause;
pub mod command;
pub mod context;
pub mod display;
pub mod expression;
pub mod identifier;
pub mod node;
pub mod ops;
pub mod pattern;
pub mod pipeline;
pub mod query;
pub trait ParseWithErrors: Sized {
fn parse(input: impl Into<String>) -> Self {
Self::parse_with_errors(input).0
}
fn parse_result(input: impl Into<String>) -> Result<Self, TranslationErrors> {
let (ast, errors) = Self::parse_with_errors(input);
if errors.is_empty() {
Ok(ast)
} else {
Err(errors)
}
}
fn parse_with_errors(input: impl Into<String>) -> (Self, TranslationErrors);
}
pub trait ParseWithContext: Sized {
fn parse_with_context(input: String, ctx: context::ParseContext) -> (Self, TranslationErrors);
}
pub trait TypeCheck {
type Output;
fn type_check_with_context(
ast: Arc<Self>,
ctx: &mut StatementTranslationContext,
) -> Self::Output;
}