summaryrefslogtreecommitdiff
path: root/src/GF/Speech/RegExp.hs
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2007-06-20 16:08:23 +0000
committerbringert <bringert@cs.chalmers.se>2007-06-20 16:08:23 +0000
commit6968004f1945530fa3be91f7982d1f225f92267d (patch)
treeef263500ec27db5c20ff718005ed2901cbbae430 /src/GF/Speech/RegExp.hs
parent91dcc276687dff51cc8ff1faa0a37c3fcf847871 (diff)
Added regexps grammar printer. This is a first step towards recursion-free SRGS.
Diffstat (limited to 'src/GF/Speech/RegExp.hs')
-rw-r--r--src/GF/Speech/RegExp.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/GF/Speech/RegExp.hs b/src/GF/Speech/RegExp.hs
index 6c787b714..120a43d26 100644
--- a/src/GF/Speech/RegExp.hs
+++ b/src/GF/Speech/RegExp.hs
@@ -19,14 +19,14 @@ data RE a =
deriving (Eq,Ord,Show)
-dfa2re :: (Show a,Ord a) => DFA a -> RE a
+dfa2re :: (Ord a) => DFA a -> RE a
dfa2re = finalRE . elimStates . modifyTransitions merge . addLoops
. oneFinalState () epsilonRE . mapTransitions RESymbol
where addLoops fa = newTransitions [(s,s,nullRE) | (s,_) <- states fa] fa
merge es = [(f,t,unionRE ls)
| ((f,t),ls) <- buildMultiMap [((f,t),l) | (f,t,l) <- es]]
-elimStates :: (Show a, Ord a) => DFA (RE a) -> DFA (RE a)
+elimStates :: (Ord a) => DFA (RE a) -> DFA (RE a)
elimStates fa =
case [s | (s,_) <- states fa, isInternal fa s] of
[] -> fa
@@ -120,10 +120,10 @@ joinRE (RESymbol ss) = ss
-- Debugging
-prRE :: Show a => RE a -> String
+prRE :: RE String -> String
prRE (REUnion []) = "<NULL>"
prRE (REUnion xs) = "(" ++ concat (intersperse " | " (map prRE xs)) ++ ")"
prRE (REConcat xs) = "(" ++ unwords (map prRE xs) ++ ")"
prRE (RERepeat x) = "(" ++ prRE x ++ ")*"
-prRE (RESymbol s) = show s
+prRE (RESymbol s) = s