1use crate::prelude::*;
2use std::fmt;
3
4#[derive(Clone)]
5pub struct ProductObj {
6 pub param: String,
7 pub start: Box<Obj>,
8 pub end: Box<Obj>,
9 pub body: Box<Obj>,
10}
11
12impl ProductObj {
13 pub fn new(param: String, start: Obj, end: Obj, body: Obj) -> Self {
14 ProductObj {
15 param,
16 start: Box::new(start),
17 end: Box::new(end),
18 body: Box::new(body),
19 }
20 }
21}
22
23impl fmt::Display for ProductObj {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 write!(
26 f,
27 "{}{}{}{}{}{}{}{}{}{}{}{}{}",
28 PRODUCT,
29 LEFT_BRACE,
30 self.param,
31 COMMA,
32 " ",
33 self.start,
34 COMMA,
35 " ",
36 self.end,
37 COMMA,
38 " ",
39 self.body,
40 RIGHT_BRACE,
41 )
42 }
43}