microcad_lang/syntax/expression/
marker.rs1use crate::{src_ref::*, syntax::*};
7
8#[derive(Clone)]
10pub struct Marker {
11 pub id: Identifier,
13 pub src_ref: SrcRef,
15}
16
17impl Marker {
18 pub fn is_input_placeholder(&self) -> bool {
20 &self.id == "input"
21 }
22}
23
24impl SrcReferrer for Marker {
25 fn src_ref(&self) -> crate::src_ref::SrcRef {
26 self.src_ref.clone()
27 }
28}
29
30impl std::fmt::Display for Marker {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 write!(f, "@{}", self.id)
33 }
34}
35
36impl std::fmt::Debug for Marker {
37 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38 write!(f, "@{:?}", self.id)
39 }
40}
41
42impl TreeDisplay for Marker {
43 fn tree_print(&self, f: &mut std::fmt::Formatter, depth: TreeState) -> std::fmt::Result {
44 writeln!(f, "{:depth$}Marker '{}'", "", self.id)
45 }
46}