katydid-0.1.1.0: A haskell implementation of Katydid

Safe HaskellNone
LanguageHaskell2010

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.

Synopsis

Documentation

data Refs Source #

Refs is a map from reference name to pattern and describes a relapse grammar.

Instances

Eq Refs Source # 

Methods

(==) :: Refs -> Refs -> Bool #

(/=) :: Refs -> Refs -> Bool #

Show Refs Source # 

Methods

showsPrec :: Int -> Refs -> ShowS #

show :: Refs -> String #

showList :: [Refs] -> ShowS #

emptyRef :: Refs Source #

emptyRef returns an empty reference map.

union :: Refs -> Refs -> Refs Source #

union returns the union of two reference maps.

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.