summaryrefslogtreecommitdiff
path: root/src/GF/JavaScript/PrintJS.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/JavaScript/PrintJS.hs')
-rw-r--r--src/GF/JavaScript/PrintJS.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/GF/JavaScript/PrintJS.hs b/src/GF/JavaScript/PrintJS.hs
index 79829dec8..af9504c74 100644
--- a/src/GF/JavaScript/PrintJS.hs
+++ b/src/GF/JavaScript/PrintJS.hs
@@ -1,5 +1,5 @@
{-# OPTIONS -fno-warn-incomplete-patterns #-}
-module GF.JavaScript.PrintJS where
+module GF.JavaScript.PrintJS (printTree, Doc, Print(..)) where
-- pretty-printer generated by the BNF converter
@@ -25,8 +25,10 @@ render d = rend 0 (map ($ "") $ d []) "" where
"}" :ts -> new (i-1) . showChar '}' . new (i-1) . rend (i-1) ts
";" :ts -> showChar ';' . new i . rend i ts
t : "," :ts -> showString t . space "," . rend i ts
+ t : "." :ts -> showString t . showString "." . rend i ts
t : ")" :ts -> showString t . showChar ')' . rend i ts
t : "]" :ts -> showString t . showChar ']' . rend i ts
+ t : "[" :ts -> showString t . showChar '[' . rend i ts
t :ts -> space t . rend i ts
_ -> id
new i = showChar '\n' . replicateS (2*i) (showChar ' ') . dropWhile isSpace
@@ -143,6 +145,7 @@ instance Print Expr where
ENull -> prPrec i 16 (concatD [doc (showString "null")])
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 "}")])
+ ESeq exprs -> prPrec i 16 (concatD [doc (showString "(") , prt 0 exprs , doc (showString ")")])
prtList es = case es of
[] -> (concatD [])