2023-11-15 03:26:32 +00:00
|
|
|
================================================================================
|
|
|
|
Simple Yield
|
|
|
|
================================================================================
|
|
|
|
|
2023-12-30 02:15:03 +00:00
|
|
|
1 -> output
|
2023-11-15 03:26:32 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2023-11-16 01:46:45 +00:00
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(yield
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2024-01-01 09:59:27 +00:00
|
|
|
(value
|
|
|
|
(built_in_value)))))))
|
2023-11-16 01:46:45 +00:00
|
|
|
|
2023-11-15 03:26:32 +00:00
|
|
|
================================================================================
|
|
|
|
Yield Chain
|
|
|
|
================================================================================
|
|
|
|
|
2023-12-30 02:15:03 +00:00
|
|
|
x -> foo -> bar -> abc
|
2023-11-15 03:26:32 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
2023-11-16 01:46:45 +00:00
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(yield
|
|
|
|
(expression
|
|
|
|
(yield
|
|
|
|
(expression
|
|
|
|
(yield
|
|
|
|
(expression
|
|
|
|
(identifier))
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2023-12-02 07:34:23 +00:00
|
|
|
(identifier))))
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2023-12-02 07:34:23 +00:00
|
|
|
(identifier))))
|
2023-12-29 23:59:15 +00:00
|
|
|
(function_expression
|
2023-12-02 07:34:23 +00:00
|
|
|
(identifier))))))
|
2023-12-30 02:15:03 +00:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Yielded Function Call
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
x -> foo(1)()
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(function_call
|
|
|
|
(function_expression
|
|
|
|
(yield
|
|
|
|
(expression
|
|
|
|
(identifier))
|
|
|
|
(function_expression
|
|
|
|
(identifier))))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))))))
|