summaryrefslogtreecommitdiff
path: root/dhall/src/simple.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/simple.rs')
-rw-r--r--dhall/src/simple.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/dhall/src/simple.rs b/dhall/src/simple.rs
new file mode 100644
index 0000000..6457291
--- /dev/null
+++ b/dhall/src/simple.rs
@@ -0,0 +1,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()
+ }
+}