===========================================================================================
identifiers
===========================================================================================

foo
bar9
underscore_separated
héllø
_
_bar9
_héllø
@main

---

(module
  (identifier)
  (identifier)
  (identifier)
  (identifier)
  (identifier)
  (identifier)
  (identifier)
  (meta (meta_id))
)

===========================================================================================
comma_separated_single_line_2
===========================================================================================

true, false

---

(module
  (expressions
    (true)
    (false)
  )
)

===========================================================================================
comma_separated_single_line_3
===========================================================================================

foo, 'bar', 123

---

(module
  (expressions
    (identifier)
    (string)
    (number)
  )
)

===========================================================================================
semicolon_separated
===========================================================================================

true; false
a, b, c; 1, 2, 3

---

(module
  (true)
  (false)
  (expressions
    (identifier)
    (identifier)
    (identifier)
  )
  (expressions
    (number)
    (number)
    (number)
  )
)

===========================================================================================
tuple_empty
===========================================================================================

(,)

---

(module
  (tuple)
)

===========================================================================================
tuple_nested
===========================================================================================

(foo, bar, (baz))

---

(module
  (tuple
    (element (identifier))
    (element (identifier))
    (element (tuple (element (identifier))))))

===========================================================================================
tuple_nested_multi_line
===========================================================================================

(
  foo,
  bar
, (baz)
)

---

(module
  (tuple
    (element (identifier))
    (element (identifier))
    (element (tuple (element (identifier))))))


===========================================================================================
list_multi_line
===========================================================================================

[
  foo,
  bar
, (baz)
]

---

(module
  (list
    (element (identifier))
    (element (identifier))
    (element (tuple (element (identifier))))))

===========================================================================================
binary_op
===========================================================================================

1 + 2 * 3 + 4

---

(module
  (binary_op
    (binary_op
      (number)
      (binary_op
        (number)
        (number)
      )
    )
    (number)
  )
)

===========================================================================================
binary_op_multi_line_pre
:skip
===========================================================================================

1
  + 2
    * 3
  + 4

---

(module
  (binary_op
    (binary_op
      (binary_op
        (number)
        (number)
      )
      (number)
    )
    (number)
  )
)

===========================================================================================
binary_op_multi_line_post
===========================================================================================

1 +
  2 *
    3 +
  4

---

(module
  (binary_op
    (binary_op
      (number)
      (binary_op
        (number)
        (number)
      )
    )
    (number)
  )
)


===========================================================================================
assignment_single_line
===========================================================================================

a =
a = 3
a, b = c
a = b, c
a = 1, 2, 3, 4

---

(module
  (assign
    lhs: (identifier)
  )
  (assign
    lhs: (identifier)
    rhs: (number)
  )
  (assign
    lhs: (assign_targets (identifier) (identifier))
    rhs: (identifier)
  )
  (assign
    lhs: (identifier)
    rhs: (assign_expressions (identifier) (identifier))
  )
  (assign
    lhs: (identifier)
    rhs: (assign_expressions (number) (number) (number) (number))
  )
)

===========================================================================================
modify_assign_of_assign
===========================================================================================

b += c = d

---

(module
  (modify_assign
    (identifier)
    (assign
      lhs: (identifier)
      rhs: (identifier)
    )
  )
)

===========================================================================================
assignment_multi_line
===========================================================================================

a =
  1, 2
foo = 1,
      2

---

(module
  (assign
    lhs: (identifier)
    rhs: (assign_expressions (number) (number))
  )
  (assign
    lhs: (identifier)
    rhs: (assign_expressions (number) (number))
  )
)


===========================================================================================
let_assignment
===========================================================================================

let x: String = 'hello'

---

(module
  (let_assign
    (variable
      (identifier)
      type: (identifier)
    )
    (string)
  )
)


===========================================================================================
test_assignment
===========================================================================================

@test foo = || true

---

(module
  (assign
    lhs: (meta
      (test) name: (identifier)
    )
    rhs: (function
      (args)
      body: (true)
    )
  )
)

===========================================================================================
boolean_chain
===========================================================================================

true and foo and false

---

(module
  (boolean_op
    (boolean_op
      (true)
      (identifier)
    )
    (false)
  )
)

===========================================================================================
return_indented
===========================================================================================

return
  foo

---

(module
  (return (identifier))
)

===========================================================================================
yield_indented
===========================================================================================

yield
  foo

---

(module
  (yield (identifier))
)

===========================================================================================
export_assign
===========================================================================================

export foo = 99

---

(module
  (export
    (assign
      (identifier)
      (number)
    )
  )
)

===========================================================================================
export_let
===========================================================================================

export let foo: Number = 99

---

(module
  (export
    (let_assign
      (variable
        (identifier)
        type: (identifier)
      )
      (number)
    )
  )
)

===========================================================================================
export_map_inline
===========================================================================================

export { foo, bar }

---

(module
  (export
    (map
      (entry_inline key: (identifier))
      (entry_inline key: (identifier))
    )
  )
)

===========================================================================================
export_map_block
===========================================================================================

export
  foo: 42
  'bar': 99

---

(module
  (export
    (map_block
      (entry_block
        key: (identifier)
        value: (number)
      )
      (entry_block
        key: (string)
        value: (number)
      )
    )
  )
)

===========================================================================================
import
===========================================================================================

import foo
import foo as bar
from foo import 'bar'
from foo.bar import x, 'y'
from 'hello' import foo
from foo import bar as x, baz as y

---

(module
  (import
    (import_item (identifier))
  )
  (import
    (import_item (identifier) (identifier))
  )
  (import
    (import_module (identifier))
    (import_item (string))
  )
  (import
    (import_module (identifier) (identifier))
    (import_item (identifier))
    (import_item (string))
  )
  (import
    (import_module (string))
    (import_item (identifier))
  )
  (import
    (import_module (identifier))
    (import_item (identifier) (identifier))
    (import_item (identifier) (identifier))
  )
)

===========================================================================================
import_with_three_items
===========================================================================================

from foo import a, b, c

---

(module
  (import
    (import_module (identifier))
    (import_item (identifier))
    (import_item (identifier))
    (import_item (identifier))
  )
)

===========================================================================================
debug
===========================================================================================

debug foo
debug 1 + 1
debug x, y

---

(module
  (debug (identifier))
  (debug (binary_op (number) (number)))
  (debug (identifier) (identifier))
)

===========================================================================================
try_catch_with_finally
===========================================================================================

try
  throw foo()
catch error
  throw error
finally
  x = 42

---

(module
  (try
    (block
      (throw (chain start: (identifier) call: (tuple)))
    )
  )
  (catch
    (identifier)
    (block
      (throw (identifier))
    )
  )
  (finally (block
    (assign 
      lhs: (identifier) 
      rhs: (number)
    )
  ))
)

===========================================================================================
try_catch_finally_in_function
===========================================================================================

x = ||
  try
    42
  catch _
    99
  finally
    123

---

(module
  (assign
    lhs: (identifier)
    rhs: (function
      (args)
      body: (block
        (try (block (number)))
        (catch
          (identifier)
          (block (number))
        )
        (finally (block (number)))
      )
    )
  )
)

===========================================================================================
try_catch_no_finally
===========================================================================================

try
  foo()
catch e
  bar()

---

(module
  (try (block (chain start: (identifier) call: (tuple))))
  (catch
    (identifier)
    (block
      (chain start: (identifier) call: (tuple))
    )
  )
)

===========================================================================================
try_catch_followed_by_expression
===========================================================================================

try
  123
catch error
  456
'hello'

---

(module
  (try (block (number)))
  (catch (identifier) (block (number)))
  (string)
)

