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:
parent
6da98f3d34
commit
91d15699ce
@ -40,6 +40,7 @@ type Syntax =
|
||||
, Expression.Bitwise
|
||||
, Expression.Call
|
||||
, Expression.Comparison
|
||||
, Expression.Enumeration
|
||||
, Expression.ScopeResolution
|
||||
, Expression.MemberAccess
|
||||
, Expression.Subscript
|
||||
@ -163,6 +164,7 @@ expression = argument
|
||||
<|> memberAccess
|
||||
<|> notOperator
|
||||
<|> parameter
|
||||
<|> slice
|
||||
<|> subscript
|
||||
<|> statement
|
||||
<|> tuple
|
||||
@ -419,6 +421,13 @@ memberAccess = makeTerm <$> symbol Attribute <*> children (Expression.MemberAcce
|
||||
subscript :: Assignment
|
||||
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 = makeTerm <$> symbol Call <*> children (Expression.Call <$> identifier <*> (symbol ArgumentList *> children (many expression)
|
||||
<|> some comprehension))
|
||||
|
Loading…
Reference in New Issue
Block a user