summaryrefslogtreecommitdiff
path: root/src-3.0/PGF
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-22 19:02:09 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-22 19:02:09 +0000
commit0f205f67d409e07aa1f9b95824e7a2d429130edb (patch)
treefc4811f6d874ebbec84643fb90936d74219a7f17 /src-3.0/PGF
parente9b21c92a046adad2132087355400af703f54d3e (diff)
threaded string operations to strings if given as options to linearize
Diffstat (limited to 'src-3.0/PGF')
-rw-r--r--src-3.0/PGF/ShowLinearize.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src-3.0/PGF/ShowLinearize.hs b/src-3.0/PGF/ShowLinearize.hs
index aeb711b7a..663264d63 100644
--- a/src-3.0/PGF/ShowLinearize.hs
+++ b/src-3.0/PGF/ShowLinearize.hs
@@ -54,20 +54,20 @@ mkRecord typ trm = case (typ,trm) of
str = realize
-- show all branches, without labels and params
-allLinearize :: PGF -> CId -> Tree -> String
-allLinearize pgf lang = concat . map pr . tabularLinearize pgf lang where
+allLinearize :: (String -> String) -> PGF -> CId -> Tree -> String
+allLinearize unlex pgf lang = concat . map (unlex . pr) . tabularLinearize pgf lang where
pr (p,vs) = unlines vs
-- show all branches, with labels and params
-tableLinearize :: PGF -> CId -> Tree -> String
-tableLinearize pgf lang = unlines . map pr . tabularLinearize pgf lang where
- pr (p,vs) = p +++ ":" +++ unwords (intersperse "|" vs)
+tableLinearize :: (String -> String) -> PGF -> CId -> Tree -> String
+tableLinearize unlex pgf lang = unlines . map pr . tabularLinearize pgf lang where
+ pr (p,vs) = p +++ ":" +++ unwords (intersperse "|" (map unlex vs))
-- create a table from labels+params to variants
tabularLinearize :: PGF -> CId -> Tree -> [(String,[String])]
tabularLinearize pgf lang = branches . recLinearize pgf lang where
branches r = case r of
- RR fs -> [(lab +++ b,s) | (lab,t) <- fs, (b,s) <- branches t]
+ RR fs -> [( b,s) | (lab,t) <- fs, (b,s) <- branches t]
RT fs -> [(lab +++ b,s) | (lab,t) <- fs, (b,s) <- branches t]
RFV rs -> [([], ss) | (_,ss) <- concatMap branches rs]
RS s -> [([], [s])]