scarf_syntax/
metadata.rs

1// =======================================================================
2// metadata.rs
3// =======================================================================
4// Extra metadata attached to leaf nodes to encode a CST
5
6use crate::*;
7use core::ops::Range;
8
9pub type Span = Range<usize>;
10
11#[derive(Clone, Debug, PartialEq, Default)]
12pub struct Metadata<'a> {
13    pub span: Span,
14    pub extra_nodes: Vec<(ExtraNode<'a>, Span)>,
15}
16
17#[derive(Clone, Debug, PartialEq)]
18pub enum ExtraNode<'a> {
19    OnelineComment(&'a str),
20    BlockComment(&'a str),
21    Directive(CompilerDirective),
22    Newline,
23}