====
C-style initialization of arguments using parenthesis
====
NiceNice{
  *new{|aNumber(10)|}
}
---
(source_file
  (class_def
    (class )
    (class_method_name )
    (function_block
      (parameter_list
        (argument
          name: (identifier )
          value: (literal
            (number
              (integer ))))))))
====================
selector as infix binary operators
====================
(
(1..3) collect: { |x| x + 1 } bubble: 0
)
---
(source_file
  (code_block
    (binary_expression
      left: (binary_expression
        left: (collection
          (arithmetic_series
            (number
              (integer ))
            (number
              (integer ))))
        operator: (method_name )
        right: (function_block
          (parameter_list
            (argument
              name: (identifier )))
          (binary_expression
            left: (variable
              (environment_var
                name: (identifier )))
            right: (literal
              (number
                (integer ))))))
      operator: (method_name )
      right: (literal
        (number
          (integer ))))))

====================
nil checks using ?? !? and ?
====================
(
nil ?? "yo";
2 !? { nil };
a ? 2000;
)
---
(source_file
  (code_block
    (nil_check
      (variable
        (builtin_var ))
      (literal
        (string )))
    (nil_check
      (literal
        (number
          (integer )))
      (function_block
        (variable
          (builtin_var ))))
    (nil_check
      (variable
        (environment_var
          name: (identifier )))
      (literal
        (number
          (integer ))))))
=====================
String literal in unnamed argument calls
=====================
(
SynthDef(\yo, {});
SynthDef('yo', {});
)
---
(source_file
  (code_block
    (function_call
      (class )
      (parameter_call_list
        (argument_calls
          (unnamed_argument
            (literal
              (symbol
                (identifier )))))
        (argument_calls
          (unnamed_argument
            (function_block )))))
    (function_call
      (class )
      (parameter_call_list
        (argument_calls
          (unnamed_argument
            (literal
              (symbol
                ))))
        (argument_calls
          (unnamed_argument
            (function_block )))))))

=====================
return statement: string literal
=====================
(
^"hello";
)
---
(source_file
  (code_block
    (return_statement
      (literal
        (string )))))

=====================
return statement: string literal no semi colon
=====================
(
^"hello"
)
---
(source_file
  (code_block
    (return_statement
      (literal
        (string )))))

=====================
return statement with function call
=====================
EasyNRT {
	*new{
		^init()
	}
}
---
(source_file
  (class_def
    (class )
    (class_method_name )
    (function_block
      (return_statement
        (function_call
          (method_name ))))))

=====================
class method prefixed class: ar(SinOsc, 110)
=====================
(
ar(SinOsc, 110);
)
---
(source_file (code_block (function_call (method_name) (parameter_call_list (argument_calls (unnamed_argument (class))) (argument_calls (unnamed_argument (literal (number (integer)))))))))

=====================
Argument list with no commas
=====================

(
{|argument1 argument2|}
)

---
(source_file
  (code_block
    (function_block
      (parameter_list
        (argument
          name: (identifier ))
        (argument
          name: (identifier ))))))

=====================
function call in associtive item
=====================
(
	[freq: 2, froq: FroqGen()]
)
---
(source_file
  (code_block
    (collection
      (associative_item
        (identifier )
        (item
          (literal
            (number
              (integer )))))
      (associative_item
        (identifier )
        (item
          (function_call
            (class )))))))

=====================
unfold argument list with *
=====================

(
	f = {|a1, a2, a3| [a1,a2,a3].postln};
	f.value(*[2,3,4])
)
---
(source_file
  (code_block
    (function_definition
      name: (variable
        (environment_var
          name: (identifier )))
      value: (function_block
        (parameter_list
          (argument
            name: (identifier ))
          (argument
            name: (identifier ))
          (argument
            name: (identifier )))
        (function_call
          (receiver
            (collection
              (variable
                (local_var
                  name: (identifier )))
              (variable
                (local_var
                  name: (identifier )))
              (variable
                (local_var
                  name: (identifier )))))
          (method_call
            name: (method_name )))))
    (function_call
      (receiver
        (variable
          (environment_var
            name: (identifier ))))
      (method_call
        name: (method_name )
        (parameter_call_list
          (argument_calls
            (unnamed_argument
              (unary_expression
                right: (collection
                  (literal
                    (number
                      (integer )))
                  (literal
                    (number
                      (integer )))
                  (literal
                    (number
                      (integer ))))))))))))

==================
arg with ...
==================
(
f = {arg ...args; };
e = {|...args| };
)
---
(source_file
  (code_block
    (function_definition
      name: (variable
        (environment_var
          name: (identifier )))
      value: (function_block
        (parameter_list
          (argument
            name: (identifier )))))
    (function_definition
      name: (variable
        (environment_var
          name: (identifier )))
      value: (function_block
        (parameter_list
          (argument
            name: (identifier )))))))

