File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change 1- -- | Pretty-printing JavaScript.
1+ {-# LANGUAGE FlexibleInstances #-}
2+
3+ -- | Pretty-printing JavaScript.
24module Language.ECMAScript3.PrettyPrint
35 (
46 javaScript
57 , renderStatements
68 , renderExpression
9+ , PP (.. )
710 ) where
811
912import Text.PrettyPrint.HughesPJ
1013import Language.ECMAScript3.Syntax
1114import Prelude hiding (maybe )
1215
16+ ------------------------------------------------------------------------------
17+
18+ class PP a where
19+ pp :: a -> Doc
20+
21+ instance PP [Statement a ] where
22+ pp = stmtList
23+
24+ instance PP (Expression a ) where
25+ pp = ppExpression True
26+
27+ instance PP (Statement a ) where
28+ pp = ppStatement
29+
30+ instance PP (ForInit a ) where
31+ pp = forInit
32+
33+ instance PP (LValue a ) where
34+ pp = ppLValue
35+
36+ instance PP InfixOp where
37+ pp = infixOp
38+
39+ instance PP AssignOp where
40+ pp = assignOp
41+
42+ instance PP PrefixOp where
43+ pp = prefixOp
44+
45+
46+ ----------------------------------------------------------------------------
47+
48+
49+
1350-- | Renders a list of statements as a 'String'
1451renderStatements :: [Statement a ] -> String
1552renderStatements = render . stmtList
You can’t perform that action at this time.
0 commit comments