1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 13:51:44 +03:00

Subscripts

This commit is contained in:
Timothy Clem 2017-07-06 09:54:54 -07:00
parent a4c0c93b2b
commit 06e0e07920

View File

@ -36,6 +36,7 @@ type Syntax = '[
, Expression.Comparison
, Expression.MemberAccess
, Expression.ScopeResolution
, Expression.Subscript
, Literal.Array
, Literal.Boolean
, Literal.Float
@ -113,6 +114,7 @@ statement = handleError $
<|> conditional
<|> methodCall
<|> call
<|> subscript
where mk s construct = makeTerm <$> symbol s <*> children ((construct .) . fromMaybe <$> emptyTerm <*> optional (symbol ArgumentList *> children statement))
statements :: Assignment
@ -242,6 +244,9 @@ until' =
for :: Assignment
for = makeTerm <$> symbol For <*> children (Statement.ForEach <$> some identifier <*> statement <*> statements)
subscript :: Assignment
subscript = makeTerm <$> symbol ElementReference <*> children (Expression.Subscript <$> statement <*> many argument)
pair :: Assignment
pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> statement <*> statement)