1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Correct the MemberAccess assignments for Go.

This commit is contained in:
Rob Rix 2018-06-06 10:31:04 -04:00
parent 3fc86616a5
commit 37ca14ff75

View File

@ -227,6 +227,9 @@ element = symbol Element *> children expression
fieldIdentifier :: Assignment fieldIdentifier :: Assignment
fieldIdentifier = makeTerm <$> symbol FieldIdentifier <*> (Syntax.Identifier . name <$> source) fieldIdentifier = makeTerm <$> symbol FieldIdentifier <*> (Syntax.Identifier . name <$> source)
fieldIdentifier' :: Assignment.Assignment [] Grammar Name
fieldIdentifier' = symbol FieldIdentifier *> (name <$> source)
floatLiteral :: Assignment floatLiteral :: Assignment
floatLiteral = makeTerm <$> symbol FloatLiteral <*> (Literal.Float <$> source) floatLiteral = makeTerm <$> symbol FloatLiteral <*> (Literal.Float <$> source)
@ -263,6 +266,9 @@ runeLiteral = makeTerm <$> symbol Grammar.RuneLiteral <*> (Go.Syntax.Rune <$> so
typeIdentifier :: Assignment typeIdentifier :: Assignment
typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier . name <$> source) typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier . name <$> source)
typeIdentifier' :: Assignment.Assignment [] Grammar Name
typeIdentifier' = symbol TypeIdentifier *> (name <$> source)
-- Primitive Types -- Primitive Types
@ -304,7 +310,7 @@ pointerType :: Assignment
pointerType = makeTerm <$> symbol PointerType <*> children (Type.Pointer <$> expression) pointerType = makeTerm <$> symbol PointerType <*> children (Type.Pointer <$> expression)
qualifiedType :: Assignment qualifiedType :: Assignment
qualifiedType = makeTerm <$> symbol QualifiedType <*> children (Expression.MemberAccess <$> expression <*> identifier') qualifiedType = makeTerm <$> symbol QualifiedType <*> children (Expression.MemberAccess <$> expression <*> (identifier' <|> typeIdentifier'))
sliceType :: Assignment sliceType :: Assignment
sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression) sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression)
@ -435,7 +441,7 @@ parenthesizedExpression :: Assignment
parenthesizedExpression = symbol ParenthesizedExpression *> children expressions parenthesizedExpression = symbol ParenthesizedExpression *> children expressions
selectorExpression :: Assignment selectorExpression :: Assignment
selectorExpression = makeTerm <$> symbol SelectorExpression <*> children (Expression.MemberAccess <$> expression <*> identifier') selectorExpression = makeTerm <$> symbol SelectorExpression <*> children (Expression.MemberAccess <$> expression <*> (identifier' <|> fieldIdentifier'))
sliceExpression :: Assignment sliceExpression :: Assignment
sliceExpression = makeTerm <$> symbol SliceExpression <*> children (Go.Syntax.Slice <$> expression <* token AnonLBracket <*> (emptyTerm <|> expression) <* token AnonColon <*> (expression <|> emptyTerm) <* optional (token AnonColon) <*> (expression <|> emptyTerm)) sliceExpression = makeTerm <$> symbol SliceExpression <*> children (Go.Syntax.Slice <$> expression <* token AnonLBracket <*> (emptyTerm <|> expression) <* token AnonColon <*> (expression <|> emptyTerm) <* optional (token AnonColon) <*> (expression <|> emptyTerm))