From 1183a0996d560fda9d992a9bb8ca1328465a2b33 Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Sat, 21 Nov 2020 16:35:30 +0000 Subject: Add code generation --- src/ast/typed.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ast/typed.rs') 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, } @@ -36,9 +36,13 @@ impl FirstSet { inner: self.inner.intersection(&other.inner).copied().collect(), } } + + pub fn into_iter(self) -> impl Iterator { + self.inner.into_iter() + } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq, Hash)] pub struct FlastSet { inner: BTreeSet, } -- cgit v1.2.3