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

Safe HaskellNone
LanguageHaskell2010

Language.ECMAScript3.Syntax.Arbitrary

Contents

Description

QuickCheck $Arbitrary$ instances for ECMAScript 3 abstract syntax.

Synopsis

Documentation

cshrink :: Arbitrary a => [a] -> [a] Source #

type LabelSubst = Map (Id ()) (Id ()) Source #

class Fixable a where Source #

A class of AST elements that need fixup after generation

Minimal complete definition

fixUp

Methods

fixUp :: a -> Gen a Source #

Instances

Data a => Fixable (Statement a) Source # 

Methods

fixUp :: Statement a -> Gen (Statement a) Source #

Data a => Fixable (ForInInit a) Source # 

Methods

fixUp :: ForInInit a -> Gen (ForInInit a) Source #

Data a => Fixable (ForInit a) Source # 

Methods

fixUp :: ForInit a -> Gen (ForInit a) Source #

Data a => Fixable (VarDecl a) Source # 

Methods

fixUp :: VarDecl a -> Gen (VarDecl a) Source #

Data a => Fixable (CatchClause a) Source # 
Data a => Fixable (CaseClause a) Source # 

Methods

fixUp :: CaseClause a -> Gen (CaseClause a) Source #

Data a => Fixable (Expression a) Source # 

Methods

fixUp :: Expression a -> Gen (Expression a) Source #

Data a => Fixable (LValue a) Source # 

Methods

fixUp :: LValue a -> Gen (LValue a) Source #

Data a => Fixable (Prop a) Source # 

Methods

fixUp :: Prop a -> Gen (Prop a) Source #

Fixable (Id a) Source # 

Methods

fixUp :: Id a -> Gen (Id a) Source #

Data a => Fixable (JavaScript a) Source # 

Methods

fixUp :: JavaScript a -> Gen (JavaScript a) Source #

identifierNameFixup :: String -> String Source #

Renames empty identifiers, as well as identifiers that are keywords or future reserved words by prepending a '_' to them. Also substitutes illegal characters with a "_" as well.

fixBreakContinue :: Data a => [Statement a] -> Gen [Statement a] Source #

Fixes an incorrect nesting of break/continue, making the program abide by the ECMAScript spec (page 92): any continue without a label should be nested within an iteration stmt, any continue with a label should be nested in a labeled statement (not necessarily with the same label); any break statement without a label should be nested in an iteration or switch stmt, any break statement with a label should be nested in a labeled statement (not necessarily with the same label). This is done by either assigning a label (from the set of labels in current scope) to a break/continue statement that doesn't have one (or has a label that's not present in the current scope). Additionally, it removes nested labelled statements with duplicate labels (also a requirement imposed by the spec).

rChooseElem :: [a] -> Int -> Gen [a] Source #

choose n elements from a list randomly

selectRandomElement :: [a] -> Gen a Source #

Selects a random element of the list

Orphan instances

Arbitrary PrefixOp Source # 
Arbitrary UnaryAssignOp Source # 
Arbitrary AssignOp Source # 
Arbitrary InfixOp Source # 
Enumerable PrefixOp Source # 
Enumerable UnaryAssignOp Source # 
Enumerable AssignOp Source # 
Enumerable InfixOp Source # 
(Enumerable a, Arbitrary a, Data a) => Arbitrary (Statement a) Source # 

Methods

arbitrary :: Gen (Statement a) #

shrink :: Statement a -> [Statement a] #

(Enumerable a, Arbitrary a, Data a) => Arbitrary (ForInInit a) Source # 

Methods

arbitrary :: Gen (ForInInit a) #

shrink :: ForInInit a -> [ForInInit a] #

(Enumerable a, Arbitrary a, Data a) => Arbitrary (ForInit a) Source # 

Methods

arbitrary :: Gen (ForInit a) #

shrink :: ForInit a -> [ForInit a] #

(Enumerable a, Arbitrary a, Data a) => Arbitrary (VarDecl a) Source # 

Methods

arbitrary :: Gen (VarDecl a) #

shrink :: VarDecl a -> [VarDecl a] #

(Enumerable a, Arbitrary a, Data a) => Arbitrary (CatchClause a) Source # 
(Enumerable a, Arbitrary a, Data a) => Arbitrary (CaseClause a) Source # 
(Enumerable a, Arbitrary a, Data a) => Arbitrary (Expression a) Source # 
(Data a, Enumerable a, Arbitrary a) => Arbitrary (LValue a) Source # 

Methods

arbitrary :: Gen (LValue a) #

shrink :: LValue a -> [LValue a] #

(Enumerable a, Arbitrary a) => Arbitrary (Prop a) Source # 

Methods

arbitrary :: Gen (Prop a) #

shrink :: Prop a -> [Prop a] #

(Enumerable a, Arbitrary a) => Arbitrary (Id a) Source # 

Methods

arbitrary :: Gen (Id a) #

shrink :: Id a -> [Id a] #

(Data a, Arbitrary a, Enumerable a) => Arbitrary (JavaScript a) Source # 
Enumerable a0 => Enumerable (Statement a0) Source # 
Enumerable a0 => Enumerable (ForInInit a0) Source # 
Enumerable a0 => Enumerable (ForInit a0) Source # 

Methods

enumerate :: Enumerate (ForInit a0) #

Enumerable a0 => Enumerable (VarDecl a0) Source # 

Methods

enumerate :: Enumerate (VarDecl a0) #

Enumerable a0 => Enumerable (CatchClause a0) Source # 
Enumerable a0 => Enumerable (CaseClause a0) Source # 
Enumerable a0 => Enumerable (Expression a0) Source # 
Enumerable a0 => Enumerable (LValue a0) Source # 

Methods

enumerate :: Enumerate (LValue a0) #

Enumerable a0 => Enumerable (Prop a0) Source # 

Methods

enumerate :: Enumerate (Prop a0) #

Enumerable a0 => Enumerable (Id a0) Source # 

Methods

enumerate :: Enumerate (Id a0) #

Enumerable a0 => Enumerable (JavaScript a0) Source #