diff --git a/src/Language/Haskell/Assignment.hs b/src/Language/Haskell/Assignment.hs index e7d9fc25f..4e3ea16ac 100644 --- a/src/Language/Haskell/Assignment.hs +++ b/src/Language/Haskell/Assignment.hs @@ -85,10 +85,16 @@ type Syntax = '[ , Syntax.QualifiedEntityIdentifier , Syntax.QualifiedImportDeclaration , Syntax.QuasiQuotation + , Syntax.QuasiQuotationDeclaration , Syntax.QuasiQuotationExpression + , Syntax.QuasiQuotationExpressionBody + , Syntax.QuasiQuotationPattern + , Syntax.QuasiQuotationQuoter + , Syntax.QuasiQuotationType , Syntax.QuotedName , Syntax.RecordDataConstructor , Syntax.ScopedTypeVariables + , Syntax.Splice , Syntax.StandaloneDerivingInstance , Syntax.Star , Syntax.StrictType @@ -274,9 +280,15 @@ expressionChoices = [ , qualifiedTypeConstructorIdentifier , qualifiedVariableIdentifier , quasiQuotation + , quasiQuotationDeclaration , quasiQuotationExpression + , quasiQuotationExpressionBody + , quasiQuotationPattern + , quasiQuotationQuoter + , quasiQuotationType , quotedName , scopedTypeVariables + , splice , standaloneDerivingInstance , star , strictType @@ -513,10 +525,25 @@ qualifiedVariableIdentifier :: Assignment qualifiedVariableIdentifier = makeTerm <$> symbol QualifiedVariableIdentifier <*> children (Syntax.QualifiedVariableIdentifier <$> someTerm' expression) quasiQuotation :: Assignment -quasiQuotation = makeTerm <$> symbol QuasiQuotation <*> children (Syntax.QuasiQuotation <$> expression <*> expression) +quasiQuotation = makeTerm <$> symbol QuasiQuotation <*> children (Syntax.QuasiQuotation <$> (expression <|> emptyTerm) <*> expression) + +quasiQuotationDeclaration :: Assignment +quasiQuotationDeclaration = makeTerm <$> token QuasiQuotationDeclaration <*> pure Syntax.QuasiQuotationDeclaration quasiQuotationExpression :: Assignment -quasiQuotationExpression = makeTerm <$> symbol QuasiQuotationExpression <*> (Syntax.QuasiQuotationExpression . Name.name <$> source) +quasiQuotationExpression = makeTerm <$> token QuasiQuotationExpression <*> pure Syntax.QuasiQuotationExpression + +quasiQuotationExpressionBody :: Assignment +quasiQuotationExpressionBody = makeTerm <$> symbol QuasiQuotationExpressionBody <*> (Syntax.QuasiQuotationExpressionBody . Name.name <$> source) + +quasiQuotationPattern :: Assignment +quasiQuotationPattern = makeTerm <$> token QuasiQuotationPattern <*> pure Syntax.QuasiQuotationPattern + +quasiQuotationQuoter :: Assignment +quasiQuotationQuoter = makeTerm <$> symbol QuasiQuotationQuoter <*> (Syntax.QuasiQuotationQuoter . Name.name <$> source) + +quasiQuotationType :: Assignment +quasiQuotationType = makeTerm <$> token QuasiQuotationType <*> pure Syntax.QuasiQuotationType quotedName :: Assignment quotedName = makeTerm <$> symbol QuotedName <*> children (Syntax.QuotedName <$> expression) @@ -524,6 +551,9 @@ quotedName = makeTerm <$> symbol QuotedName <*> children (Syntax.QuotedName <$> scopedTypeVariables :: Assignment scopedTypeVariables = makeTerm <$> symbol ScopedTypeVariables <*> children (Syntax.ScopedTypeVariables <$> expressions <* token Dot) +splice :: Assignment +splice = makeTerm <$> symbol Splice <*> children (Syntax.Splice <$> expression) + standaloneDerivingInstance :: Assignment standaloneDerivingInstance = makeTerm <$> symbol StandaloneDerivingDeclaration <*> children (Syntax.StandaloneDerivingInstance <$> manyTerm (context' <|> scopedTypeVariables) <*> expression <*> instance') where diff --git a/src/Language/Haskell/Syntax.hs b/src/Language/Haskell/Syntax.hs index 9e02a8c5c..80d9e20ef 100644 --- a/src/Language/Haskell/Syntax.hs +++ b/src/Language/Haskell/Syntax.hs @@ -580,7 +580,52 @@ instance Show1 QuasiQuotation where liftShowsPrec = genericLiftShowsPrec instance Evaluatable QuasiQuotation -newtype QuasiQuotationExpression a = QuasiQuotationExpression Name +newtype QuasiQuotationExpressionBody a = QuasiQuotationExpressionBody Name + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 QuasiQuotationExpressionBody where liftEq = genericLiftEq +instance Ord1 QuasiQuotationExpressionBody where liftCompare = genericLiftCompare +instance Show1 QuasiQuotationExpressionBody where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable QuasiQuotationExpressionBody + +data QuasiQuotationPattern a = QuasiQuotationPattern + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 QuasiQuotationPattern where liftEq = genericLiftEq +instance Ord1 QuasiQuotationPattern where liftCompare = genericLiftCompare +instance Show1 QuasiQuotationPattern where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable QuasiQuotationPattern + +data QuasiQuotationType a = QuasiQuotationType + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 QuasiQuotationType where liftEq = genericLiftEq +instance Ord1 QuasiQuotationType where liftCompare = genericLiftCompare +instance Show1 QuasiQuotationType where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable QuasiQuotationType + +data QuasiQuotationDeclaration a = QuasiQuotationDeclaration + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 QuasiQuotationDeclaration where liftEq = genericLiftEq +instance Ord1 QuasiQuotationDeclaration where liftCompare = genericLiftCompare +instance Show1 QuasiQuotationDeclaration where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable QuasiQuotationDeclaration + +newtype QuasiQuotationQuoter a = QuasiQuotationQuoter Name + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 QuasiQuotationQuoter where liftEq = genericLiftEq +instance Ord1 QuasiQuotationQuoter where liftCompare = genericLiftCompare +instance Show1 QuasiQuotationQuoter where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable QuasiQuotationQuoter + +data QuasiQuotationExpression a = QuasiQuotationExpression deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) instance Eq1 QuasiQuotationExpression where liftEq = genericLiftEq @@ -588,3 +633,12 @@ instance Ord1 QuasiQuotationExpression where liftCompare = genericLiftCompare instance Show1 QuasiQuotationExpression where liftShowsPrec = genericLiftShowsPrec instance Evaluatable QuasiQuotationExpression + +newtype Splice a = Splice a + deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable) + +instance Eq1 Splice where liftEq = genericLiftEq +instance Ord1 Splice where liftCompare = genericLiftCompare +instance Show1 Splice where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable Splice diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt b/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt index be1549247..465cdc81d 100644 --- a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt +++ b/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffA-B.txt @@ -55,12 +55,17 @@ (TypeVariableIdentifier)) (TypeVariableIdentifier))) (Empty)) - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (Constructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (TypeParameters)) {+(Constructor {+(ConstructorIdentifier)+} {+(TypeParameters)+})+} @@ -76,106 +81,6 @@ {+(Constructor {+(ConstructorIdentifier)+} {+(TypeParameters)+})+} - {+(Constructor - {+(ConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(Empty)+})+} - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(RecordDataConstructor - {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {+(Empty)+})+} - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(RecordDataConstructor - {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+} - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {+(Empty)+})+} - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(RecordDataConstructor - {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(StrictType - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(TypeParameters)+} - {+(Empty)+})+})+} - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {+(Empty)+})+} - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(RecordDataConstructor - {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+} - {+(VariableIdentifier)+})+} - {+(Type - {+(Context - {+(Pragma)+} - {+(StrictType - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+})+})+} - {+(TypeParameters)+} - {+(Empty)+})+})+} - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {+(Empty)+})+} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} {-(Constructor {-(ConstructorIdentifier)-} {-(TypeParameters)-})-} @@ -191,100 +96,105 @@ {-(Constructor {-(ConstructorIdentifier)-} {-(TypeParameters)-})-} - {-(Constructor - {-(ConstructorIdentifier)-} - {-(TypeParameters)-})-} - {-(Empty)-})-} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-} - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(StrictType - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-})-} - {-(TypeParameters)-} - {-(Empty)-})-})-} - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-} - {-(VariableIdentifier)-})-} - {-(Type - {-(Context - {-(Pragma)-} - {-(StrictType - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-})-})-} - {-(TypeParameters)-} - {-(Empty)-})-})-} - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} + (Empty)) + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier) + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier)) + (Type + (StrictType + (TypeConstructorIdentifier) + (TypeParameters)) + (TypeParameters) + (Empty))) + (Field + (Statements + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier) + (VariableIdentifier)) + (Type + (Context + (Pragma) + (StrictType + (TypeConstructorIdentifier) + (TypeParameters))) + (TypeParameters) + (Empty))) + (Field + (Statements + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) {-(Datatype {-(Empty)-} {-(Type diff --git a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt b/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt index 4fb6135cb..3054526c2 100644 --- a/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt +++ b/test/fixtures/haskell/corpus/algebraic-datatype-declarations.diffB-A.txt @@ -55,66 +55,6 @@ (TypeVariableIdentifier)) (TypeVariableIdentifier))) (Empty)) - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(Constructor - {+(ConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(Constructor - {+(ConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(Constructor - {+(ConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(Constructor - {+(ConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(Constructor - {+(ConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(Constructor - {+(ConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(Empty)+})+} - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(RecordDataConstructor - {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {+(Empty)+})+} - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(RecordDataConstructor - {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+} - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {+(Empty)+})+} (Datatype (Empty) (Type @@ -122,28 +62,25 @@ ->(TypeConstructorIdentifier) } (TypeParameters) (Empty)) - {+(RecordDataConstructor + (Constructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (TypeParameters)) + {+(Constructor {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(StrictType - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+})+} - {+(TypeParameters)+} - {+(Empty)+})+})+} - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {-(Constructor - {-(ConstructorIdentifier)-} - {-(TypeParameters)-})-} + {+(TypeParameters)+})+} + {+(Constructor + {+(ConstructorIdentifier)+} + {+(TypeParameters)+})+} + {+(Constructor + {+(ConstructorIdentifier)+} + {+(TypeParameters)+})+} + {+(Constructor + {+(ConstructorIdentifier)+} + {+(TypeParameters)+})+} + {+(Constructor + {+(ConstructorIdentifier)+} + {+(TypeParameters)+})+} {-(Constructor {-(ConstructorIdentifier)-} {-(TypeParameters)-})-} @@ -160,35 +97,104 @@ {-(ConstructorIdentifier)-} {-(TypeParameters)-})-} (Empty)) - {+(Datatype - {+(Empty)+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+} - {+(RecordDataConstructor - {+(ConstructorIdentifier)+} - {+(Statements - {+(Field - {+(Statements - {+(VariableIdentifier)+} - {+(VariableIdentifier)+})+} - {+(Type - {+(Context - {+(Pragma)+} - {+(StrictType - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+})+})+} - {+(TypeParameters)+} - {+(Empty)+})+})+} - {+(Field - {+(Statements - {+(VariableIdentifier)+})+} - {+(Type - {+(TypeConstructorIdentifier)+} - {+(TypeParameters)+} - {+(Empty)+})+})+})+})+} - {+(Empty)+})+} + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier) + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier)) + (Type + (StrictType + (TypeConstructorIdentifier) + (TypeParameters)) + (TypeParameters) + (Empty))) + (Field + (Statements + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) + (Datatype + (Empty) + (Type + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) } + (TypeParameters) + (Empty)) + (RecordDataConstructor + { (ConstructorIdentifier) + ->(ConstructorIdentifier) } + (Statements + (Field + (Statements + (VariableIdentifier) + (VariableIdentifier)) + (Type + (Context + (Pragma) + (StrictType + (TypeConstructorIdentifier) + (TypeParameters))) + (TypeParameters) + (Empty))) + (Field + (Statements + (VariableIdentifier)) + (Type + (TypeConstructorIdentifier) + (TypeParameters) + (Empty))))) + (Empty)) {+(Datatype {+(Empty)+} {+(Type @@ -216,96 +222,6 @@ {+(TypeParameters)+} {+(Empty)+})+})+})+})+} {+(Empty)+})+} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-} - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(StrictType - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-})-} - {-(TypeParameters)-} - {-(Empty)-})-})-} - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} - {-(Datatype - {-(Empty)-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-} - {-(RecordDataConstructor - {-(ConstructorIdentifier)-} - {-(Statements - {-(Field - {-(Statements - {-(VariableIdentifier)-} - {-(VariableIdentifier)-})-} - {-(Type - {-(Context - {-(Pragma)-} - {-(StrictType - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-})-})-} - {-(TypeParameters)-} - {-(Empty)-})-})-} - {-(Field - {-(Statements - {-(VariableIdentifier)-})-} - {-(Type - {-(TypeConstructorIdentifier)-} - {-(TypeParameters)-} - {-(Empty)-})-})-})-})-} - {-(Empty)-})-} (Datatype (Empty) (Type diff --git a/test/fixtures/haskell/corpus/tempate-haskell.A.hs b/test/fixtures/haskell/corpus/tempate-haskell.A.hs new file mode 100644 index 000000000..87ac0037f --- /dev/null +++ b/test/fixtures/haskell/corpus/tempate-haskell.A.hs @@ -0,0 +1,42 @@ +[|example|] +[e|example|] +[p|example|] +[t|example|] +[d|example|] +[str|example|] + +[ | example| ] +[ e| example| ] +[ p| example| ] +[ t| example| ] +[ d| example| ] +[ str| example| ] + +[ | example | ] +[ e | example | ] +[ p | example | ] +[ t | example | ] +[ d | example | ] +[ str | example | ] +[str|integer,double,varchar,boolean,date,money,enum + |13,3.14159,testing!,false,1900-01-01,$3.99,foo + |12,0.1,a string,true,1929-10-01,12,bar + |] + +[ | [{ "ret_setof_integers": 1 }, + { "ret_setof_integers": 2 }, + { "ret_setof_integers": 3 }] | ] + +[| + [ + { "ret_setof_integers": 1 }, + { "ret_setof_integers": 2 }, + { "ret_setof_integers": 3 } + ] +|] + +f = [|a|] `b` c + +f = $x +f = $(a . b $ c) +$(makeEff ''Embedded) diff --git a/test/fixtures/haskell/corpus/tempate-haskell.parseA.txt b/test/fixtures/haskell/corpus/tempate-haskell.parseA.txt new file mode 100644 index 000000000..013669d36 --- /dev/null +++ b/test/fixtures/haskell/corpus/tempate-haskell.parseA.txt @@ -0,0 +1,100 @@ +(Module + (Empty) + (Statements + (QuasiQuotation + (Empty) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationExpression) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationPattern) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationType) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationDeclaration) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationQuoter) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (Empty) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationExpression) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationPattern) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationType) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationDeclaration) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationQuoter) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (Empty) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationExpression) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationPattern) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationType) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationDeclaration) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationQuoter) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (QuasiQuotationQuoter) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (Empty) + (QuasiQuotationExpressionBody)) + (QuasiQuotation + (Empty) + (QuasiQuotationExpressionBody)) + (Function + (VariableIdentifier) + (Statements + (InfixOperatorApp + (QuasiQuotation + (Empty) + (QuasiQuotationExpressionBody)) + (VariableOperator + (InfixVariableIdentifier)) + (VariableIdentifier)))) + (Function + (VariableIdentifier) + (Statements + (Splice + (VariableIdentifier)))) + (Function + (VariableIdentifier) + (Statements + (Splice + (InfixOperatorApp + (VariableIdentifier) + (VariableOperator + (VariableSymbol)) + (InfixOperatorApp + (VariableIdentifier) + (VariableOperator + (VariableSymbol)) + (VariableIdentifier)))))) + (Splice + (App + (VariableIdentifier) + (QuotedName + (QuotedName + (TypeConstructorIdentifier))))))) diff --git a/test/fixtures/haskell/corpus/template-haskell.B.hs b/test/fixtures/haskell/corpus/template-haskell.B.hs new file mode 100644 index 000000000..c4cb71088 --- /dev/null +++ b/test/fixtures/haskell/corpus/template-haskell.B.hs @@ -0,0 +1,42 @@ +[|example'|] +[e|example'|] +[p|example'|] +[t|example'|] +[d|example'|] +[str|example'|] + +[ | example'| ] +[ e| example'| ] +[ p| example'| ] +[ t| example'| ] +[ d| example'| ] +[ str| example'| ] + +[ | example' | ] +[ e | example' | ] +[ p | example' | ] +[ t | example' | ] +[ d | example' | ] +[ str | example' | ] +[str|integer,double,varchar,boolean,date,money,enum + |12,0.1,a string,true,1929-10-01,12,bar + |13,3.14159,testing!,false,1900-01-01,$3.99,foo + |] + +[ | [{ "ret_setof_integers": 3 }, + { "ret_setof_integers": 4 }, + { "ret_setof_integers": 5 }] | ] + +[| + [ + { "ret_setof_integers": 3 }, + { "ret_setof_integers": 4 }, + { "ret_setof_integers": 5 } + ] +|] + +g = [|a|] `b` c + +g = $x +g = $(a . b $ c) +$(makeEff' ''Embedded) diff --git a/test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt b/test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt index 4fff50387..bcfd0ab5f 100644 --- a/test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt +++ b/test/fixtures/haskell/corpus/type-synonyms.diffA-B.txt @@ -52,17 +52,17 @@ (TypeConstructorIdentifier)) (TypePattern (TupleConstructor))) - (TypeSynonym - (Statements - (TypeConstructorIdentifier)) - (TypePattern - { (FunctionConstructor) - ->(TupleConstructor) })) {+(TypeSynonym {+(Statements {+(TypeConstructorIdentifier)+})+} {+(TypePattern - {+(FunctionConstructor)+})+})+} + {+(TupleConstructor)+})+})+} + (TypeSynonym + (Statements + { (TypeConstructorIdentifier) + ->(TypeConstructorIdentifier) }) + (TypePattern + (FunctionConstructor))) (TypeSynonym (Statements (TypeConstructorIdentifier)) diff --git a/test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt b/test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt index d03474db8..e098b46e7 100644 --- a/test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt +++ b/test/fixtures/haskell/corpus/type-synonyms.diffB-A.txt @@ -52,12 +52,11 @@ (TypeConstructorIdentifier)) (TypePattern (TupleConstructor))) - (TypeSynonym - (Statements - (TypeConstructorIdentifier)) - (TypePattern - { (TupleConstructor) - ->(FunctionConstructor) })) + {+(TypeSynonym + {+(Statements + {+(TypeConstructorIdentifier)+})+} + {+(TypePattern + {+(FunctionConstructor)+})+})+} {+(TypeSynonym {+(Statements {+(TypeConstructorIdentifier)+})+} @@ -115,14 +114,11 @@ {+(TypeConstructorIdentifier)+} {+(TypeVariableIdentifier)+})+})+} {+(Empty)+})+})+})+})+})+} - (TypeSynonym - (Statements - { (TypeConstructorIdentifier) - ->(TypeConstructorIdentifier) } - {+(TypeConstructorIdentifier)+}) - { (TypePattern - {-(FunctionConstructor)-}) - ->(TextElement) }) + {+(TypeSynonym + {+(Statements + {+(TypeConstructorIdentifier)+} + {+(TypeConstructorIdentifier)+})+} + {+(TextElement)+})+} {+(TypeSynonym {+(Statements {+(TypeConstructorIdentifier)+} @@ -171,6 +167,16 @@ {+(TypeConstructorIdentifier)+} {+(TypeVariableIdentifier)+} {+(TypeVariableIdentifier)+})+})+})+})+} + {-(TypeSynonym + {-(Statements + {-(TypeConstructorIdentifier)-})-} + {-(TypePattern + {-(TupleConstructor)-})-})-} + {-(TypeSynonym + {-(Statements + {-(TypeConstructorIdentifier)-})-} + {-(TypePattern + {-(FunctionConstructor)-})-})-} {-(TypeSynonym {-(Statements {-(TypeConstructorIdentifier)-})-}