1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
use std::collections::BTreeMap;
use crate::syntax::LitKind;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SimpleValue {
kind: Box<SValKind>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SValKind {
Lit(LitKind),
Optional(Option<SimpleValue>),
List(Vec<SimpleValue>),
Record(BTreeMap<String, SimpleValue>),
Union(String, Option<SimpleValue>),
Text(String),
}
impl SimpleValue {
pub(crate) fn new(kind: SValKind) -> Self {
SimpleValue {
kind: Box::new(kind),
}
}
pub fn kind(&self) -> &SValKind {
self.kind.as_ref()
}
}
|