License | GNU LGPLv3 |
---|---|
Maintainer | paul.bittner@uni-ulm.de |
Safe Haskell | Safe |
Synopsis
- data Node g a = Node {
- value :: a
- grammartype :: g
- uuid :: UUID
- type AST g a = Tree (Node g a)
- optionaltype :: Grammar g => Node g a -> NodeType
- node :: Grammar g => a -> g -> State UUID (Node g a)
- uuidOf :: AST g a -> UUID
- findById :: UUID -> AST g a -> Maybe (AST g a)
- findByValue :: Eq a => a -> AST g a -> Maybe (AST g a)
- findByGrammarType :: Eq g => g -> AST g a -> Maybe (AST g a)
- optionalAncestors :: (Eq a, Grammar g) => AST g a -> AST g a -> [AST g a]
Documentation
Node type of AST
s.
optionaltype :: Grammar g => Node g a -> NodeType Source #
Returns the node type of a nodes grammar type.
node :: Grammar g => a -> g -> State UUID (Node g a) Source #
Creates a new node from a value and a type by generating a new UUID
for it.
findByValue :: Eq a => a -> AST g a -> Maybe (AST g a) Source #
Finds a subtree in the given AST
whose root has the given value. Returns Nothing
iff no such subtree exists.
findByGrammarType :: Eq g => g -> AST g a -> Maybe (AST g a) Source #
Finds a subtree in the given AST
whose root has the given grammar type. Returns Nothing
iff no such subtree exists.
optionalAncestors :: (Eq a, Grammar g) => AST g a -> AST g a -> [AST g a] Source #
Returns all ancestors of a given subtree (second argument) in the given tree (first argument), that are optional (i.e., their optionaltype
is Optional
).