==================================
standalone assignment expression
==================================

main() {
  x = 3;
}

---

(program
    (function_signature
      (identifier)
      (formal_parameter_list))
    (function_body
      (block
        (expression_statement
          (assignment_expression
            (assignable_expression
              (identifier))
            (decimal_integer_literal))))))

==================================
standalone binary expression
==================================

main() {
  a > b;
  a < b;
  a == b;
  a >= b;
  a <= b;
  a != b;
  a && b;
  a || b;
  a & b;
  a | b;
  a ^ b;
  a % b;
  a << b;
  a >> b;
  a >>> b;
  3 + 2;
  3 - 2;
  3 * 2;
  9 / 3;
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (relational_expression
              (identifier)
              (relational_operator)
              (identifier)))
          (expression_statement
            (relational_expression
              (identifier)
              (relational_operator)
              (identifier)))
          (expression_statement
            (equality_expression
              (identifier)
              (equality_operator)
              (identifier)))
          (expression_statement
            (relational_expression
              (identifier)
              (relational_operator)
              (identifier)))
          (expression_statement
            (relational_expression
              (identifier)
              (relational_operator)
              (identifier)))
          (expression_statement
            (equality_expression
              (identifier)
              (equality_operator)
              (identifier)))
          (expression_statement
            (logical_and_expression
              (identifier)
              (logical_and_operator)
              (identifier)))
          (expression_statement
            (logical_or_expression
              (identifier)
              (logical_or_operator)
              (identifier)))
          (expression_statement
            (bitwise_and_expression
              (identifier)
              (identifier)))
          (expression_statement
            (bitwise_or_expression
              (identifier)
              (identifier)))
          (expression_statement
            (bitwise_xor_expression
              (identifier)
              (identifier)))
          (expression_statement
            (multiplicative_expression
              (identifier)
              (multiplicative_operator)
              (identifier)))
          (expression_statement
            (shift_expression
              (identifier)
              (shift_operator)
              (identifier)))
          (expression_statement
            (shift_expression
              (identifier)
              (shift_operator)
              (identifier)))
          (expression_statement
            (shift_expression
              (identifier)
              (shift_operator)
              (identifier)))
          (expression_statement
            (additive_expression
              (decimal_integer_literal)
              (additive_operator)
              (decimal_integer_literal)))
          (expression_statement
            (additive_expression
              (decimal_integer_literal)
              (additive_operator)
              (decimal_integer_literal)))
          (expression_statement
            (multiplicative_expression
              (decimal_integer_literal)
              (multiplicative_operator)
              (decimal_integer_literal)))
          (expression_statement
            (multiplicative_expression
              (decimal_integer_literal)
              (multiplicative_operator)
              (decimal_integer_literal))))))

==================================
is expressions
==================================

main() {
  a is C.D;
  a is List<B>;
  c is C;
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (type_test_expression
              (identifier)
              (type_test
                (is_operator)
                (type_identifier)
                (type_identifier))))
          (expression_statement
            (type_test_expression
              (identifier)
              (type_test
                (is_operator)
                (type_identifier)
                (type_arguments
                  (type_identifier)))))
          (expression_statement
            (type_test_expression
              (identifier)
              (type_test
                (is_operator)
                (type_identifier)))))))

===========================================================
if statements
===========================================================

main() {
  if (x)
    y;
}

---

(program
    (function_signature
      (identifier)
      (formal_parameter_list))
    (function_body
      (block
        (if_statement
            (identifier)
          (expression_statement
            (identifier))))))

===========================================================
if statements with braces
===========================================================

main() {
  if (x) {
    y;
  }
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (if_statement
              (identifier)
            (block
              (expression_statement
                (identifier)))))))

===========================================================
if statements with assignment without braces
===========================================================

main(){
  if (x != 3)
    y = 2;
}
---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (if_statement
              (equality_expression
                (identifier)
                (equality_operator)
                (decimal_integer_literal))
            (expression_statement
              (assignment_expression
                (assignable_expression
                  (identifier))
                (decimal_integer_literal)))))))

==================================
if then else statement
==================================

main() {
  if (x == 3) {
    y = 9;
  } else {
    y = 0;
  }
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (if_statement
              (equality_expression
                (identifier)
                (equality_operator)
                (decimal_integer_literal))
            (block
              (expression_statement
                (assignment_expression
                  (assignable_expression
                    (identifier))
                  (decimal_integer_literal))))
            (block
              (expression_statement
                (assignment_expression
                  (assignable_expression
                    (identifier))
                  (decimal_integer_literal))))))))

