summaryrefslogtreecommitdiff
path: root/src-3.0/GF/Grammar/API.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-05-26 14:50:17 +0000
committeraarne <aarne@cs.chalmers.se>2008-05-26 14:50:17 +0000
commitd4e0caa05339f4a141f85f9a61d634f89037146b (patch)
tree2de6f7bf5d49439511e971e393a6f42b0d2bc88e /src-3.0/GF/Grammar/API.hs
parent7d0da72db1bf4da1cd5404c56e55e55d0a4cb98c (diff)
printing options for source GF terms defined in API and used in cc command
Diffstat (limited to 'src-3.0/GF/Grammar/API.hs')
-rw-r--r--src-3.0/GF/Grammar/API.hs11
1 files changed, 10 insertions, 1 deletions
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