From d4e0caa05339f4a141f85f9a61d634f89037146b Mon Sep 17 00:00:00 2001 From: aarne Date: Mon, 26 May 2008 14:50:17 +0000 Subject: printing options for source GF terms defined in API and used in cc command --- src-3.0/GF/Grammar/API.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src-3.0/GF/Grammar/API.hs') diff --git a/src-3.0/GF/Grammar/API.hs b/src-3.0/GF/Grammar/API.hs index 57936ac45..bfbfb3d14 100644 --- a/src-3.0/GF/Grammar/API.hs +++ b/src-3.0/GF/Grammar/API.hs @@ -4,7 +4,8 @@ module GF.Grammar.API ( pTerm, prTerm, checkTerm, - computeTerm + computeTerm, + showTerm ) where import GF.Source.ParGF @@ -21,6 +22,8 @@ import GF.Compile.CheckGrammar (justCheckLTerm) import GF.Compile.Compute (computeConcrete) import GF.Data.Operations +import GF.Infra.Option + import qualified Data.ByteString.Char8 as BS type Grammar = SourceGrammar @@ -49,3 +52,9 @@ checkTermAny gr m t = do computeTerm :: Grammar -> Term -> Err Term computeTerm = computeConcrete +showTerm :: Options -> Term -> String +showTerm opts t + | oElem (iOpt "table") opts = unlines [p +++ s | (p,s) <- prTermTabular t] + | oElem (iOpt "all") opts = unlines [ s | (p,s) <- prTermTabular t] + | oElem (iOpt "unqual") opts = prt_ t + | otherwise = prt t -- cgit v1.2.3