mirror of
https://github.com/github/semantic.git
synced 2024-12-24 07:25:44 +03:00
Assign prefix negation and parenthesized expressions
This commit is contained in:
parent
c53dab76cf
commit
148ee52a5f
@ -78,6 +78,7 @@ type Syntax = '[
|
||||
, Syntax.Operator
|
||||
, Syntax.OperatorSection
|
||||
, Syntax.Pragma
|
||||
, Syntax.PrefixNegation
|
||||
, Syntax.QualifiedEntityIdentifier
|
||||
, Syntax.QualifiedImportDeclaration
|
||||
, Syntax.QuotedName
|
||||
@ -245,10 +246,12 @@ expressionChoices = [
|
||||
, newType
|
||||
, operator
|
||||
, operatorSection
|
||||
, parenthesizedExpression
|
||||
, parenthesizedPattern
|
||||
, parenthesizedTypePattern
|
||||
, pattern
|
||||
, pragma
|
||||
, prefixNegation
|
||||
, primitiveConstructorIdentifier
|
||||
, primitiveVariableIdentifier
|
||||
, qualifiedConstructorIdentifier
|
||||
@ -447,6 +450,9 @@ operatorSection = (makeTerm <$> symbol RightOperatorSection <*> children (Syntax
|
||||
packageQualifiedImport :: Assignment
|
||||
packageQualifiedImport = makeTerm <$> symbol PackageQualifiedImport <*> (Literal.TextElement <$> source)
|
||||
|
||||
parenthesizedExpression :: Assignment
|
||||
parenthesizedExpression = symbol ParenthesizedExpression *> children expression
|
||||
|
||||
parenthesizedPattern :: Assignment
|
||||
parenthesizedPattern = symbol ParenthesizedPattern *> children expressions
|
||||
|
||||
@ -459,6 +465,9 @@ pattern = symbol Pattern *> children (expression)
|
||||
pragma :: Assignment
|
||||
pragma = makeTerm <$> symbol Pragma <*> (Syntax.Pragma <$> source)
|
||||
|
||||
prefixNegation :: Assignment
|
||||
prefixNegation = makeTerm <$> symbol PrefixNegation <*> children (Syntax.PrefixNegation <$> expression)
|
||||
|
||||
primitiveConstructorIdentifier :: Assignment
|
||||
primitiveConstructorIdentifier = makeTerm <$> symbol PrimitiveConstructorIdentifier <*> (Syntax.PrimitiveConstructorIdentifier . Name.name <$> source)
|
||||
|
||||
|
@ -524,7 +524,7 @@ instance Show1 ConstructorPattern where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
instance Evaluatable ConstructorPattern
|
||||
|
||||
-- e.g. `a <- b` in a Haskell do block
|
||||
-- e.g. `a <- b` in a Haskell do block.
|
||||
data BindPattern a = BindPattern { bindPatternLeft :: a, bindPatternRight :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
|
||||
|
||||
@ -551,3 +551,13 @@ instance Ord1 Lambda where liftCompare = genericLiftCompare
|
||||
instance Show1 Lambda where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
instance Evaluatable Lambda
|
||||
|
||||
-- e.g. -1 or (-a) as an expression and not `-` as a variable operator.
|
||||
newtype PrefixNegation a = PrefixNegation a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
|
||||
|
||||
instance Eq1 PrefixNegation where liftEq = genericLiftEq
|
||||
instance Ord1 PrefixNegation where liftCompare = genericLiftCompare
|
||||
instance Show1 PrefixNegation where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
instance Evaluatable PrefixNegation
|
||||
|
@ -62,18 +62,6 @@
|
||||
->(TypeConstructorIdentifier) }
|
||||
(TypeParameters)
|
||||
(Empty))
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
@ -83,6 +71,24 @@
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
|
@ -62,14 +62,15 @@
|
||||
->(TypeConstructorIdentifier) }
|
||||
(TypeParameters)
|
||||
(Empty))
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
(TypeParameters))
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
(Constructor
|
||||
{ (ConstructorIdentifier)
|
||||
->(ConstructorIdentifier) }
|
||||
@ -80,9 +81,12 @@
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{+(Constructor
|
||||
{+(ConstructorIdentifier)+}
|
||||
{+(TypeParameters)+})+}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
{-(Constructor
|
||||
{-(ConstructorIdentifier)-}
|
||||
{-(TypeParameters)-})-}
|
||||
|
@ -48,3 +48,9 @@ f = \ (Just a) -> a
|
||||
f = \ x -> x : a : xs
|
||||
|
||||
f = \ g a b -> g <$> a <*> b
|
||||
|
||||
f = (-)
|
||||
f = 1 - 1
|
||||
f = (-1)
|
||||
f = (-a)
|
||||
f = -(1)
|
||||
|
@ -48,3 +48,9 @@ g = \ (Just a) -> a
|
||||
g = \ x -> x : a : xs
|
||||
|
||||
g = \ g a b -> g <$> a <*> b
|
||||
|
||||
g = (-)
|
||||
g = 1 - 1
|
||||
g = (-1)
|
||||
g = (-a)
|
||||
g = -(1)
|
||||
|
@ -385,4 +385,45 @@
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(VariableOperator
|
||||
(VariableSymbol))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(InfixOperatorApp
|
||||
(Integer)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(Integer))))
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(PrefixNegation
|
||||
{+(Integer)+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(PrefixNegation
|
||||
{+(VariableIdentifier)+})+})+})+}
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(PrefixNegation
|
||||
(Integer))))
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(PrefixNegation
|
||||
{-(VariableIdentifier)-})-})-})-}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(PrefixNegation
|
||||
{-(Integer)-})-})-})-}))
|
||||
|
@ -327,16 +327,12 @@
|
||||
{-(VariableOperator
|
||||
{-(VariableSymbol)-})-}
|
||||
{-(VariableIdentifier)-})-})-})-}))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(QualifiedConstructorIdentifier
|
||||
{+(ModuleIdentifier)+}
|
||||
{+(ConstructorIdentifier)+})+}
|
||||
{-(Lambda
|
||||
{-(VariableIdentifier)-}
|
||||
{-(VariableIdentifier)-})-}))
|
||||
{+(ConstructorIdentifier)+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(ConstructorPattern
|
||||
@ -397,12 +393,13 @@
|
||||
{+(VariableOperator
|
||||
{+(VariableSymbol)+})+}
|
||||
{+(VariableIdentifier)+})+})+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(Lambda
|
||||
{+(VariableIdentifier)+}
|
||||
{+(VariableIdentifier)+})+})+})+}
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(Lambda
|
||||
(VariableIdentifier)
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
@ -445,4 +442,49 @@
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(VariableOperator
|
||||
(VariableSymbol))))
|
||||
(Function
|
||||
{ (VariableIdentifier)
|
||||
->(VariableIdentifier) }
|
||||
(Statements
|
||||
(InfixOperatorApp
|
||||
(Integer)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(Integer))))
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(PrefixNegation
|
||||
{+(Integer)+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(PrefixNegation
|
||||
{+(VariableIdentifier)+})+})+})+}
|
||||
{+(Function
|
||||
{+(VariableIdentifier)+}
|
||||
{+(Statements
|
||||
{+(PrefixNegation
|
||||
{+(Integer)+})+})+})+}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(PrefixNegation
|
||||
{-(Integer)-})-})-})-}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(PrefixNegation
|
||||
{-(VariableIdentifier)-})-})-})-}
|
||||
{-(Function
|
||||
{-(VariableIdentifier)-}
|
||||
{-(Statements
|
||||
{-(PrefixNegation
|
||||
{-(Integer)-})-})-})-}))
|
||||
|
@ -325,4 +325,32 @@
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(VariableOperator
|
||||
(VariableSymbol))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(InfixOperatorApp
|
||||
(Integer)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(Integer))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(PrefixNegation
|
||||
(Integer))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(PrefixNegation
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(PrefixNegation
|
||||
(Integer))))))
|
||||
|
@ -327,4 +327,32 @@
|
||||
(VariableIdentifier)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(VariableIdentifier))))))))
|
||||
(VariableIdentifier))))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(VariableOperator
|
||||
(VariableSymbol))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(InfixOperatorApp
|
||||
(Integer)
|
||||
(VariableOperator
|
||||
(VariableSymbol))
|
||||
(Integer))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(PrefixNegation
|
||||
(Integer))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(PrefixNegation
|
||||
(VariableIdentifier))))
|
||||
(Function
|
||||
(VariableIdentifier)
|
||||
(Statements
|
||||
(PrefixNegation
|
||||
(Integer))))))
|
||||
|
Loading…
Reference in New Issue
Block a user