From df26b134fc13cee4c854afd4306d847873885270 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Tue, 3 Sep 2013 07:51:25 +0000 Subject: fix in the GF compiler and runtime which let us to define pre construct detecting whether this is the last token. --- src/runtime/haskell/PGF/Linearize.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/runtime/haskell/PGF/Linearize.hs') diff --git a/src/runtime/haskell/PGF/Linearize.hs b/src/runtime/haskell/PGF/Linearize.hs index d24e98d38..cf4c78193 100644 --- a/src/runtime/haskell/PGF/Linearize.hs +++ b/src/runtime/haskell/PGF/Linearize.hs @@ -23,7 +23,7 @@ import qualified Data.Set as Set -- | Linearizes given expression as string in the language linearize :: PGF -> Language -> Tree -> String -linearize pgf lang = concat . take 1 . map (unwords . concatMap flattenBracketedString . snd . untokn "" . firstLin) . linTree pgf lang +linearize pgf lang = concat . take 1 . map (unwords . concatMap flattenBracketedString . snd . untokn Nothing . firstLin) . linTree pgf lang -- | The same as 'linearizeAllLang' but does not return -- the language. @@ -37,7 +37,7 @@ linearizeAllLang pgf t = [(lang,linearize pgf lang t) | lang <- Map.keys (concre -- | Linearizes given expression as a bracketed string in the language bracketedLinearize :: PGF -> Language -> Tree -> BracketedString -bracketedLinearize pgf lang = head . concat . map (snd . untokn "" . firstLin) . linTree pgf lang +bracketedLinearize pgf lang = head . concat . map (snd . untokn Nothing . firstLin) . linTree pgf lang where -- head [] = error "cannot linearize" head [] = Leaf "" @@ -53,7 +53,7 @@ firstLin (_,arr) tabularLinearizes :: PGF -> Language -> Expr -> [[(String,String)]] tabularLinearizes pgf lang e = map cnv (linTree pgf lang e) where - cnv ((cat,_),lin) = zip (lbls cat) $ map (unwords . concatMap flattenBracketedString . snd . untokn "") (elems lin) + cnv ((cat,_),lin) = zip (lbls cat) $ map (unwords . concatMap flattenBracketedString . snd . untokn Nothing) (elems lin) lbls cat = case Map.lookup cat (cnccats (lookConcr pgf lang)) of Just (CncCat _ _ lbls) -> elems lbls -- cgit v1.2.3