Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 Source #
newRef returns a new reference map given a single pattern and its reference name.
reverseLookupRef :: Pattern -> Refs -> Maybe String Source #
reverseLookupRef returns the reference name for a given pattern.
lookupRef :: Refs -> String -> Pattern Source #
lookupRef looks up a pattern in the reference map, given a reference name.
hasRecursion :: Refs -> Bool Source #
hasRecursion returns whether an relapse grammar has any recursion, starting from the "main" reference.
nullable :: Refs -> Pattern -> Bool Source #
The nullable function returns whether a pattern is nullable. This means that the pattern matches the empty string.
unescapable :: Pattern -> Bool Source #
unescapable is used for short circuiting. A part of the tree can be skipped if all patterns are unescapable.