ziyy_core/splitter/fragment.rs
1use std::borrow::Cow;
2
3use crate::common::Span;
4
5#[derive(Debug, Clone)]
6pub enum FragmentType {
7 Tag,
8 Whitespace,
9 Word,
10}
11
12#[derive(Debug, Clone)]
13
14pub struct Fragment<'a> {
15 pub r#type: FragmentType,
16 pub lexeme: Cow<'a, str>,
17 pub span: Span,
18}
19
20impl<'a> Fragment<'a> {
21 pub fn new(r#type: FragmentType, lexeme: Cow<'a, str>, span: Span) -> Self {
22 Fragment {
23 r#type,
24 lexeme,
25 span,
26 }
27 }
28}