use std::ops::ControlFlow;
use crate::{Nag, Outcome, RawComment, RawTag, SanPlus};
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash)]
#[must_use]
pub struct Skip(pub bool);
pub trait Visitor {
type Tags;
type Movetext;
type Output;
fn begin_tags(&mut self) -> ControlFlow<Self::Output, Self::Tags>;
fn tag(
&mut self,
tags: &mut Self::Tags,
name: &[u8],
value: RawTag<'_>,
) -> ControlFlow<Self::Output> {
let _tags = tags;
let _name = name;
let _value = value;
ControlFlow::Continue(())
}
fn begin_movetext(&mut self, tags: Self::Tags) -> ControlFlow<Self::Output, Self::Movetext>;
fn san(
&mut self,
movetext: &mut Self::Movetext,
san_plus: SanPlus,
) -> ControlFlow<Self::Output> {
let _movetext = movetext;
let _san_plus = san_plus;
ControlFlow::Continue(())
}
fn nag(&mut self, movetext: &mut Self::Movetext, nag: Nag) -> ControlFlow<Self::Output> {
let _movetext = movetext;
let _nag = nag;
ControlFlow::Continue(())
}
fn partial_comment(
&mut self,
movetext: &mut Self::Movetext,
comment: RawComment<'_>,
) -> ControlFlow<Self::Output> {
self.comment(movetext, comment)
}
fn comment(
&mut self,
movetext: &mut Self::Movetext,
comment: RawComment<'_>,
) -> ControlFlow<Self::Output> {
let _movetext = movetext;
let _comment = comment;
ControlFlow::Continue(())
}
fn begin_variation(
&mut self,
movetext: &mut Self::Movetext,
) -> ControlFlow<Self::Output, Skip> {
let _movetext = movetext;
ControlFlow::Continue(Skip(true))
}
fn end_variation(&mut self, movetext: &mut Self::Movetext) -> ControlFlow<Self::Output> {
let _movetext = movetext;
ControlFlow::Continue(())
}
fn outcome(
&mut self,
movetext: &mut Self::Movetext,
outcome: Outcome,
) -> ControlFlow<Self::Output> {
let _movetext = movetext;
let _outcome = outcome;
ControlFlow::Continue(())
}
fn end_game(&mut self, movetext: Self::Movetext) -> Self::Output;
}