1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Assign **=.

This commit is contained in:
Rob Rix 2017-05-03 11:31:36 -04:00
parent 6e51415cfb
commit f408214d85
2 changed files with 12 additions and 3 deletions

View File

@ -41,3 +41,10 @@ data Times a = Times a a
instance Eq1 Times where liftEq = genericLiftEq instance Eq1 Times where liftEq = genericLiftEq
instance Show1 Times where liftShowsPrec = genericLiftShowsPrec instance Show1 Times where liftShowsPrec = genericLiftShowsPrec
-- | Binary exponentiation.
data Power a = Power a a
deriving (Eq, Foldable, Functor, Generic1, Show, Traversable)
instance Eq1 Power where liftEq = genericLiftEq
instance Show1 Power where liftShowsPrec = genericLiftShowsPrec

View File

@ -27,6 +27,7 @@ type Syntax' =
, Expression.Not , Expression.Not
, Expression.Plus , Expression.Plus
, Expression.Times , Expression.Times
, Expression.Power
, Literal.Array , Literal.Array
, Literal.Boolean , Literal.Boolean
, Literal.Hash , Literal.Hash
@ -89,7 +90,8 @@ statement = exit Statement.Return Return
<|> symbol OperatorAssignment *> term <*> children (lvalue >>= \ var -> Statement.Assignment var <$> <|> symbol OperatorAssignment *> term <*> children (lvalue >>= \ var -> Statement.Assignment var <$>
(symbol AnonPlusEqual *> term <*> (Expression.Plus var <$> expression) (symbol AnonPlusEqual *> term <*> (Expression.Plus var <$> expression)
<|> symbol AnonMinusEqual *> term <*> (Expression.Minus var <$> expression) <|> symbol AnonMinusEqual *> term <*> (Expression.Minus var <$> expression)
<|> symbol AnonStarEqual *> term <*> (Expression.Times var <$> expression))) <|> symbol AnonStarEqual *> term <*> (Expression.Times var <$> expression)
<|> symbol AnonStarStarEqual *> term <*> (Expression.Power var <$> expression)))
where exit construct sym = symbol sym *> term <*> children (construct <$> optional (symbol ArgumentList *> children statement)) where exit construct sym = symbol sym *> term <*> children (construct <$> optional (symbol ArgumentList *> children statement))
lvalue :: Assignment (Node Grammar) (Term Syntax Location) lvalue :: Assignment (Node Grammar) (Term Syntax Location)