pomsky_syntax/exprs/regex.rs
1use std::borrow::Cow;
2
3use crate::Span;
4
5#[derive(Clone, PartialEq, Eq)]
6pub struct Regex<'i> {
7 pub content: Cow<'i, str>,
8 pub span: Span,
9}
10
11impl<'i> Regex<'i> {
12 pub(crate) fn new(content: Cow<'i, str>, span: Span) -> Self {
13 Regex { content, span }
14 }
15
16 #[cfg(feature = "dbg")]
17 pub(super) fn pretty_print(&self, buf: &mut crate::PrettyPrinter) {
18 buf.push_str("regex ");
19 write!(buf, "{:?}", self.content);
20 }
21}