summaryrefslogtreecommitdiff
path: root/src/ast/typed.rs
diff options
context:
space:
mode:
authorGreg Brown <gmb60@cam.ac.uk>2020-11-21 16:35:30 +0000
committerGreg Brown <gmb60@cam.ac.uk>2020-11-21 16:35:30 +0000
commit1183a0996d560fda9d992a9bb8ca1328465a2b33 (patch)
tree56e0dd9643f206739d04793fa278d37bb301c874 /src/ast/typed.rs
parentba1a9b1d5259f022e298c385841a39f420ce4155 (diff)
Add code generation
Diffstat (limited to 'src/ast/typed.rs')
-rw-r--r--src/ast/typed.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ast/typed.rs b/src/ast/typed.rs
index dee13be..a0b8d1b 100644
--- a/src/ast/typed.rs
+++ b/src/ast/typed.rs
@@ -3,7 +3,7 @@ use super::VariableError;
use std::collections::BTreeSet;
use std::fmt::Display;
-#[derive(Clone, Debug, Eq, PartialEq)]
+#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct FirstSet {
inner: BTreeSet<char>,
}
@@ -36,9 +36,13 @@ impl FirstSet {
inner: self.inner.intersection(&other.inner).copied().collect(),
}
}
+
+ pub fn into_iter(self) -> impl Iterator<Item = char> {
+ self.inner.into_iter()
+ }
}
-#[derive(Clone, Debug, Eq, PartialEq)]
+#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct FlastSet {
inner: BTreeSet<char>,
}