ebnf-bff-0.1.1.0: Parser combinators & EBNF, BFFs!

Safe HaskellNone
LanguageHaskell2010

Text.EBNF.SyntaxTree

Synopsis

Documentation

replaceIdentifier :: Identifier -> SyntaxTree -> SyntaxTree Source

returns a syntax tree similar to the one passed but with the given identifier.

replaceContent :: Content -> SyntaxTree -> SyntaxTree Source

returns a syntax tree similar to the one passed but with the given content.

replacePosition :: SourcePos -> SyntaxTree -> SyntaxTree Source

returns a syntax tree similar to the one passed but with the given position.

replaceChildren :: [SyntaxTree] -> SyntaxTree -> SyntaxTree Source

returns a syntax tree similar to the one passed but with the given children.

insert :: SyntaxTree -> SyntaxTree -> SyntaxTree Source

inserts a syntax tree as a child, list is sorted by source code position

remove :: SyntaxTree -> SyntaxTree -> SyntaxTree Source

removes any children of st that equal st'

collapse :: (SyntaxTree -> Bool) -> SyntaxTree -> SyntaxTree Source

the content of the syntax tree is merged with it's parent if the predicate is met.

prune :: (SyntaxTree -> Bool) -> SyntaxTree -> SyntaxTree Source

prune will remove any children of tree that satisfy predicate, recursively

pruneUnderscored :: SyntaxTree -> SyntaxTree Source

prune any children of st whose identifier begins with an underscore. might be useful for preventing syntax trees from being polluted by base cases of single characters by annotating the EBNF definition of single-char base cases such as single letters as `_letters_ = ...`