Safe Haskell | None |
---|
QuickCheck $Arbitrary$ instances for ECMAScript 3 abstract syntax.
- cshrink :: Arbitrary a => [a] -> [a]
- identifier :: Gen String
- type MSGen a = (Int, Gen a)
- sGen :: [MSGen a] -> Gen a
- recursive :: Gen a -> Gen a
- rarbitrary :: Arbitrary a => Gen a
- rrarbitrary :: Arbitrary a => Gen a
- atLeastOfSize :: Arbitrary a => Int -> Gen a -> Gen a
- listOfN :: Arbitrary a => Int -> Gen a -> Gen [a]
- nonEmptyString :: Gen String
- regexpBody :: Gen String
- nonNegative :: (Arbitrary a, Num a) => Gen a
- stringOfLength :: Int -> Gen String
- emptyStmtShrink :: Arbitrary a => a -> [Statement a]
- type LabelSubst = Map (Id ()) (Id ())
- emptyConstantPool :: Map k a
- fixLabels :: Data a => JavaScript a -> Gen (JavaScript a)
- rChooseElem :: [a] -> Int -> Gen [a]
- isProgramFixable :: Data a => JavaScript a -> Bool
- isBreakContinueFixable :: Data a => Statement a -> Bool -> Bool -> Bool -> Bool
- removeDuplicateLabels :: Data a => JavaScript a -> Gen (JavaScript a)
- selectRandomElement :: [a] -> Gen a
- fixBreakContinueLabels :: Data a => JavaScript a -> Gen (JavaScript a)
- isSwitchStmt :: Statement a -> Bool
Documentation
rarbitrary :: Arbitrary a => Gen aSource
rrarbitrary :: Arbitrary a => Gen aSource
nonNegative :: (Arbitrary a, Num a) => Gen aSource
stringOfLength :: Int -> Gen StringSource
emptyStmtShrink :: Arbitrary a => a -> [Statement a]Source
type LabelSubst = Map (Id ()) (Id ())Source
emptyConstantPool :: Map k aSource
fixLabels :: Data a => JavaScript a -> Gen (JavaScript a)Source
Fixes labels so that labeled breaks and continues refer to
existing labeled statements, enclosing them; also, reduces the size
of the label set. Assumes that the program has a proper syntactic
structure, i.e. isProgramFixable
s = True.
rChooseElem :: [a] -> Int -> Gen [a]Source
choose n elements from a list randomly
isProgramFixable :: Data a => JavaScript a -> BoolSource
A predicate that tells us whether a program has a fixable/correct label-break/continue structure. The predicate imposes syntactic restrictions on the break, continue and labeled statements as in the ECMA spec
isBreakContinueFixable :: Data a => Statement a -> Bool -> Bool -> Bool -> BoolSource
Imposes relaxed restrictions on break and continue per ECMAScript 5 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).
removeDuplicateLabels :: Data a => JavaScript a -> Gen (JavaScript a)Source
Removes duplicate labels from nested labeled statements in order to impose restrictions on labeled statements as per ECMAScript 5 spec (page 95): nested labeled statements cannot have duplicating labels.
selectRandomElement :: [a] -> Gen aSource
Selects a random element of the list
fixBreakContinueLabels :: Data a => JavaScript a -> Gen (JavaScript a)Source
Changes labels of break/continue so that they refer to one of the enclosing labels
isSwitchStmt :: Statement a -> BoolSource