Add a not yet implemented function.

This helps when creating new parsers since todo!()s will panic the whole parser.
This commit is contained in:
Tom Alexander 2023-04-24 20:08:12 -04:00
parent ab7eb76e13
commit a5585eb01f
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 10 additions and 5 deletions

View File

@ -6,8 +6,6 @@ use nom::combinator::verify;
use nom::multi::many_till;
use super::Context;
use crate::error::CustomError;
use crate::error::MyError;
use crate::error::Res;
use crate::parser::exiting::ExitClass;
use crate::parser::object_parser::minimal_set_object;
@ -16,14 +14,14 @@ use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::parser_with_context::parser_with_context;
use crate::parser::util::exit_matcher_parser;
use crate::parser::util::get_consumed;
use crate::parser::util::not_yet_implemented;
use crate::parser::RadioLink;
use crate::parser::RadioTarget;
#[tracing::instrument(ret, level = "debug")]
pub fn radio_link<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, RadioLink<'s>> {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Not implemented yet.",
))));
not_yet_implemented()?;
todo!();
}
#[tracing::instrument(ret, level = "debug")]

View File

@ -236,6 +236,13 @@ pub fn text_until_exit<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<
))(input)
}
#[allow(dead_code)]
pub fn not_yet_implemented() -> Res<&'static str, ()> {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Not implemented yet.",
))));
}
#[cfg(test)]
mod tests {
use super::*;