mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Assign PointerDeclarations and pointer types
This commit is contained in:
parent
f8818deec7
commit
cdb4525a2a
@ -49,6 +49,7 @@ type Syntax =
|
|||||||
, Type.BiDirectionalChannel
|
, Type.BiDirectionalChannel
|
||||||
, Type.Interface
|
, Type.Interface
|
||||||
, Type.Map
|
, Type.Map
|
||||||
|
, Type.Pointer
|
||||||
, Type.ReceiveChannel
|
, Type.ReceiveChannel
|
||||||
, Type.SendChannel
|
, Type.SendChannel
|
||||||
, Type.Slice
|
, Type.Slice
|
||||||
@ -82,6 +83,7 @@ expression = choice
|
|||||||
, methodSpec
|
, methodSpec
|
||||||
, packageClause
|
, packageClause
|
||||||
, parameterDeclaration
|
, parameterDeclaration
|
||||||
|
, pointerType
|
||||||
, rawStringLiteral
|
, rawStringLiteral
|
||||||
, sliceType
|
, sliceType
|
||||||
, structType
|
, structType
|
||||||
@ -114,8 +116,7 @@ typedIdentifier :: Assignment
|
|||||||
typedIdentifier = mkTypedIdentifier <$> symbol Identifier <*> source <*> types <*> source
|
typedIdentifier = mkTypedIdentifier <$> symbol Identifier <*> source <*> types <*> source
|
||||||
where
|
where
|
||||||
mkTypedIdentifier loc' identifier' loc'' identifier'' = makeTerm loc' (Type.Annotation (makeTerm loc' (Syntax.Identifier identifier')) (makeTerm loc'' (Syntax.Identifier identifier'')))
|
mkTypedIdentifier loc' identifier' loc'' identifier'' = makeTerm loc' (Type.Annotation (makeTerm loc' (Syntax.Identifier identifier')) (makeTerm loc'' (Syntax.Identifier identifier'')))
|
||||||
types = symbol PointerType
|
types = symbol ParenthesizedType
|
||||||
<|> symbol ParenthesizedType
|
|
||||||
<|> symbol SliceType
|
<|> symbol SliceType
|
||||||
|
|
||||||
identifier :: Assignment
|
identifier :: Assignment
|
||||||
@ -144,7 +145,6 @@ typeLiteral =
|
|||||||
mk InterfaceType
|
mk InterfaceType
|
||||||
<|> mk TypeIdentifier
|
<|> mk TypeIdentifier
|
||||||
<|> mk ParenthesizedType
|
<|> mk ParenthesizedType
|
||||||
<|> mk PointerType
|
|
||||||
<|> mk SliceType
|
<|> mk SliceType
|
||||||
<|> qualifiedType
|
<|> qualifiedType
|
||||||
<|> arrayType
|
<|> arrayType
|
||||||
@ -177,6 +177,9 @@ interfaceType = handleError $ makeTerm <$> symbol InterfaceType <*> children (Ty
|
|||||||
mapType :: Assignment
|
mapType :: Assignment
|
||||||
mapType = handleError $ makeTerm <$> symbol MapType <*> children (Type.Map <$> expression <*> expression)
|
mapType = handleError $ makeTerm <$> symbol MapType <*> children (Type.Map <$> expression <*> expression)
|
||||||
|
|
||||||
|
pointerType :: Assignment
|
||||||
|
pointerType = handleError $ makeTerm <$> symbol PointerType <*> children (Type.Pointer <$> expression)
|
||||||
|
|
||||||
fieldDeclaration :: Assignment
|
fieldDeclaration :: Assignment
|
||||||
fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> many identifier <*> typeLiteral <*> optional expression)
|
fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> many identifier <*> typeLiteral <*> optional expression)
|
||||||
where
|
where
|
||||||
@ -206,11 +209,15 @@ arrayTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotatio
|
|||||||
sliceTypeDeclaration :: Assignment
|
sliceTypeDeclaration :: Assignment
|
||||||
sliceTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotation <$> typeLiteral <*> sliceType)
|
sliceTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotation <$> typeLiteral <*> sliceType)
|
||||||
|
|
||||||
|
pointerTypeDeclaration :: Assignment
|
||||||
|
pointerTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotation <$> typeLiteral <*> pointerType)
|
||||||
|
|
||||||
typeDeclaration :: Assignment
|
typeDeclaration :: Assignment
|
||||||
typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children (many ( arrayTypeDeclaration
|
typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children (many ( arrayTypeDeclaration
|
||||||
<|> channelTypeDeclaration
|
<|> channelTypeDeclaration
|
||||||
<|> interfaceTypeDeclaration
|
<|> interfaceTypeDeclaration
|
||||||
<|> qualifiedTypeDeclaration
|
<|> qualifiedTypeDeclaration
|
||||||
|
<|> pointerTypeDeclaration
|
||||||
<|> sliceTypeDeclaration
|
<|> sliceTypeDeclaration
|
||||||
<|> structTypeDeclaration
|
<|> structTypeDeclaration
|
||||||
<|> mapTypeDeclaration ))
|
<|> mapTypeDeclaration ))
|
||||||
|
Loading…
Reference in New Issue
Block a user