diff --git a/src/GF/Speech/GrammarToVoiceXML.hs b/src/GF/Speech/GrammarToVoiceXML.hs index b48af5a57..2924f0513 100644 --- a/src/GF/Speech/GrammarToVoiceXML.hs +++ b/src/GF/Speech/GrammarToVoiceXML.hs @@ -161,7 +161,7 @@ fun2sub gr cat fun args = [param "old" v, filled [] [assign v (s++".term")]] where s = prid fun ++ "_" ++ show n - v = "term.children["++show n++"]" + v = "term.args["++show n++"]" catFormId :: VIdent -> String catFormId c = prid c ++ "_cat" diff --git a/src/GF/Speech/SISR.hs b/src/GF/Speech/SISR.hs index 9e926c72f..2999a74a2 100644 --- a/src/GF/Speech/SISR.hs +++ b/src/GF/Speech/SISR.hs @@ -43,20 +43,20 @@ topCatSISR c fmt = map JS.DExpr [fmtOut fmt `ass` fmtRef fmt c] profileInitSISR :: CFTerm -> SISRFormat -> SISRTag profileInitSISR t fmt - | null (usedChildren t) = [] - | otherwise = [JS.Decl [JS.DInit children (JS.EArray [])]] + | null (usedArgs t) = [] + | otherwise = [JS.Decl [JS.DInit args (JS.EArray [])]] -usedChildren :: CFTerm -> [Int] -usedChildren (CFObj _ ts) = foldr union [] (map usedChildren ts) -usedChildren (CFAbs _ x) = usedChildren x -usedChildren (CFApp x y) = usedChildren x `union` usedChildren y -usedChildren (CFRes i) = [i] -usedChildren _ = [] +usedArgs :: CFTerm -> [Int] +usedArgs (CFObj _ ts) = foldr union [] (map usedArgs ts) +usedArgs (CFAbs _ x) = usedArgs x +usedArgs (CFApp x y) = usedArgs x `union` usedArgs y +usedArgs (CFRes i) = [i] +usedArgs _ = [] catSISR :: CFTerm -> SRGNT -> SISRFormat -> SISRTag catSISR t (c,i) fmt - | i `elem` usedChildren t = map JS.DExpr - [JS.EIndex (JS.EVar children) (JS.EInt (fromIntegral i)) `ass` fmtRef fmt c] + | i `elem` usedArgs t = map JS.DExpr + [JS.EIndex (JS.EVar args) (JS.EInt (fromIntegral i)) `ass` fmtRef fmt c] | otherwise = [] profileFinalSISR :: CFTerm -> SISRFormat -> SISRTag @@ -65,7 +65,7 @@ profileFinalSISR term fmt = [JS.DExpr $ fmtOut fmt `ass` f term] f (CFObj n ts) = tree (prIdent n) (map f ts) f (CFAbs v x) = JS.EFun [var v] [JS.SReturn (f x)] f (CFApp x y) = JS.ECall (f x) [f y] - f (CFRes i) = JS.EIndex (JS.EVar children) (JS.EInt (fromIntegral i)) + f (CFRes i) = JS.EIndex (JS.EVar args) (JS.EInt (fromIntegral i)) f (CFVar v) = JS.EVar (var v) f (CFConst s) = JS.EStr s f (CFMeta typ) = obj [("name",JS.EStr "?"), ("type",JS.EStr typ)] @@ -74,7 +74,7 @@ fmtOut SISROld = JS.EVar (JS.Ident "$") fmtRef SISROld c = JS.EVar (JS.Ident ("$" ++ c)) -children = JS.Ident "c" +args = JS.Ident "a" var v = JS.Ident ("x" ++ show v) @@ -82,7 +82,7 @@ field x y = JS.EMember x (JS.Ident y) ass = JS.EAssign -tree n xs = obj [("name", JS.EStr n), ("children", JS.EArray xs)] +tree n xs = obj [("name", JS.EStr n), ("args", JS.EArray xs)] obj ps = JS.EObj [JS.Prop (JS.Ident x) y | (x,y) <- ps]