1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Assign primitive constructor identifiers

This commit is contained in:
Rick Winfrey 2018-06-08 10:13:24 -07:00
parent 0cc63f89f3
commit 867170b39a
7 changed files with 66 additions and 1 deletions

View File

@ -174,6 +174,7 @@ expressionChoices = [
, operator , operator
, parenthesizedTypePattern , parenthesizedTypePattern
, pragma , pragma
, primitiveConstructorIdentifier
, qualifiedModuleIdentifier , qualifiedModuleIdentifier
, qualifiedTypeConstructorIdentifier , qualifiedTypeConstructorIdentifier
, quotedName , quotedName
@ -316,6 +317,9 @@ parenthesizedTypePattern = symbol ParenthesizedTypePattern *> children expressio
pragma :: Assignment pragma :: Assignment
pragma = makeTerm <$> symbol Pragma <*> (Syntax.Pragma <$> source) pragma = makeTerm <$> symbol Pragma <*> (Syntax.Pragma <$> source)
primitiveConstructorIdentifier :: Assignment
primitiveConstructorIdentifier = makeTerm <$> symbol PrimitiveConstructorIdentifier <*> (Syntax.Identifier . Name.name <$> source)
qualifiedModuleIdentifier :: Assignment qualifiedModuleIdentifier :: Assignment
qualifiedModuleIdentifier = makeTerm <$> symbol QualifiedModuleIdentifier <*> children (Syntax.QualifiedModuleIdentifier <$> someTerm' expression) qualifiedModuleIdentifier = makeTerm <$> symbol QualifiedModuleIdentifier <*> children (Syntax.QualifiedModuleIdentifier <$> someTerm' expression)
@ -335,7 +339,7 @@ strictType :: Assignment
strictType = makeTerm' strictType = makeTerm'
<$> symbol StrictType <$> symbol StrictType
<*> children ( (inject <$> (Syntax.StrictType <$> typeConstructor <*> typeParameters)) <*> children ( (inject <$> (Syntax.StrictType <$> typeConstructor <*> typeParameters))
<|> (inject <$> (Syntax.StrictTypeVariable <$> typeVariableIdentifier))) <|> (inject <$> (Syntax.StrictTypeVariable <$> expression)))
string :: Assignment string :: Assignment
string = makeTerm <$> symbol String <*> (Literal.TextElement <$> source) string = makeTerm <$> symbol String <*> (Literal.TextElement <$> source)

View File

@ -26,3 +26,5 @@ data (Eq (f a), Functor f) => N f a = N f a
data Foo bar = HasCallStack => Foo bar data Foo bar = HasCallStack => Foo bar
data Baz foo = Show foo => Baz foo data Baz foo = Show foo => Baz foo
data Foo = Foo !Double#

View File

@ -26,3 +26,6 @@ data (Eq (f a), Applicative f) => N f a = N f a
data Foo bar = HasCallStack => Wiz bar data Foo bar = HasCallStack => Wiz bar
data Baz a = Show a => Baz a data Baz a = Show a => Baz a
data Bar = Bar !Double#

View File

@ -423,4 +423,19 @@
(TypeParameters (TypeParameters
{ (Identifier) { (Identifier)
->(Identifier) })) ->(Identifier) }))
(Empty))
(Datatype
(Empty)
(Type
{ (Identifier)
->(Identifier) }
(TypeParameters)
(Empty))
(Constructor
(Empty)
{ (Identifier)
->(Identifier) }
(TypeParameters
(StrictTypeVariable
(Identifier))))
(Empty)))) (Empty))))

View File

@ -420,4 +420,19 @@
(TypeParameters (TypeParameters
{ (Identifier) { (Identifier)
->(Identifier) })) ->(Identifier) }))
(Empty))
(Datatype
(Empty)
(Type
{ (Identifier)
->(Identifier) }
(TypeParameters)
(Empty))
(Constructor
(Empty)
{ (Identifier)
->(Identifier) }
(TypeParameters
(StrictTypeVariable
(Identifier))))
(Empty)))) (Empty))))

View File

@ -354,4 +354,17 @@
(Identifier) (Identifier)
(TypeParameters (TypeParameters
(Identifier))) (Identifier)))
(Empty))
(Datatype
(Empty)
(Type
(Identifier)
(TypeParameters)
(Empty))
(Constructor
(Empty)
(Identifier)
(TypeParameters
(StrictTypeVariable
(Identifier))))
(Empty)))) (Empty))))

View File

@ -354,4 +354,17 @@
(Identifier) (Identifier)
(TypeParameters (TypeParameters
(Identifier))) (Identifier)))
(Empty))
(Datatype
(Empty)
(Type
(Identifier)
(TypeParameters)
(Empty))
(Constructor
(Empty)
(Identifier)
(TypeParameters
(StrictTypeVariable
(Identifier))))
(Empty)))) (Empty))))