language-ecmascript-0.17.2.0: JavaScript parser and pretty-printer library

Safe HaskellNone
LanguageHaskell2010

Language.ECMAScript3.PrettyPrint

Description

Pretty-printing JavaScript.

Synopsis

Documentation

class Pretty a where Source #

A class of pretty-printable ECMAScript AST nodes. Will pretty-print correct JavaScript given that the isValid predicate holds for the AST.

Minimal complete definition

prettyPrint

Methods

prettyPrint :: a -> Doc Source #

Pretty-print an ECMAScript AST node. Use render or show to convert Doc to String.

javaScript :: JavaScript a -> Doc Source #

Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.

DEPRECATED: Use prettyPrint instead! Renders a JavaScript program as a document, the show instance of Doc will pretty-print it automatically

renderStatements :: [Statement a] -> String Source #

Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.

DEPRECATED: Use prettyPrint instead! Renders a list of statements as a String

renderExpression :: Expression a -> String Source #

Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.

DEPRECATED: Use prettyPrint instead! Renders a list of statements as a String

class PP a where Source #

Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.

Minimal complete definition

pp

Methods

pp :: a -> Doc Source #

Instances

Pretty a => PP a Source # 

Methods

pp :: a -> Doc Source #

unsafeInExprStmt :: Expression a -> Bool Source #

A predicate to tell if the expression --when pretty-printed-- will begin with "function" or '{' and be thus unsafe to use in an expression statement without wrapping it in '()'.