From a8bc5590afe8951cb473854a6b701464f11db2d7 Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 14 Sep 2005 14:17:29 +0000 Subject: Added Graphviz module for graphviz stuff. Move a lot of utility functions to GF.Data.Utilities. --- src/GF/Speech/PrJSGF.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/GF/Speech/PrJSGF.hs') diff --git a/src/GF/Speech/PrJSGF.hs b/src/GF/Speech/PrJSGF.hs index 052299329..5d0b0a211 100644 --- a/src/GF/Speech/PrJSGF.hs +++ b/src/GF/Speech/PrJSGF.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/09/07 14:21:30 $ +-- > CVS $Date: 2005/09/14 15:17:29 $ -- > CVS $Author: bringert $ --- > CVS $Revision: 1.14 $ +-- > CVS $Revision: 1.15 $ -- -- This module prints a CFG as a JSGF grammar. -- @@ -19,13 +19,14 @@ module GF.Speech.PrJSGF (jsgfPrinter) where -import GF.Speech.SRG -import GF.Infra.Ident +import GF.Conversion.Types +import GF.Data.Utilities import GF.Formalism.CFG import GF.Formalism.Utilities (Symbol(..)) -import GF.Conversion.Types +import GF.Infra.Ident import GF.Infra.Print import GF.Infra.Option +import GF.Speech.SRG jsgfPrinter :: Ident -- ^ Grammar name -> Options -> CGrammar -> String @@ -45,7 +46,7 @@ prJSGF (SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) . showString "public
= " . prCat start . showChar ';' . nl . nl prRule (SRGRule cat origCat rhs) = comments [origCat] . nl - . prCat cat . showString " = " . join " | " (map prAlt rhs) . nl + . prCat cat . showString " = " . joinS " | " (map prAlt rhs) . nl prAlt rhs | null rhs' = showString "" | otherwise = wrap "(" (unwordsS (map prSymbol rhs')) ")" where rhs' = rmPunct rhs -- cgit v1.2.3