1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 02:14:20 +03:00

Assing simple member access

This commit is contained in:
Rick Winfrey 2017-05-30 16:54:52 -07:00
parent 9aa5ba6f18
commit aad7f36902

View File

@ -32,6 +32,7 @@ type Syntax' =
, Expression.Boolean
, Expression.Bitwise
, Expression.Call
, Expression.MemberAccess
, Literal.Boolean
, Literal.Float
, Literal.Integer
@ -163,7 +164,7 @@ comment :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source)
expressionStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
expressionStatement = symbol ExpressionStatement *> children (statement <|> literal <|> expression)
expressionStatement = symbol ExpressionStatement *> children (statement <|> literal <|> expression <|> memberAccess)
-- TODO Possibly match against children for dotted name and identifiers
@ -216,3 +217,6 @@ makeTerm a f = cofree (a :< inj f)
emptyTerm :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
emptyTerm = makeTerm <$> location <*> pure Syntax.Empty
memberAccess :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
memberAccess = makeTerm <$> symbol Attribute <*> children (expression >>= (\lhs -> (Expression.MemberAccess lhs) <$> identifier))