summaryrefslogtreecommitdiff
path: root/src/GF/JavaScript/PrintJS.hs
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2006-12-21 16:48:46 +0000
committerbringert <bringert@cs.chalmers.se>2006-12-21 16:48:46 +0000
commita335b29c0a85ea81ee1017f18dd6f2595d2a5227 (patch)
treee0b4d7356c3bf5cb82e9d7e11ff9e4d3e5f4e764 /src/GF/JavaScript/PrintJS.hs
parent51df5b8a8d562a3ac4b280b37e7ab04279e22d04 (diff)
Meta variables are now treated as functions with name ? in SISR, VoiceXML and JavaScript linearization. VoiceXML now returns the partial result when update() is false.
Diffstat (limited to 'src/GF/JavaScript/PrintJS.hs')
-rw-r--r--src/GF/JavaScript/PrintJS.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/GF/JavaScript/PrintJS.hs b/src/GF/JavaScript/PrintJS.hs
index 16883682f..402e20c9d 100644
--- a/src/GF/JavaScript/PrintJS.hs
+++ b/src/GF/JavaScript/PrintJS.hs
@@ -116,7 +116,7 @@ instance Print Stmt where
instance Print DeclOrExpr where
prt i e = case e of
Decl declvars -> prPrec i 0 (concatD [doc (showString "var") , prt 0 declvars])
- DExpr expr -> prPrec i 0 (concatD [prt 0 expr])
+ DExpr expr -> prPrec i 0 (concatD [prt 1 expr])
instance Print DeclVar where
@@ -146,6 +146,7 @@ instance Print Expr where
EThis -> prPrec i 16 (concatD [doc (showString "this")])
EFun ids stmts -> prPrec i 16 (concatD [doc (showString "function") , doc (showString "(") , prt 0 ids , doc (showString ")") , doc (showString "{") , prt 0 stmts , doc (showString "}")])
EArray exprs -> prPrec i 16 (concatD [doc (showString "[") , prt 0 exprs , doc (showString "]")])
+ EObj propertys -> prPrec i 16 (concatD [doc (showString "{") , prt 0 propertys , doc (showString "}")])
ESeq exprs -> prPrec i 16 (concatD [doc (showString "(") , prt 0 exprs , doc (showString ")")])
prtList es = case es of
@@ -153,4 +154,13 @@ instance Print Expr where
[x] -> (concatD [prt 0 x])
x:xs -> (concatD [prt 0 x , doc (showString ",") , prt 0 xs])
+instance Print Property where
+ prt i e = case e of
+ Prop id expr -> prPrec i 0 (concatD [prt 0 id , doc (showString ":") , prt 0 expr])
+
+ prtList es = case es of
+ [] -> (concatD [])
+ [x] -> (concatD [prt 0 x])
+ x:xs -> (concatD [prt 0 x , doc (showString ",") , prt 0 xs])
+