==================================
nested if then else statements
==================================

main() {
  if (a)
    if (b)
      c();
    else
      d();
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (if_statement
              (identifier)
            (if_statement
                (identifier)
              (expression_statement
                (identifier)
                (selector
                  (argument_part
                    (arguments))))
              (expression_statement
                (identifier)
                (selector
                  (argument_part
                    (arguments)))))))))

==================================
ternary expressions
==================================

final max = (a > b) ? a : b;

---

(program
      (final_builtin)
      (static_final_declaration_list
        (static_final_declaration
          (identifier)
          (conditional_expression
            (parenthesized_expression
              (relational_expression
                (identifier)
                (relational_operator)
                (identifier)))
            (identifier)
            (identifier)))))

==================================
for statement
==================================

main() {
  for(int i = 1; i < 11; i++) {
    print("Count is: " + i);
  }

  for (j.init(i); j.check(); j.update()) {
    print(j);
  }
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (for_statement
            (for_loop_parts
              (local_variable_declaration
                (initialized_variable_definition
                  (type_identifier)
                  (identifier)
                  (decimal_integer_literal)))
              (relational_expression
                (identifier)
                (relational_operator)
                (decimal_integer_literal))
              (postfix_expression
                (assignable_expression
                  (identifier))
                (postfix_operator
                  (increment_operator))))
            (block
              (expression_statement
                (identifier)
                (selector
                  (argument_part
                    (arguments
                      (argument
                        (additive_expression
                          (string_literal)
                          (additive_operator)
                          (identifier)))))))))
          (for_statement
            (for_loop_parts
              (identifier)
              (selector
                (unconditional_assignable_selector
                  (identifier)))
              (selector
                (argument_part
                  (arguments
                    (argument
                      (identifier)))))
              (identifier)
              (selector
                (unconditional_assignable_selector
                  (identifier)))
              (selector
                (argument_part
                  (arguments)))
              (identifier)
              (selector
                (unconditional_assignable_selector
                  (identifier)))
              (selector
                (argument_part
                  (arguments))))
            (block
              (expression_statement
                (identifier)
                (selector
                  (argument_part
                    (arguments
                      (argument
                        (identifier)))))))))))

================================
enhanced for statements
================================

main() {
  for (A b in c) {
    d(b);
  }
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (for_statement
            (for_loop_parts
              (type_identifier)
              (identifier)
              (identifier))
            (block
              (expression_statement
                (identifier)
                (selector
                  (argument_part
                    (arguments
                      (argument
                        (identifier)))))))))))

================================
await expressions
================================

void main() async {
  final id = await Future.delayed(const Duration(seconds: 100));
}

---

(program (function_signature (void_type) (identifier) (formal_parameter_list)) 
  (function_body (block 
    (local_variable_declaration (initialized_variable_definition (final_builtin) (identifier) (unary_expression 
      (await_expression (identifier) (selector (unconditional_assignable_selector (identifier))) 
        (selector (argument_part (arguments (argument
          (const_object_expression (const_builtin) (type_identifier) 
            (arguments (named_argument (label (identifier)) (decimal_integer_literal)))))))))))))))

================================
unary negation expression
================================

void main() {
  final remote = false;
  if (!remote) {
    server = localUrl;
  }
}

---

(program (function_signature (void_type) (identifier) (formal_parameter_list)) 
  (function_body (block 
    (local_variable_declaration (initialized_variable_definition (final_builtin) (identifier) (false))) 
    (if_statement (unary_expression (prefix_operator (negation_operator)) (identifier)) 
      (block (expression_statement (assignment_expression (assignable_expression (identifier)) (identifier))))))))

================================
assert statement
================================

main() {
  assert(x != null);
}

---
(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (assert_statement
            (assertion
              (assertion_arguments
                (equality_expression
                  (identifier)
                  (equality_operator)
                  (null_literal))))))))

===========================
Type cast in if statement
===========================

main(){
  if (data['frame_count'] as int < 5) {

  }
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (if_statement
            (relational_expression
              (type_cast_expression
                (identifier)
                (selector
                  (unconditional_assignable_selector
                    (index_selector
                      (string_literal))))
                (type_cast
                  (as_operator)
                  (type_identifier)))
              (relational_operator)
              (decimal_integer_literal))
            (block)))))


===========================
Type cast in if statement parenthesized
===========================

