summaryrefslogtreecommitdiff
path: root/src-3.0
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-06-22 11:58:31 +0000
committerbjorn <bjorn@bringert.net>2008-06-22 11:58:31 +0000
commit0643efb6590c7a007cf9d0c848a44e47cee3f63f (patch)
treea26a0705f9ea6bed08649732602b9655222b90ad /src-3.0
parent0c46e232694827173986bc5c32ead695ae099084 (diff)
Get GF.Speech.PrRegExp to compile.
Diffstat (limited to 'src-3.0')
-rw-r--r--src-3.0/GF/Speech/PrRegExp.hs28
1 files changed, 11 insertions, 17 deletions
diff --git a/src-3.0/GF/Speech/PrRegExp.hs b/src-3.0/GF/Speech/PrRegExp.hs
index 55a25d69b..ae450dee8 100644
--- a/src-3.0/GF/Speech/PrRegExp.hs
+++ b/src-3.0/GF/Speech/PrRegExp.hs
@@ -1,33 +1,27 @@
----------------------------------------------------------------------
-- |
--- Module : PrSLF
--- Maintainer : BB
--- Stability : (stable)
--- Portability : (portable)
+-- Module : GF.Speech.PrRegExp
--
-- This module prints a grammar as a regular expression.
-----------------------------------------------------------------------------
module GF.Speech.PrRegExp (regexpPrinter,multiRegexpPrinter) where
-import GF.Conversion.Types
-import GF.Formalism.Utilities
-import GF.Infra.Ident
-import GF.Infra.Option (Options)
-import GF.Speech.CFGToFiniteState
+import GF.Speech.CFG
+import GF.Speech.CFGToFA
+import GF.Speech.PGFToCFG
import GF.Speech.RegExp
-import GF.Compile.ShellState (StateGrammar)
+import PGF
+regexpPrinter :: PGF -> CId -> String
+regexpPrinter pgf cnc = (++"\n") $ prRE $ dfa2re $ cfgToFA $ pgfToCFG pgf cnc
-regexpPrinter :: Options -> StateGrammar -> String
-regexpPrinter opts s = (++"\n") $ prRE $ dfa2re $ cfgToFA opts s
+multiRegexpPrinter :: PGF -> CId -> String
+multiRegexpPrinter pgf cnc = prREs $ mfa2res $ cfgToMFA $ pgfToCFG pgf cnc
-multiRegexpPrinter :: Options -> StateGrammar -> String
-multiRegexpPrinter opts s = prREs $ mfa2res $ cfgToMFA opts s
-
-prREs :: [(String,RE (MFALabel String))] -> String
+prREs :: [(String,RE CFSymbol)] -> String
prREs res = unlines [l ++ " = " ++ prRE (mapRE showLabel re) | (l,re) <- res]
where showLabel = symbol (\l -> "<" ++ l ++ ">") id
-mfa2res :: MFA String -> [(String,RE (MFALabel String))]
+mfa2res :: MFA -> [(String,RE CFSymbol)]
mfa2res (MFA _ dfas) = [(l, minimizeRE (dfa2re dfa)) | (l,dfa) <- dfas]