From 2ee8ab8a714a1b2b4cf906583c04df1ee38b2cdc Mon Sep 17 00:00:00 2001 From: bjorn Date: Tue, 3 Jun 2008 19:20:18 +0000 Subject: Added options to support SRG printing. --- src-3.0/GF/Compile/Export.hs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src-3.0/GF/Compile') diff --git a/src-3.0/GF/Compile/Export.hs b/src-3.0/GF/Compile/Export.hs index d6780147e..81d9e3140 100644 --- a/src-3.0/GF/Compile/Export.hs +++ b/src-3.0/GF/Compile/Export.hs @@ -1,11 +1,13 @@ module GF.Compile.Export where -import PGF.Data (PGF) +import PGF.CId +import PGF.Data (PGF(..)) import PGF.Raw.Print (printTree) import PGF.Raw.Convert (fromPGF) import GF.Compile.GFCCtoHaskell import GF.Compile.GFCCtoJS import GF.Infra.Option +import GF.Speech.SRGS import GF.Text.UTF8 -- top-level access to code generation @@ -16,10 +18,18 @@ prPGF :: OutputFormat -- module name. -> String prPGF fmt gr name = case fmt of - FmtPGF -> printPGF gr - FmtJavaScript -> pgf2js gr - FmtHaskell -> grammar2haskell gr name - FmtHaskellGADT -> grammar2haskellGADT gr name + FmtPGF -> printPGF gr + FmtJavaScript -> pgf2js gr + FmtHaskell -> grammar2haskell gr name + FmtHaskell_GADT -> grammar2haskellGADT gr name + FmtSRGS_XML -> srgsXmlPrinter Nothing gr (outputConcr gr) + +-- | Get the name of the concrete syntax to generate output from. +-- FIXME: there should be an option to change this. +outputConcr :: PGF -> CId +outputConcr pgf = case cncnames pgf of + [] -> error "No concrete syntax." + cnc:_ -> cnc printPGF :: PGF -> String printPGF = encodeUTF8 . printTree . fromPGF -- cgit v1.2.3