munyo 0.8.0

A data language which aims to be the most efficient way to handwrite data.
Documentation
use crate::error::parse_fail::ParseFail;

use super::munyo_parser::{Pairs, Rule};

pub(crate) fn parse_content(pairs: Pairs, starting_text: &str) -> Result<String, ParseFail> {
    let mut s = String::with_capacity(8);
    s.push_str(starting_text);
    for pair in pairs {
        match pair.as_rule() {
            Rule::char_seq => {
                s.push_str(pair.as_str());
            }
            Rule::escaped => match pair.as_str() {
                r"\\" => {
                    s.push('\\');
                }
                r"\|" => {
                    s.push('|');
                }
                r"\n" => {
                    s.push('\n');
                }
                r"\r" => {
                    s.push('\r');
                }
                r"\t" => {
                    s.push('\t');
                }
                _ => {
                    unreachable!()
                }
            },
            _ => {
                unreachable!();
            }
        }
    }
    Ok(s)
}