main(){
  if ((data['frame_count'] as int) < 5) {
  }
}
---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (if_statement
            (relational_expression
              (parenthesized_expression
                (type_cast_expression
                    (identifier)
                    (selector
                      (unconditional_assignable_selector
                        (index_selector
                          (string_literal))))
                  (type_cast
                    (as_operator)
                    (type_identifier))))
                (relational_operator)
                (decimal_integer_literal))
            (block)))))

==========================
Simple non-null assertion
==========================

main() {
  my!.size = 1;
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (assignment_expression
              (assignable_expression
                (identifier)
                (selector)
                (unconditional_assignable_selector
                  (identifier)))
              (decimal_integer_literal))))))

==========================
Additional non-null assertion
==========================

main() {
  my.size!.run();
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (identifier)
            (selector
              (unconditional_assignable_selector
                (identifier)))
            (selector)
            (selector
              (unconditional_assignable_selector
                (identifier)))
            (selector
              (argument_part
                (arguments)))))))

============================
Simple assertion w/o nonnull
============================

main() {
  my.size.whatever = 1;
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (assignment_expression
              (assignable_expression
                (identifier)
                (selector
                  (unconditional_assignable_selector
                    (identifier)))
                (unconditional_assignable_selector
                  (identifier)))
              (decimal_integer_literal))))))

============================
Complex type cast in function call
============================

main() {
  printStream(args['json'] as bool ? '' : 'hi');
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (identifier)
            (selector
              (argument_part
                (arguments
                  (argument
                    (conditional_expression
                      (type_cast_expression
                        (identifier)
                        (selector
                          (unconditional_assignable_selector
                            (index_selector
                              (string_literal))))
                      (type_cast
                        (as_operator)
                        (type_identifier)))
                      (string_literal)
                      (string_literal))))))))))

============================
Complex (parenthesized) type cast in function call
============================

main() {
  printStream((args['json'] as bool) ? '' : 'hi');
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (identifier)
            (selector
              (argument_part
                (arguments
                  (argument
                    (conditional_expression
                      (parenthesized_expression
                        (type_cast_expression
                          (identifier)
                          (selector
                            (unconditional_assignable_selector
                              (index_selector
                                (string_literal))))
                          (type_cast
                            (as_operator)
                            (type_identifier))))
                      (string_literal)
                      (string_literal))))))))))

==================================
typecast in expression
==================================

main() {
  a['json'] as BigB > b;
  a < b['json'] as BigB;
  a == b as BigB;
  a as BigB >= b;
  a <= b;
  a as BigB != b;
  a && b as BigB;
  a as BigB || b as BigB;
  if (a['json'] as BigB < b as BigB) {
  }
  a as BigB | b as BigB;
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (relational_expression
              (type_cast_expression
                (identifier)
                (selector
                  (unconditional_assignable_selector
                    (index_selector
                      (string_literal))))
                (type_cast
                  (as_operator)
                  (type_identifier)))
              (relational_operator)
              (identifier)))
          (expression_statement
            (relational_expression
              (identifier)
              (relational_operator)
              (type_cast_expression
                (identifier)
                (selector
                  (unconditional_assignable_selector
                    (index_selector
                      (string_literal))))
                (type_cast
                  (as_operator)
                  (type_identifier)))))
          (expression_statement
            (equality_expression
              (identifier)
              (equality_operator)
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier)))))
          (expression_statement
            (relational_expression
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier)))
              (relational_operator)
              (identifier)))
          (expression_statement
            (relational_expression
              (identifier)
              (relational_operator)
              (identifier)))
          (expression_statement
            (equality_expression
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier)))
              (equality_operator)
              (identifier)))
          (expression_statement
            (logical_and_expression
              (identifier)
              (logical_and_operator)
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier)))))
          (expression_statement
            (logical_or_expression
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier)))
              (logical_or_operator)
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier)))))
          (if_statement
            (relational_expression
              (type_cast_expression
                (identifier)
                (selector
                  (unconditional_assignable_selector
                    (index_selector
                      (string_literal))))
                (type_cast
                  (as_operator)
                  (type_identifier)))
              (relational_operator)
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier))))
            (block))
          (expression_statement
            (bitwise_or_expression
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier)))
              (type_cast_expression
                (identifier)
                (type_cast
                  (as_operator)
                  (type_identifier))))))))

=============================
Non-null assignable selector
=============================

main() {
  parameters?["charset"];
}

---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (identifier)
            (selector
              (conditional_assignable_selector
                (index_selector
                  (string_literal))))))))
