summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-09-03 08:58:04 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-09-03 08:58:04 +0000
commit027fd911b6c3dcf4f8636ca230fe511f132cbddd (patch)
tree66eda60d08e5db428674aed24a8fa0e58ed4d55d /src
parentdf26b134fc13cee4c854afd4306d847873885270 (diff)
fix for linearization with 'pre'
Diffstat (limited to 'src')
-rw-r--r--src/runtime/haskell/PGF/Macros.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/runtime/haskell/PGF/Macros.hs b/src/runtime/haskell/PGF/Macros.hs
index bfce7dd49..2497d53ae 100644
--- a/src/runtime/haskell/PGF/Macros.hs
+++ b/src/runtime/haskell/PGF/Macros.hs
@@ -178,9 +178,9 @@ lengthBracketedString (Leaf _) = 1
lengthBracketedString (Bracket _ _ _ _ _ bss) = sum (map lengthBracketedString bss)
untokn :: Maybe String -> BracketedTokn -> (Maybe String,[BracketedString])
-untokn nw (LeafKS ts) = (has_tok nw (head ts),map Leaf ts)
-untokn nw (LeafKP d vs) = let ts = sel d vs nw
- in (has_tok nw (head ts),map Leaf ts)
+untokn nw (LeafKS ts) = (has_tok nw ts,map Leaf ts)
+untokn nw (LeafKP d vs) = let ts = filter (not . null) (sel d vs nw)
+ in (has_tok nw ts,map Leaf ts)
where
sel d vs Nothing = d
sel d vs (Just w) =
@@ -191,9 +191,8 @@ untokn nw (Bracket_ cat fid index fun es bss) =
let (nw',bss') = mapAccumR untokn nw bss
in (nw',[Bracket cat fid index fun es (concat bss')])
-has_tok nw t
- | null t = nw
- | otherwise = Just t
+has_tok nw [] = nw
+has_tok nw (t:ts) = Just t
type CncType = (CId, FId) -- concrete type is the abstract type (the category) + the forest id