mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Update Increment/Decrement constructors; Go assignment
This commit is contained in:
parent
9d18da5e91
commit
b2a8973faf
@ -179,17 +179,3 @@ data Cast a = Cast { castSubject :: !a, castType :: !a }
|
||||
instance Eq1 Cast where liftEq = genericLiftEq
|
||||
instance Ord1 Cast where liftCompare = genericLiftCompare
|
||||
instance Show1 Cast where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Increment (e.g. 1++ in C or Go).
|
||||
newtype Increment a = Increment a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable)
|
||||
|
||||
instance Eq1 Increment where liftEq = genericLiftEq
|
||||
instance Show1 Increment where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Decrement (e.g. 1-- in C or Go).
|
||||
newtype Decrement a = Decrement a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable)
|
||||
|
||||
instance Eq1 Decrement where liftEq = genericLiftEq
|
||||
instance Show1 Decrement where liftShowsPrec = genericLiftShowsPrec
|
||||
|
@ -171,3 +171,17 @@ newtype ScopeExit a = ScopeExit [a]
|
||||
|
||||
instance Eq1 ScopeExit where liftEq = genericLiftEq
|
||||
instance Show1 ScopeExit where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Post increment operator (e.g. 1++ in Go, or i++ in C).
|
||||
newtype PostIncrement a = PostIncrement a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable)
|
||||
|
||||
instance Eq1 PostIncrement where liftEq = genericLiftEq
|
||||
instance Show1 PostIncrement where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Post decrement operator (e.g. 1-- in Go, or i-- in C).
|
||||
newtype PostDecrement a = PostDecrement a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable)
|
||||
|
||||
instance Eq1 PostDecrement where liftEq = genericLiftEq
|
||||
instance Show1 PostDecrement where liftShowsPrec = genericLiftShowsPrec
|
||||
|
@ -37,8 +37,8 @@ type Syntax =
|
||||
, Expression.Boolean
|
||||
, Expression.Call
|
||||
, Expression.Comparison
|
||||
, Expression.Decrement
|
||||
, Expression.Increment
|
||||
, Statement.PostDecrement
|
||||
, Statement.PostIncrement
|
||||
, Expression.MemberAccess
|
||||
, Literal.Array
|
||||
, Literal.Channel
|
||||
@ -385,7 +385,7 @@ breakStatement :: Assignment
|
||||
breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> labelName)
|
||||
|
||||
decStatement :: Assignment
|
||||
decStatement = makeTerm <$> symbol DecStatement <*> children (Expression.Decrement <$> expression)
|
||||
decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression)
|
||||
|
||||
gotoStatement :: Assignment
|
||||
gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> expression)
|
||||
@ -393,7 +393,7 @@ gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <
|
||||
ifStatement :: Assignment
|
||||
ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> expression <*> expression <*> (expression <|> emptyTerm))
|
||||
incStatement :: Assignment
|
||||
incStatement = makeTerm <$> symbol IncStatement <*> children (Expression.Increment <$> expression)
|
||||
incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression)
|
||||
|
||||
labelName :: Assignment
|
||||
labelName = makeTerm <$> symbol LabelName <*> (Syntax.Identifier <$> source)
|
||||
|
Loading…
Reference in New Issue
Block a user