Skip to main content

panache_parser/parser/utils/
yaml_regions.rs

1use crate::parser::blocks::code_blocks::{CodeBlockType, InfoString};
2use crate::parser::utils::chunk_options::hashpipe_comment_prefix;
3
4/// Resolve executable chunk language + hashpipe prefix from a code info string.
5pub fn hashpipe_language_and_prefix(info_text: &str) -> Option<(String, &'static str)> {
6    let info = InfoString::parse(info_text);
7    let language = match info.block_type {
8        CodeBlockType::Executable { language } => language,
9        _ => return None,
10    };
11    let prefix = hashpipe_comment_prefix(&language)?;
12    Some((language, prefix))
13}