module Language.Drasil.Expr.Extract where
import Data.List (nub)
import Language.Drasil.Expr.Lang (Expr(..))
import Language.Drasil.Space (RealInterval(..))
import Language.Drasil.UID (UID)
eNames :: Expr -> [UID]
eNames :: Expr -> [UID]
eNames (AssocA AssocArithOper
_ [Expr]
l) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames [Expr]
l
eNames (AssocB AssocBoolOper
_ [Expr]
l) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames [Expr]
l
eNames (C UID
c) = [UID
c]
eNames Lit{} = []
eNames (FCall UID
f [Expr]
x) = UID
f forall a. a -> [a] -> [a]
: forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames [Expr]
x
eNames (Case Completeness
_ [(Expr, Expr)]
ls) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Expr -> [UID]
eNames forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst) [(Expr, Expr)]
ls forall a. [a] -> [a] -> [a]
++
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Expr -> [UID]
eNames forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd) [(Expr, Expr)]
ls
eNames (UnaryOp UFunc
_ Expr
u) = Expr -> [UID]
eNames Expr
u
eNames (UnaryOpB UFuncB
_ Expr
u) = Expr -> [UID]
eNames Expr
u
eNames (UnaryOpVV UFuncVV
_ Expr
u) = Expr -> [UID]
eNames Expr
u
eNames (UnaryOpVN UFuncVN
_ Expr
u) = Expr -> [UID]
eNames Expr
u
eNames (ArithBinaryOp ArithBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (BoolBinaryOp BoolBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (EqBinaryOp EqBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (LABinaryOp LABinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (OrdBinaryOp OrdBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (VVVBinaryOp VVVBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (VVNBinaryOp VVNBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (NVVBinaryOp NVVBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
b
eNames (Operator AssocArithOper
_ DiscreteDomainDesc Expr Expr
_ Expr
e) = Expr -> [UID]
eNames Expr
e
eNames (Matrix [[Expr]]
a) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames) [[Expr]]
a
eNames (RealI UID
c RealInterval Expr Expr
b) = UID
c forall a. a -> [a] -> [a]
: RealInterval Expr Expr -> [UID]
eNamesRI RealInterval Expr Expr
b
eNamesRI :: RealInterval Expr Expr -> [UID]
eNamesRI :: RealInterval Expr Expr -> [UID]
eNamesRI (Bounded (Inclusive
_, Expr
il) (Inclusive
_, Expr
iu)) = Expr -> [UID]
eNames Expr
il forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames Expr
iu
eNamesRI (UpTo (Inclusive
_, Expr
iu)) = Expr -> [UID]
eNames Expr
iu
eNamesRI (UpFrom (Inclusive
_, Expr
il)) = Expr -> [UID]
eNames Expr
il
eNames' :: Expr -> [UID]
eNames' :: Expr -> [UID]
eNames' (AssocA AssocArithOper
_ [Expr]
l) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames' [Expr]
l
eNames' (AssocB AssocBoolOper
_ [Expr]
l) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames' [Expr]
l
eNames' (C UID
c) = [UID
c]
eNames' Lit{} = []
eNames' (FCall UID
_ [Expr]
x) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames' [Expr]
x
eNames' (Case Completeness
_ [(Expr, Expr)]
ls) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Expr -> [UID]
eNames' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst) [(Expr, Expr)]
ls forall a. [a] -> [a] -> [a]
++
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Expr -> [UID]
eNames' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd) [(Expr, Expr)]
ls
eNames' (UnaryOp UFunc
_ Expr
u) = Expr -> [UID]
eNames' Expr
u
eNames' (UnaryOpB UFuncB
_ Expr
u) = Expr -> [UID]
eNames' Expr
u
eNames' (UnaryOpVV UFuncVV
_ Expr
u) = Expr -> [UID]
eNames' Expr
u
eNames' (UnaryOpVN UFuncVN
_ Expr
u) = Expr -> [UID]
eNames' Expr
u
eNames' (ArithBinaryOp ArithBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (BoolBinaryOp BoolBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (EqBinaryOp EqBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (LABinaryOp LABinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (OrdBinaryOp OrdBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (VVVBinaryOp VVVBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (VVNBinaryOp VVNBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (NVVBinaryOp NVVBinOp
_ Expr
a Expr
b) = Expr -> [UID]
eNames' Expr
a forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' Expr
b
eNames' (Operator AssocArithOper
_ DiscreteDomainDesc Expr Expr
_ Expr
e) = Expr -> [UID]
eNames' Expr
e
eNames' (Matrix [[Expr]]
a) = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expr -> [UID]
eNames') [[Expr]]
a
eNames' (RealI UID
c RealInterval Expr Expr
b) = UID
c forall a. a -> [a] -> [a]
: RealInterval Expr Expr -> [UID]
eNamesRI' RealInterval Expr Expr
b
eNamesRI' :: RealInterval Expr Expr -> [UID]
eNamesRI' :: RealInterval Expr Expr -> [UID]
eNamesRI' (Bounded (Inclusive, Expr)
il (Inclusive, Expr)
iu) = Expr -> [UID]
eNames' (forall a b. (a, b) -> b
snd (Inclusive, Expr)
il) forall a. [a] -> [a] -> [a]
++ Expr -> [UID]
eNames' (forall a b. (a, b) -> b
snd (Inclusive, Expr)
iu)
eNamesRI' (UpTo (Inclusive, Expr)
iu) = Expr -> [UID]
eNames' (forall a b. (a, b) -> b
snd (Inclusive, Expr)
iu)
eNamesRI' (UpFrom (Inclusive, Expr)
il) = Expr -> [UID]
eNames' (forall a b. (a, b) -> b
snd (Inclusive, Expr)
il)
eDep :: Expr -> [UID]
eDep :: Expr -> [UID]
eDep = forall a. Eq a => [a] -> [a]
nub forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr -> [UID]
eNames