==================
function call in binary operator
==================
(
var sig = sig * EnvGen.kr(
	Env([0.0,1.0,1.0,0], [fadeIn, fadeOut], releaseNode: 2),
	gate: killgate,
	doneAction: 2
);
)
---
(source_file
  (code_block
    (variable_definition
      name: (variable
        (local_var
          name: (identifier )))
      value: (function_call
        (receiver
          (binary_expression
            left: (variable
              (local_var
                name: (identifier )))
            right: (class )))
        (method_call
          name: (method_name )
          (parameter_call_list
            (argument_calls
              (unnamed_argument
                (function_call
                  (class )
                  (parameter_call_list
                    (argument_calls
                      (unnamed_argument
                        (collection
                          (literal
                            (number
                              (float )))
                          (literal
                            (number
                              (float )))
                          (literal
                            (number
                              (float )))
                          (literal
                            (number
                              (integer ))))))
                    (argument_calls
                      (unnamed_argument
                        (collection
                          (variable
                            (local_var
                              name: (identifier )))
                          (variable
                            (local_var
                              name: (identifier ))))))
                    (argument_calls
                      (named_argument
                        name: (identifier )
                        name: (literal
                          (number
                            (integer )))))))))
            (argument_calls
              (named_argument
                name: (identifier )
                name: (variable
                  (local_var
                    name: (identifier )))))
            (argument_calls
              (named_argument
                name: (identifier )
                name: (literal
                  (number
                    (integer )))))))))))

==================
instance variable setter method
==================
(
s.options.blockSize_(256);
)
---
(source_file
  (code_block
    (function_call
      (receiver
        (variable
          (environment_var
            name: (identifier ))))
      (method_call
        name: (method_name ))
      (method_call
        name: (method_name )
        (parameter_call_list
          (argument_calls
            (unnamed_argument
              (literal
                (number
                  (integer ))))))))))

==================
class method call explicit
==================

(
s = Server.new;
)

---
(source_file
  (code_block
    (variable_definition
      name: (variable
        (environment_var
          name: (identifier )))
      value: (function_call
        (receiver (class) )
        (method_call
          name: (method_name ))))))

==================
simple function definition no arguments
==================
f = {};

---
(source_file
  (function_definition
    (variable
      (environment_var (identifier)))
    (function_block )))

==================
Add two numbers in function with piped args
==================
f = {|oneArg=10, anotherArg=2| oneArg+anotherArg; };

---

(source_file
  (function_definition
    name: (variable
      (environment_var name: (identifier)))
    value: (function_block
      (parameter_list
        (argument name:
          (identifier )
          value: (literal
            (number
              (integer ))))
        (argument
          name: (identifier )
          value: (literal
            (number
              (integer )))))
      (binary_expression
        left: (variable
          (local_var name:
            (identifier )))
        right: (variable
          (local_var name:
            (identifier )))))))
==================
Add two numbers in function with arg list
==================
f = {arg oneArg=10, anotherArg=2; oneArg+anotherArg; };

---

(source_file
  (function_definition
    name: (variable
      (environment_var name: (identifier)))
    value: (function_block
      (parameter_list
        (argument
          name: (identifier )
          value: (literal
            (number
              (integer ))))
        (argument
          name: (identifier )
          value: (literal
            (number
              (integer )))))
      (binary_expression
        left: (variable
          (local_var
            name: (identifier )))
        right: (variable
          (local_var
            name: (identifier )))))))

==================
Class method calls, explicit
==================
(
SinOsc.ar(freq: 441, mul:0.25);
)
---
(source_file
  (code_block
    (function_call
      (receiver
        (class ))
      (method_call
        name: (method_name )
        (parameter_call_list
          (argument_calls
            (named_argument
              name: (identifier )
              name: (literal
                (number
                  (integer )))))
          (argument_calls
            (named_argument
              name: (identifier )
              name: (literal
                (number
                  (float ))))))))))

==================
classes as arguments
==================
(
{|a, b, c|}.value(SinOsc, LFTri, Saw)
)
---
(source_file
  (code_block
    (function_call
      (receiver
        (function_block
          (parameter_list
            (argument
              name: (identifier ))
            (argument
              name: (identifier ))
            (argument
              name: (identifier )))))
      (method_call
        name: (method_name )
        (parameter_call_list
          (argument_calls
            (unnamed_argument
              (class )))
          (argument_calls
            (unnamed_argument
              (class )))
          (argument_calls
            (unnamed_argument
              (class ))))))))

==========================
Class as argument in mix of named/unnamed parameter list
==========================
(
{|aaa, bbb, ccc|}.value(SinOsc, LFTri, ccc: Saw)
)
---
(source_file
  (code_block
    (function_call
      (receiver
        (function_block
          (parameter_list
            (argument
              name: (identifier ))
            (argument
              name: (identifier ))
            (argument
              name: (identifier )))))
      (method_call
        name: (method_name )
        (parameter_call_list
          (argument_calls
            (unnamed_argument
              (class )))
          (argument_calls
            (unnamed_argument
              (class )))
          (argument_calls
            (named_argument
              name: (identifier )
              name: (class ))))))))

