taitan_orm_parser/template_parser/structs/exprs/text_expr.rs
1use crate::template_parser::structs::values::TextValue;
2use crate::template_parser::ArithmeticOp;
3use nom::branch::alt;
4use nom::bytes::complete::tag;
5use nom::character::complete::multispace0;
6use nom::combinator::map;
7use nom::sequence::{delimited, preceded};
8use nom::IResult;
9use taitan_orm_tracing::debug;
10use crate::Atomic;
11
12#[derive(Debug, Clone, PartialEq)]
13pub enum TextExpr {
14 Value(TextValue),
15 Nested(Box<TextExpr>),
16}
17
18impl TextExpr {
19 // pub fn parse<I>(atomics: I) -> Result<TextExpr, String> where I: IntoIterator<Item = Atomic>, {
20 // let atomic_list = atomics.into_iter().collect();
21 // debug!("TextExpr::parse({})", atomic_list);
22 //
23 // }
24}
25
26#[cfg(test)]
27mod text_expr_in_file_tests {
28 use crate::template_parser::structs::exprs::text_expr::TextExpr;
29 use crate::template_parser::structs::text::Text;
30 use crate::template_parser::structs::values::TextValue;
31
32 #[test]
33 fn test_text_expr_parse() {
34 // let template = "'hello world!'";
35 // let (_, parsed) = TextExpr::parse(template).unwrap();
36 // let expected = TextExpr::Value(TextValue::Value(Text::SingleQuote(
37 // "'hello world!'".to_string(),
38 // )));
39 // assert_eq!(parsed, expected);
40 //
41 // let template = "((('hello world!')))";
42 // let (_, parsed) = TextExpr::parse(template).unwrap();
43 // let expected = TextExpr::Nested(Box::new(TextExpr::Nested(Box::new(TextExpr::Nested(
44 // Box::new(TextExpr::Value(TextValue::Value(Text::SingleQuote(
45 // "'hello world!'".to_string(),
46 // )))),
47 // )))));
48 // assert_eq!(parsed, expected);
49 }
50}