This library provides facilities for pretty-printing JavaScript source. It can be required via:
This library depends on the pprint package, which can be required via:
(require pprint)
See the documentation for pprint for information on how to use it.
procedure
( format-term term)→doc?
term:Term/X?
procedure
( format-source-element element)→doc?
element:SourceElement?
procedure
( format-variable-initializer init)→doc?
init:VariableInitializer?
procedure
( format-declaration decl)→doc?
decl:Declaration?
procedure
( format-expression expr)→doc?
expr:Expression/X?
procedure
( format-subexpression exprparent)→doc?
expr:Expression?parent:Expression?
procedure
( format-statement stmt)→doc?
stmt:Statement/X?
procedure
( format-nested-substatement stmt)→doc?
stmt:SubStatement/X?
procedure
( format-substatement stmt)→doc?
stmt:SubStatement/X?
procedure
( format-case-clause clause)→doc?
clause:CaseClause?
procedure
( format-property property)→doc?
property:Property?
procedure
( format-identifier id)→doc?
id:Identifier?
value
As described in Extending the Language, it is possible to extend the language with custom forms. The pretty-printer can be extended with extra matchers that recognize just their form types and produce pretty-printed docs. Matchers should simple fail to match (raising the same error as (match) would for anything other than the forms they recognize.
value
formatters/Expression :(parameter/c (listof (any -> doc?)))
value
formatters/Statement :(parameter/c (listof (any -> doc?)))
value
formatters/ExpressionList :(parameter/c (listof (any -> doc?)))
value
formatters/StatementList :(parameter/c (listof (any -> doc?)))
procedure
( format-map feltsparam)→c