use crate::atn::ATN;

use crate::token::{CommonToken, Token};
use crate::tree::{NodeKindType, TreeNode};
use crate::vocabulary::Vocabulary;

/// **! Usually generated by ANTLR !**
pub trait Recognizer<'input, 'arena, Tok = CommonToken<'input>>
where
    'input: 'arena,
    Tok: Token + 'input,
{
    type Node: NodeKindType<'arena, Tok>;

    fn sempred(
        &mut self,
        _localctx: Option<&'arena TreeNode<'input, 'arena, Self::Node, Tok>>,
        _rule_index: i32,
        _action_index: i32,
    ) -> bool
    where
        Self: Sized,
    {
        true
    }

    fn action(
        &mut self,
        _localctx: Option<&'arena TreeNode<'input, 'arena, Self::Node, Tok>>,
        _rule_index: i32,
        _action_index: i32,
    ) where
        Self: Sized,
    {
    }

    /// Returns array of rule names.
    /// Used for debugging and error reporting
    fn get_rule_names(&self) -> &[&str] {
        &[]
    }

    fn get_vocabulary(&self) -> &dyn Vocabulary {
        unimplemented!()
    }

    /// Name of the file this recognizer was generated from
    fn get_grammar_file_name(&self) -> &str {
        ""
    }
    fn get_atn(&self) -> &ATN {
        unimplemented!()
    }
}

/// **! Usually generated by ANTLR !**
///
/// Used to make user predicates and actions callable by parser
/// Generated by ANTLR tool from actions and predicated added in grammar file
pub trait Actions<'input, 'arena, P, Tok = CommonToken<'input>>
where
    'input: 'arena,
    P: Recognizer<'input, 'arena, Tok>,
    Tok: Token + 'input,
{
    fn sempred(
        _localctx: Option<&'arena TreeNode<'input, 'arena, P::Node, Tok>>,
        _rule_index: i32,
        _action_index: i32,
        _recog: &mut P,
    ) -> bool {
        true
    }

    fn action(
        _localctx: Option<&'arena TreeNode<'input, 'arena, P::Node, Tok>>,
        _rule_index: i32,
        _action_index: i32,
        _recog: &mut P,
    ) {
    }

    /// Returns array of rule names.
    /// Used for debugging and error reporting
    fn get_rule_names(&self) -> &[&str] {
        &[]
    }
    fn get_vocabulary(&self) -> &dyn Vocabulary {
        unimplemented!()
    }

    /// Name of the file this recognizer was generated from
    fn get_grammar_file_name(&self) -> &str {
        ""
    }
    fn get_atn(&self) -> &ATN {
        unimplemented!()
    }
}
