| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Patterns
Description
This module describes the patterns supported by Relapse.
It also contains some simple functions for the map of references that a Relapse grammar consists of.
Finally it also contains some very simple pattern functions.
Documentation
Pattern recursively describes a Relapse Pattern.
Refs is a map from reference name to pattern and describes a relapse grammar.
newRef :: String -> Pattern -> Refs #
newRef returns a new reference map given a single pattern and its reference name.
reverseLookupRef :: Pattern -> Refs -> Maybe String #
reverseLookupRef returns the reference name for a given pattern.
lookupRef :: Refs -> String -> Pattern #
lookupRef looks up a pattern in the reference map, given a reference name.
hasRecursion :: Refs -> Bool #
hasRecursion returns whether an relapse grammar has any recursion, starting from the "main" reference.
nullable :: Refs -> Pattern -> Bool #
The nullable function returns whether a pattern is nullable. This means that the pattern matches the empty string.
unescapable :: Pattern -> Bool #
unescapable is used for short circuiting. A part of the tree can be skipped if all patterns are unescapable.