summaryrefslogtreecommitdiff
path: root/src/GF/UseGrammar
diff options
context:
space:
mode:
authoraarne <unknown>2004-06-10 14:34:07 +0000
committeraarne <unknown>2004-06-10 14:34:07 +0000
commit3522b2a3cd8d01ef1b908c1a717b0592332a5737 (patch)
tree9be8653f1d4be2b4ae5556356fc5af7c391a6bbd /src/GF/UseGrammar
parentf07087647e12938ac070f82261bd238be56b7c3b (diff)
readfiles
Diffstat (limited to 'src/GF/UseGrammar')
-rw-r--r--src/GF/UseGrammar/Linear.hs8
1 files changed, 6 insertions, 2 deletions
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