From 3522b2a3cd8d01ef1b908c1a717b0592332a5737 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 10 Jun 2004 14:34:07 +0000 Subject: readfiles --- src/GF/UseGrammar/Linear.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/GF/UseGrammar') diff --git a/src/GF/UseGrammar/Linear.hs b/src/GF/UseGrammar/Linear.hs index 8e9deb3c5..954500822 100644 --- a/src/GF/UseGrammar/Linear.hs +++ b/src/GF/UseGrammar/Linear.hs @@ -125,12 +125,16 @@ unlex = concat . map sstr . take 1 ---- -- finally, a top-level function to get a string from an expression linTree2string :: Marker -> CanonGrammar -> Ident -> A.Tree -> String -linTree2string mk gr m e = err id id $ do +linTree2string mk gr m e = head $ linTree2strings mk gr m e -- never empty + +-- you can also get many strings +linTree2strings :: Marker -> CanonGrammar -> Ident -> A.Tree -> [String] +linTree2strings mk gr m e = err return id $ do t <- linearizeToRecord gr mk m e r <- expandLinTables gr t ts <- rec2strTables r let ss = strs2strings $ sTables2strs $ strTables2sTables ts - ifNull (prtBad "empty linearization of" e) (return . head) ss + ifNull (prtBad "empty linearization of" e) return ss -- thus never empty -- argument is a Tree, value is a list of strs; needed in Parsing -- cgit v1.2.3