mirror of
https://github.com/github/semantic.git
synced 2025-01-01 19:55:34 +03:00
Assign generator expressions
This commit is contained in:
parent
0d7719432d
commit
4b64206feb
@ -26,6 +26,7 @@ import Term
|
|||||||
type Syntax = Union Syntax'
|
type Syntax = Union Syntax'
|
||||||
type Syntax' =
|
type Syntax' =
|
||||||
'[ Comment.Comment
|
'[ Comment.Comment
|
||||||
|
, Declaration.Comprehension
|
||||||
, Declaration.Function
|
, Declaration.Function
|
||||||
, Declaration.Import
|
, Declaration.Import
|
||||||
, Declaration.Variable
|
, Declaration.Variable
|
||||||
@ -103,6 +104,7 @@ expression = statement
|
|||||||
<|> dottedName
|
<|> dottedName
|
||||||
<|> await
|
<|> await
|
||||||
<|> lambda
|
<|> lambda
|
||||||
|
<|> generatorExpression
|
||||||
|
|
||||||
dottedName :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
|
dottedName :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
|
||||||
dottedName = makeTerm <$> symbol DottedName <*> children (Expression.ScopeResolution <$> many expression)
|
dottedName = makeTerm <$> symbol DottedName <*> children (Expression.ScopeResolution <$> many expression)
|
||||||
@ -287,6 +289,9 @@ lambda = makeTerm <$> symbol Lambda <*> children (Declaration.Function <$> lambd
|
|||||||
lambdaParameters = many identifier
|
lambdaParameters = many identifier
|
||||||
lambdaBody = expression
|
lambdaBody = expression
|
||||||
|
|
||||||
|
generatorExpression :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location)
|
||||||
|
generatorExpression = makeTerm <$> symbol GeneratorExpression <*> children (Declaration.Comprehension <$> expression <* symbol AnonFor <* symbol Variables <*> children (many expression) <* symbol AnonIn <*> expression)
|
||||||
|
|
||||||
makeTerm :: HasCallStack => InUnion Syntax' f => a -> f (Term Syntax a) -> Term Syntax a
|
makeTerm :: HasCallStack => InUnion Syntax' f => a -> f (Term Syntax a) -> Term Syntax a
|
||||||
makeTerm a f = cofree (a :< inj f)
|
makeTerm a f = cofree (a :< inj f)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user