lib_ruby_parser_ast/nodes/types/
xstr.rs1use crate::nodes::InnerNode;
4use crate::nodes::InspectVec;
5use crate::Loc;
6use crate::Node;
7
8#[derive(Debug, Clone, PartialEq)]
10#[repr(C)]
11pub struct Xstr {
12 pub parts: Vec<Node>,
14
15 pub begin_l: Loc,
25
26 pub end_l: Loc,
36
37 pub expression_l: Loc,
47
48}
49
50impl InnerNode for Xstr {
51 fn expression(&self) -> &Loc {
52 &self.expression_l
53 }
54
55 fn inspected_children(&self, indent: usize) -> Vec<String> {
56 let mut result = InspectVec::new(indent);
57 result.push_nodes(&self.parts);
58
59 result.strings()
60 }
61
62 fn str_type(&self) -> &'static str {
63 "xstr"
64 }
65
66 fn print_with_locs(&self) {
67 println!("{}", self.inspect(0));
68 for node in self.parts.iter() { node.inner_ref().print_with_locs(); }
69 self.begin_l.print("begin");
70 self.end_l.print("end");
71 self.expression_l.print("expression");
72
73 }
74}