From a7f2010c6a0c0d2b511ed71cf6c016ffac1d4af8 Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 20 Dec 2006 20:22:08 +0000 Subject: [PATCH] Make smaller SISR code for tokens. --- src/GF/Speech/SISR.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GF/Speech/SISR.hs b/src/GF/Speech/SISR.hs index 6e035afb4..bc1da64ae 100644 --- a/src/GF/Speech/SISR.hs +++ b/src/GF/Speech/SISR.hs @@ -60,8 +60,12 @@ catSISR t (c,i) fmt | otherwise = [] profileFinalSISR :: CFTerm -> SISRFormat -> SISRTag -profileFinalSISR term fmt = [fmtOut fmt `ass` f term] - where f (CFObj n ts) = +profileFinalSISR term fmt = g term + where + -- optimization for tokens + g (CFObj n []) = [field (fmtOut fmt) "name" `ass` JS.EStr (prIdent n)] + g t = [fmtOut fmt `ass` f t] + f (CFObj n ts) = JS.ESeq $ [ret `ass` JS.ENew (JS.Ident "Object") [], field ret "name" `ass` JS.EStr (prIdent n)] ++ [field ret ("arg"++show i) `ass` f t