diff --git a/src/Category.hs b/src/Category.hs index 332c6cf1b..d15ce2965 100644 --- a/src/Category.hs +++ b/src/Category.hs @@ -222,6 +222,8 @@ data Category | FieldDeclarations -- | A Go rune literal. | RuneLiteral + -- | A modifier version of another Category, e.g. Ruby’s trailing @if@, @while@, etc. terms, whose subterms are swapped relative to regular @if@, @while@, etc. terms. + | Modifier Category deriving (Eq, Generic, Ord, Show) -- Instances @@ -347,3 +349,4 @@ instance Listable Category where \/ cons0 FieldDeclarations \/ cons0 RuneLiteral \/ cons1 (Other . unListableText) + \/ cons1 Modifier diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index 269355cdf..08b4afff5 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -477,6 +477,7 @@ instance HasCategory Category where C.QualifiedIdentifier -> "qualified identifier" C.FieldDeclarations -> "field declarations" C.RuneLiteral -> "rune literal" + C.Modifier c -> toCategoryName c <> " modifier" instance HasField fields Category => HasCategory (SyntaxTerm leaf fields) where toCategoryName = toCategoryName . category . extract diff --git a/src/Renderer/Split.hs b/src/Renderer/Split.hs index c7be17803..f70a0f2c9 100644 --- a/src/Renderer/Split.hs +++ b/src/Renderer/Split.hs @@ -145,6 +145,7 @@ styleName category = "category-" <> case category of C.IndexExpression -> "index_expression" C.FieldDeclarations -> "field_declarations" C.RuneLiteral -> "rune_literal" + C.Modifier c -> styleName c <> "_modifier" -- | Pick the class name for a split patch. splitPatchToClassName :: SplitPatch a -> AttributeValue