diff --git a/src/Category.hs b/src/Category.hs index 9f2434a94..332c6cf1b 100644 --- a/src/Category.hs +++ b/src/Category.hs @@ -40,6 +40,8 @@ data Category | Args -- | A string literal. | StringLiteral + -- | An integer literal. + | IntegerLiteral -- | A regex literal. | Regex -- | A return statement. @@ -191,7 +193,7 @@ data Category | EndBlock | ParameterDecl -- | A default case in a switch statement. - | Default + | DefaultCase -- | A type declaration. | TypeDecl | PointerTy @@ -328,7 +330,7 @@ instance Listable Category where \/ cons0 BeginBlock \/ cons0 EndBlock \/ cons0 ParameterDecl - \/ cons0 Default + \/ cons0 DefaultCase \/ cons0 TypeDecl \/ cons0 PointerTy \/ cons0 FieldDecl diff --git a/src/DiffSummary.hs b/src/DiffSummary.hs index f1f4cdd75..8088a97e9 100644 --- a/src/DiffSummary.hs +++ b/src/DiffSummary.hs @@ -263,7 +263,7 @@ toTermName source term = case unwrap term of S.Break expr -> maybe "" toTermName' expr S.Continue expr -> maybe "" toTermName' expr S.BlockStatement children -> termNameFromChildren term children - S.Default children -> termNameFromChildren term children + S.DefaultCase children -> termNameFromChildren term children S.FieldDecl id expr tag -> termNameFromSource id <> (maybe "" (\expr' -> " " <> termNameFromSource expr') expr) <> (maybe "" ((" " <>) . termNameFromSource) tag) where toTermName' = toTermName source termNameFromChildren term children = termNameFromRange (unionRangesFrom (range term) (range <$> children)) @@ -309,7 +309,7 @@ parentContexts contexts = hsep $ either identifiableDoc annotatableDoc <$> conte C.When -> "in a" <+> catName c C.BeginBlock -> "in a" <+> catName c C.EndBlock -> "in an" <+> catName c - C.Default -> "in a" <+> catName c + C.DefaultCase -> "in a" <+> catName c C.TypeDecl -> "in the" <+> squotes (termName t) <+> catName c _ -> "in the" <+> termName t <+> catName c annotatableDoc (c, t) = "of the" <+> squotes (termName t) <+> catName c @@ -461,7 +461,7 @@ instance HasCategory Category where C.BeginBlock -> "BEGIN block" C.EndBlock -> "END block" C.ParameterDecl -> "parameter declaration" - C.Default -> "default statement" + C.DefaultCase -> "default statement" C.TypeDecl -> "type declaration" C.PointerTy -> "pointer type" C.FieldDecl -> "field declaration" diff --git a/src/Language/Go.hs b/src/Language/Go.hs index a2cffa1af..280142437 100644 --- a/src/Language/Go.hs +++ b/src/Language/Go.hs @@ -57,7 +57,7 @@ termConstructor source sourceSpan name range children _ = case name of toCase clause = case toList (unwrap clause) of clause' : rest -> case toList (unwrap clause') of [clause''] -> withCategory Case $ S.Case clause'' rest - [] -> withCategory Default $ S.Default rest + [] -> withCategory DefaultCase $ S.DefaultCase rest rest -> withCategory Error $ S.Error rest [] -> withCategory Error $ S.Error [clause] "parameter_declaration" -> withDefaultInfo $ case children of diff --git a/src/Renderer/JSON.hs b/src/Renderer/JSON.hs index e9e41efb1..e561602aa 100644 --- a/src/Renderer/JSON.hs +++ b/src/Renderer/JSON.hs @@ -147,7 +147,7 @@ syntaxToTermField syntax = case syntax of S.Continue expr -> [ "expression" .= expr ] S.BlockStatement c -> childrenFields c S.ParameterDecl ty field -> [ "type" .= ty ] <> [ "identifier" .= field ] - S.Default c -> childrenFields c + S.DefaultCase c -> childrenFields c S.TypeDecl id ty -> [ "type" .= ty ] <> [ "identifier" .= id ] S.FieldDecl id ty tag -> [ "type" .= ty ] <> [ "identifier" .= id ] <> [ "tag" .= tag] S.Ty ty -> [ "type" .= ty ] diff --git a/src/Renderer/Split.hs b/src/Renderer/Split.hs index 5c405da4b..c7be17803 100644 --- a/src/Renderer/Split.hs +++ b/src/Renderer/Split.hs @@ -129,7 +129,7 @@ styleName category = "category-" <> case category of C.BeginBlock -> "begin_block" C.EndBlock -> "end_block" C.ParameterDecl -> "parameter_declaration" - C.Default -> "default_statement" + C.DefaultCase -> "default_statement" C.TypeDecl -> "type_declaration" C.PointerTy -> "pointer_type" C.FieldDecl -> "field_declaration" diff --git a/src/Syntax.hs b/src/Syntax.hs index 52d7e5c40..050a42ac9 100644 --- a/src/Syntax.hs +++ b/src/Syntax.hs @@ -48,7 +48,7 @@ data Syntax a f | Switch { switchExpr :: (Maybe f), cases :: [f] } | Case { caseExpr :: f, caseStatements :: [f] } -- | A default case in a switch statement. - | Default [f] + | DefaultCase [f] | Select { cases :: [f] } | Object { objectTy :: Maybe f, keyValues :: [f] } -- | A pair in an Object. e.g. foo: bar or foo => bar @@ -163,6 +163,7 @@ instance Listable2 Syntax where \/ liftCons3 recur (liftTiers recur) (liftTiers recur) FieldDecl \/ liftCons1 recur Ty \/ liftCons2 recur recur Send + \/ liftCons1 (liftTiers recur) DefaultCase instance Listable leaf => Listable1 (Syntax leaf) where liftTiers = liftTiers2 tiers