1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Assign slice expressions

This commit is contained in:
Rick Winfrey 2017-07-12 15:31:41 -07:00
parent 6da98f3d34
commit 91d15699ce

View File

@ -40,6 +40,7 @@ type Syntax =
, Expression.Bitwise , Expression.Bitwise
, Expression.Call , Expression.Call
, Expression.Comparison , Expression.Comparison
, Expression.Enumeration
, Expression.ScopeResolution , Expression.ScopeResolution
, Expression.MemberAccess , Expression.MemberAccess
, Expression.Subscript , Expression.Subscript
@ -163,6 +164,7 @@ expression = argument
<|> memberAccess <|> memberAccess
<|> notOperator <|> notOperator
<|> parameter <|> parameter
<|> slice
<|> subscript <|> subscript
<|> statement <|> statement
<|> tuple <|> tuple
@ -419,6 +421,13 @@ memberAccess = makeTerm <$> symbol Attribute <*> children (Expression.MemberAcce
subscript :: Assignment subscript :: Assignment
subscript = makeTerm <$> symbol Subscript <*> children (Expression.Subscript <$> expression <*> many expression) subscript = makeTerm <$> symbol Subscript <*> children (Expression.Subscript <$> expression <*> many expression)
slice :: Assignment
slice = makeTerm <$> symbol Slice <*> children
(toEnumeration <$> ((emptyTerm <* symbol AnonColon <* source) <|> (expression <* symbol AnonColon <* source))
<*> ((emptyTerm <* symbol AnonColon <* source) <|> (expression <* symbol AnonColon <* source) <|> (expression <|> emptyTerm))
<*> (expression <|> emptyTerm))
where toEnumeration start stop step = Expression.Enumeration start stop step
call :: Assignment call :: Assignment
call = makeTerm <$> symbol Call <*> children (Expression.Call <$> identifier <*> (symbol ArgumentList *> children (many expression) call = makeTerm <$> symbol Call <*> children (Expression.Call <$> identifier <*> (symbol ArgumentList *> children (many expression)
<|> some comprehension)) <|> some comprehension))