use nom::error::VerboseError;
use crate::from_text::context_aware_parser::ContextAwareInteractionParser;
use crate::internal_representation::{CommonIoInteractionInterface, InteractionInternalRepresentation};
pub fn parse_interaction<CioII,Parser>
(
input_str : &str,
parser : &Parser
) ->
Result<
InteractionInternalRepresentation<CioII>,
String
>
where
CioII : CommonIoInteractionInterface,
Parser : ContextAwareInteractionParser<CioII>
{
match parser.parse_interaction_inner::<VerboseError<&str>>(input_str) {
Err(nom::Err::Error(e)) | Err(nom::Err::Failure(e)) => {
Err(nom::error::convert_error(input_str, e))
},
Ok( (_,int_repr)) => {
Ok(int_repr)
},
_ => {
panic!()
}
}
}