mirror of
https://github.com/github/semantic.git
synced 2024-12-29 01:42:43 +03:00
Move yield to top level
This commit is contained in:
parent
136f43775a
commit
4461cb1542
@ -128,6 +128,7 @@ expression =
|
||||
<|> subscript
|
||||
<|> tuple
|
||||
<|> type'
|
||||
<|> yield
|
||||
<|> unaryOperator
|
||||
<|> functionDefinition
|
||||
<|> assertStatement
|
||||
@ -325,12 +326,11 @@ assignment' = makeTerm <$> symbol Assignment <*> children (Statement.Assignment
|
||||
<|> makeTerm <$> symbol AnonRAngleRAngleEqual <*> (Expression.RShift lvalue <$> rvalue)
|
||||
<|> makeTerm <$> symbol AnonLAngleLAngleEqual <*> (Expression.LShift lvalue <$> rvalue)
|
||||
<|> makeTerm <$> symbol AnonCaretEqual <*> (Expression.BXOr lvalue <$> rvalue)))
|
||||
where
|
||||
rvalue = expressionList <|> assignment' <|> yield
|
||||
|
||||
yield :: Assignment
|
||||
yield = makeTerm <$> symbol Yield <*> (Statement.Yield <$> children ( expression <|> expressionList <|> emptyTerm ))
|
||||
|
||||
rvalue :: Assignment
|
||||
rvalue = expressionList <|> assignment' <|> yield
|
||||
yield = makeTerm <$> symbol Yield <*> (Statement.Yield <$> children ( expression <|> emptyTerm ))
|
||||
|
||||
identifier :: Assignment
|
||||
identifier =
|
||||
@ -458,6 +458,7 @@ comprehension = makeTerm <$> symbol GeneratorExpression <*> children (comprehen
|
||||
conditionalExpression :: Assignment
|
||||
conditionalExpression = makeTerm <$> symbol ConditionalExpression <*> children (expression >>= \ thenBranch -> expression >>= \ conditional -> Statement.If conditional thenBranch <$> (expression <|> emptyTerm))
|
||||
|
||||
|
||||
makeTerm :: (HasCallStack, f :< fs) => a -> f (Term.Term (Union fs) a) -> Term.Term (Union fs) a
|
||||
makeTerm a f = cofree (a :< inj f)
|
||||
|
||||
|
1
test/fixtures/python/yield.A.py
vendored
Normal file
1
test/fixtures/python/yield.A.py
vendored
Normal file
@ -0,0 +1 @@
|
||||
yield
|
Loading…
Reference in New Issue
Block a user