summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-12-14 17:42:42 +0000
committeraarne <aarne@chalmers.se>2010-12-14 17:42:42 +0000
commit4a5d8d9f553df8dae848adeee99117c83caff03e (patch)
treeac28f3ed62af85087f03425fabe12d6e59d5eacd /src/compiler
parent505e34aea788db30da26ce852755c5a432038527 (diff)
option cc -list added
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/GF/Command/Commands.hs1
-rw-r--r--src/compiler/GF/Grammar/ShowTerm.hs14
-rw-r--r--src/compiler/GFI.hs1
3 files changed, 10 insertions, 6 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs
index a07ad014a..7d78f9e14 100644
--- a/src/compiler/GF/Command/Commands.hs
+++ b/src/compiler/GF/Command/Commands.hs
@@ -216,6 +216,7 @@ allCommands env@(pgf, mos) = Map.fromList [
],
options = [
("all","pick all strings (forms and variants) from records and tables"),
+ ("list","all strings, comma-separated on one line"),
("one","pick the first strings, if there is any, from records and tables"),
("table","show all strings labelled by parameters"),
("unqual","hide qualifying module names")
diff --git a/src/compiler/GF/Grammar/ShowTerm.hs b/src/compiler/GF/Grammar/ShowTerm.hs
index 7fc9ba4bf..8f64fbc5a 100644
--- a/src/compiler/GF/Grammar/ShowTerm.hs
+++ b/src/compiler/GF/Grammar/ShowTerm.hs
@@ -9,12 +9,13 @@ import Text.PrettyPrint
import Data.List (intersperse)
showTerm :: SourceGrammar -> TermPrintStyle -> TermPrintQual -> Term -> String
-showTerm gr style q t = render $
- case style of
- TermPrintTable -> vcat [p <+> s | (p,s) <- ppTermTabular gr q t]
- TermPrintAll -> vcat [ s | (p,s) <- ppTermTabular gr q t]
- TermPrintOne -> vcat [ s | (p,s) <- take 1 (ppTermTabular gr q t)]
- TermPrintDefault -> ppTerm q 0 t
+showTerm gr sty q t = case sty of
+ TermPrintTable -> render $ vcat [p <+> s | (p,s) <- ppTermTabular gr q t]
+ TermPrintAll -> render $ vcat [ s | (p,s) <- ppTermTabular gr q t]
+ TermPrintList -> renderStyle (style{mode = OneLineMode}) $
+ vcat (punctuate comma [s | (p,s) <- ppTermTabular gr q t])
+ TermPrintOne -> render $ vcat [ s | (p,s) <- take 1 (ppTermTabular gr q t)]
+ TermPrintDefault -> render $ ppTerm q 0 t
ppTermTabular :: SourceGrammar -> TermPrintQual -> Term -> [(Doc,Doc)]
ppTermTabular gr q = pr where
@@ -38,5 +39,6 @@ ppTermTabular gr q = pr where
data TermPrintStyle
= TermPrintTable
| TermPrintAll
+ | TermPrintList
| TermPrintOne
| TermPrintDefault
diff --git a/src/compiler/GFI.hs b/src/compiler/GFI.hs
index 49e68c024..53784ec10 100644
--- a/src/compiler/GFI.hs
+++ b/src/compiler/GFI.hs
@@ -111,6 +111,7 @@ loop opts gfenv0 = do
let
pOpts style q ("-table" :ws) = pOpts TermPrintTable q ws
pOpts style q ("-all" :ws) = pOpts TermPrintAll q ws
+ pOpts style q ("-list" :ws) = pOpts TermPrintList q ws
pOpts style q ("-one" :ws) = pOpts TermPrintOne q ws
pOpts style q ("-default":ws) = pOpts TermPrintDefault q ws
pOpts style q ("-unqual" :ws) = pOpts style Unqualified ws