<commit_before>-- |Pretty-printing JavaScript.
module Language.ECMAScript3.PrettyPrint
  ( 
  javaScript
  , renderStatements
  , renderExpression
  ) where

import Text.PrettyPrint.HughesPJ
import Language.ECMAScript3.Syntax
import Prelude hiding (maybe)

-- | Renders a list of statements as a 'String'
renderStatements :: [Statement a] -> String
renderStatements = render . stmtList
<commit_msg>what, where is PP<commit_after>{-# LANGUAGE FlexibleInstances #-}

-- | Pretty-printing JavaScript.
module Language.ECMAScript3.PrettyPrint
  ( 
  javaScript
  , renderStatements
  , renderExpression
  , PP (..)
  ) where

import Text.PrettyPrint.HughesPJ
import Language.ECMAScript3.Syntax
import Prelude hiding (maybe)

------------------------------------------------------------------------------

class PP a where 
  pp :: a -> Doc

instance PP [Statement a] where 
  pp = stmtList 

instance PP (Expression a) where 
  pp = ppExpression True

instance PP (Statement a) where 
  pp = ppStatement

instance PP (ForInit a) where 
  pp = forInit 

instance PP (LValue a) where 
  pp = ppLValue 

instance PP InfixOp where 
  pp = infixOp 

instance PP AssignOp where 
  pp = assignOp

instance PP PrefixOp where 
  pp = prefixOp


----------------------------------------------------------------------------



-- | Renders a list of statements as a 'String'
renderStatements :: [Statement a] -> String
renderStatements = render . stmtList

{'fraction_non_alphanumeric': 0.1763888888888889, 'fraction_numerical': 0.002777777777777778, 'mean_word_length': 2.3511627906976744, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '397883', 'n_tokens_mistral': 429, 'n_tokens_neox': 406, 'n_words': 131}