From 4c77dcf9388315411539b513aaac5f48b5c875ad Mon Sep 17 00:00:00 2001 From: krasimir Date: Fri, 2 Oct 2009 23:34:35 +0000 Subject: merge GF.Grammar.API into GF.Grammar --- src/GF/Grammar/Printer.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/GF/Grammar/Printer.hs') diff --git a/src/GF/Grammar/Printer.hs b/src/GF/Grammar/Printer.hs index e0edadbec..80195b2d1 100644 --- a/src/GF/Grammar/Printer.hs +++ b/src/GF/Grammar/Printer.hs @@ -18,6 +18,8 @@ module GF.Grammar.Printer , ppPatt , ppValue , ppConstrs + + , showTerm, TermPrintStyle(..) ) where import GF.Infra.Ident @@ -301,3 +303,15 @@ getLet :: Term -> ([LocalDef], Term) getLet (Let l e) = let (ls,e') = getLet e in (l:ls,e') getLet e = ([],e) + +showTerm :: TermPrintStyle -> TermPrintQual -> Term -> String +showTerm style q t = render $ + case style of + TermPrintTable -> vcat [p <+> s | (p,s) <- ppTermTabular q t] + TermPrintAll -> vcat [ s | (p,s) <- ppTermTabular q t] + TermPrintDefault -> ppTerm q 0 t + +data TermPrintStyle + = TermPrintTable + | TermPrintAll + | TermPrintDefault -- cgit v1.2.3