=====================
empty while statement
=====================

while foo do
end

---

(program (while (identifier)))

================
while without do
================

while foo
end

---

(program (while (identifier)))

=========================
while statement with body
=========================

while foo do
  bar
end

---

(program (while (identifier) (identifier)))

=====================
empty until statement
=====================

until foo do
end

---

(program (until (identifier)))

=========================
until statement with body
=========================

until foo do
  bar
end

---

(program (until (identifier) (identifier)))

==================
empty if statement
==================

if foo
end

---

(program (if (identifier)))

=======================
empty if/else statement
=======================

if foo then
else
end

if true then ; 123; end

---

(program
  (if (identifier) (else))
  (if (true) (integer)))

==================================
single-line if then else statement
==================================

if foo then bar else quux end

---

(program (if (identifier) (identifier) (else (identifier))))

========
if elsif
========

if foo
  bar
elsif quux
  baz
end

---

(program
  (if (identifier) (identifier)
  (elsif (identifier) (identifier))))

=============
if elsif else
=============

if foo
  bar
elsif quux
  baz
else
  bat
end

---

(program
  (if (identifier) (identifier)
    (elsif (identifier) (identifier)
      (else (identifier)))))

======================
empty unless statement
======================

unless foo
end

---

(program (unless (identifier)))

================================
empty unless statement with then
================================

unless foo then
end

---

(program (unless (identifier)))

================================
empty unless statement with else
================================

unless foo
else
end

---

(program (unless (identifier) (else)))

===
for
===

for x in y do
	f
end

for x, y in z do
	f
end

---

(program
  (for (identifier) (in (identifier)) (identifier))
  (for (identifier) (identifier) (in (identifier)) (identifier)))

==============
for without do
==============

for x in y
  f
end

---

(program (for (identifier) (in (identifier)) (identifier)))

==============
next
==============

for x in y
  next
end

---

(program (for (identifier) (in (identifier)) (next)))

==============
retry
==============

for x in y
  retry
end

---

(program (for (identifier) (in (identifier)) (retry)))

==============
break
==============

while b
  break
end

---

(program (while (identifier) (break)))

==============
redo
==============

while b
  redo
end

---

(program (while (identifier) (redo)))

===========
empty begin
===========

begin
end

---

(program (begin))

===============
begin with body
===============

begin
	foo
end

---

(program (begin (identifier)))

===============
begin with else
===============

begin
	foo
else
  bar
end

---

(program
  (begin (identifier)
    (else (identifier))))

===============
begin with ensure
===============

begin
	foo
ensure
  bar
end

---

(program
  (begin (identifier)
    (ensure (identifier))))

=======================
begin with empty rescue
=======================

begin
rescue
end

begin
rescue then
end

begin
rescue
  bar
end


---

(program
  (begin (rescue))
  (begin (rescue))
  (begin (rescue (identifier))))

===========================
begin with rescue with args
===========================

begin
rescue x
end

begin
rescue x then
end

begin
rescue x
  bar
end

begin
rescue => x
  bar
end

begin
rescue x, y
  bar
end

begin
rescue Error => x
end

begin
rescue Error => x
  bar
end

---

(program
  (begin (rescue (exceptions (identifier))))
  (begin (rescue (exceptions (identifier))))
  (begin (rescue (exceptions (identifier)) (identifier)))
  (begin (rescue (exception_variable (identifier)) (identifier)))
  (begin (rescue (exceptions (identifier) (identifier)) (identifier)))
  (begin (rescue (exceptions (constant)) (exception_variable (identifier))))
  (begin (rescue (exceptions (constant)) (exception_variable (identifier)) (identifier))))

===========================
begin with rescue with splat args
===========================

begin
rescue *args
end

---

(program (begin (rescue (exceptions (splat_argument (identifier))))))

=================
rescue modifier
=================

foo rescue nil

if foo rescue nil
elsif bar rescue nil
end

unless foo rescue nil
end

---

(program
  (rescue_modifier (identifier) (nil))
  (if (rescue_modifier (identifier) (nil)) (elsif (rescue_modifier (identifier) (nil))))
  (unless (rescue_modifier (identifier) (nil))))

============================
begin with all the trimmings
============================

begin
	foo
rescue x
  retry
else
	quux
ensure
  baz
end

---

(program
  (begin (identifier)
    (rescue (exceptions (identifier)) (retry))
    (else (identifier))
    (ensure (identifier))))

======
return
======

return foo

---

(program (return (argument_list (identifier))))

====================
return without value
====================

return

---

(program (return))

====
case
====

case foo
when bar
end

---

(program
  (case (identifier)
  (when (pattern (identifier)))))

==============
case with else
==============

case foo
when bar
else
end

case key
when bar
else; leaf
end

---

(program
  (case
    (identifier)
    (when (pattern (identifier)) (else)))
  (case
    (identifier)
    (when (pattern (identifier)) (else (identifier)))))

==============================
case with multiple when blocks
==============================

case a
when b
  c
when d
  e
else
  f
end

---

(program
  (case (identifier)
    (when (pattern (identifier)) (identifier)
      (when (pattern (identifier)) (identifier)
        (else (identifier))))))

==============================
case with splat parameter in when
==============================

case a
when *foo
  c
end

---

(program (case (identifier) (when (pattern (splat_argument (identifier))) (identifier))))

==============
case with assignment
==============

x = case foo
when bar
else
end

---

(program (assignment (identifier)
  (case (identifier)
    (when (pattern (identifier))
      (else)))))

==============
case with expression
==============

x = case foo = bar | baz
when bar
else
end

---

(program (assignment (identifier)
  (case (assignment (identifier) (binary (identifier) (identifier)))
    (when (pattern (identifier))
      (else)))))
