pub mod example;
mod example_with_ref;
use crate::{MacroArgs, Span, Token};
use chumsky::error::Rich;
use chumsky::input::ValueInput;
use chumsky::{Parser, extra};
use grabapl::Semantics;
use std::fmt;
use std::fmt::Debug;
pub trait CustomSyntax: Clone + Debug + 'static {
type AbstractNodeType: Clone + Debug + PartialEq;
type AbstractEdgeType: Clone + Debug + PartialEq;
fn get_node_type_parser<
'src: 'tokens,
'tokens,
I: ValueInput<'tokens, Token = Token<'src>, Span = Span>,
>()
-> impl Parser<'tokens, I, Self::AbstractNodeType, extra::Err<Rich<'tokens, Token<'src>, Span>>>
+ Clone;
fn get_edge_type_parser<
'src: 'tokens,
'tokens,
I: ValueInput<'tokens, Token = Token<'src>, Span = Span>,
>()
-> impl Parser<'tokens, I, Self::AbstractEdgeType, extra::Err<Rich<'tokens, Token<'src>, Span>>>
+ Clone;
}
pub trait SemanticsWithCustomSyntax:
Semantics<BuiltinOperation: Clone, BuiltinQuery: Clone, NodeAbstract: Debug, EdgeAbstract: Debug>
{
type CS: CustomSyntax;
fn find_builtin_op(name: &str, args: Option<MacroArgs>) -> Option<Self::BuiltinOperation>;
fn find_builtin_query(name: &str, args: Option<MacroArgs>) -> Option<Self::BuiltinQuery>;
fn convert_node_type(
syn_typ: <<Self as SemanticsWithCustomSyntax>::CS as CustomSyntax>::AbstractNodeType,
) -> Option<Self::NodeAbstract>;
fn convert_edge_type(
syn_typ: <<Self as SemanticsWithCustomSyntax>::CS as CustomSyntax>::AbstractEdgeType,
) -> Option<Self::EdgeAbstract>;
}