============================
Implicit class method call to new in argument list
============================
(
{arg ab; }.value(SinOsc());
)
---
(source_file
  (code_block
    (function_call
      (receiver
        (function_block
          (parameter_list
            (argument
              name: (identifier )))))
      (method_call
        name: (method_name )
        (parameter_call_list
          (argument_calls
            (unnamed_argument
              (function_call
                (class )))))))))
==================
Chaining methods on explicit new
==================
(
Pfunc.new().trace
)
---
(source_file
  (code_block
    (function_call
      (receiver
        (class ))
      (method_call
        name: (method_name ))
      (method_call
        name: (method_name )))))

==================
Chaining methods on implicit new
==================
(
Pfunc().trace
)
---
(source_file
  (code_block
    (function_call
      (receiver
        (function_call
          (class )))
      (method_call
        name: (method_name )))))

==================
Class method calls, implicit
==================

Synth();
Synth(1,3,2);

---
(source_file
  (function_call
    (class
      ))
  (function_call
    (class
      )
    (parameter_call_list
      (argument_calls
        (unnamed_argument
          (literal
            (number
              (integer )))))
      (argument_calls
        (unnamed_argument
          (literal
            (number
              (integer )))))
      (argument_calls
        (unnamed_argument
          (literal
            (number
              (integer ))))))))

==================
Instance method (linlin on a float)
==================
0.5.linlin(0.0,1.0,1.0,10.0);
---
(source_file
  (function_call
    (receiver
      (literal
        (number
          (float ))))
    (method_call
      (method_name )
      (parameter_call_list
        (argument_calls
          (unnamed_argument
            (literal
              (number
                (float )))))
        (argument_calls
          (unnamed_argument
            (literal
              (number
                (float )))))
        (argument_calls
          (unnamed_argument
            (literal
              (number
                (float )))))
        (argument_calls
          (unnamed_argument
            (literal
              (number
                (float)))))))))

==================
instance method call with function as argument
==================
f = {|arg1|};
f.value(arg1: { "hej".postln; });
---
(source_file
  (function_definition
    (variable
      (environment_var (identifier)))
    (function_block
      (parameter_list
        (argument
          (identifier )))))
  (function_call
    (receiver
      (variable
        (environment_var (identifier))))
    (method_call
      (method_name )
      (parameter_call_list
        (argument_calls
          (named_argument
            (identifier )
            (function_block
              (function_call
                (receiver
                  (literal
                    (string )))
                (method_call
                  (method_name ))))))))))

==================
instance method call with collection as argument
==================
f = {|arg1|};
f.value(arg1: #[1,2,3]);
---
(source_file
  (function_definition
    (variable
      (environment_var (identifier)))
    (function_block
      (parameter_list
        (argument
          (identifier )))))
  (function_call
    (receiver
      (variable
        (environment_var (identifier))))
    (method_call
      (method_name )
      (parameter_call_list
        (argument_calls
          (named_argument
            (identifier )
            (collection
              (literal
                (number
                  (integer )))
              (literal
                (number
                  (integer )))
              (literal
                (number
                  (integer ))))))))))

==================
instance method call with string as argument
==================
f = {|arg1|};
f.value(arg1: "hejhje hej");
---
(source_file
  (function_definition
    (variable
      (environment_var (identifier)))
    (function_block
      (parameter_list
        (argument
          (identifier )))))
  (function_call
    (receiver
      (variable
        (environment_var (identifier))))
    (method_call
      (method_name )
      (parameter_call_list
        (argument_calls
          (named_argument
            (identifier )
            (literal
              (string ))))))))

==================
instance method call with symbol as argument
==================
f = {|arg1|};
f.value(arg1: \hej);
---
(source_file
  (function_definition
    (variable
      (environment_var (identifier)))
    (function_block
      (parameter_list
        (argument
          (identifier )))))
  (function_call
    (receiver
      (variable
        (environment_var (identifier))))
    (method_call
      (method_name )
      (parameter_call_list
        (argument_calls
          (named_argument
            (identifier )
            (literal
              (symbol (identifier) ))))))))

==================
chained instance methods on literal
==================
"Hej % and %".format(20, 33).postln;
---
(source_file
  (function_call
    (receiver
      (literal
        (string )))
    (method_call
      (method_name )
      (parameter_call_list
        (argument_calls
          (unnamed_argument
            (literal
              (number
                (integer )))))
        (argument_calls
          (unnamed_argument
            (literal
              (number
                (integer )))))))
    (method_call
      (method_name ))))

==================
chained instance methods on env var
==================
a = 10;
a.pow(2).nextPowerOfThree;
---
(source_file
  (variable_definition
    (variable
      (environment_var (identifier)))
    (literal
      (number
        (integer ))))
  (function_call
    (receiver
      (variable
        (environment_var (identifier))))
    (method_call
      (method_name )
      (parameter_call_list
        (argument_calls
          (unnamed_argument
            (literal
              (number
                (integer )))))))
    (method_call
      (method_name ))))
