DefinitionTree { definitions: [ TypeAlias( TypeAliasDefinition { type: Keyword { value: "type", position: 0, }, name: TemplatedIdentifier { name: Identifier { position: 5, value: "num", }, templates: None, }, equals: 9, type_definition: Union( [ SignedInteger( Default( Keyword { value: "int", position: 11, }, ), ), FloatingPoint( Default( Keyword { value: "float", position: 15, }, ), ), ], ), semicolon: 20, }, ), Class( ClassDefinition { comments: CommentGroup { comments: [], }, attributes: [], modifiers: ModifierGroupDefinition { position: 38, modifiers: [ Final( Keyword { value: "final", position: 23, }, ), Readonly( Keyword { value: "readonly", position: 29, }, ), ], }, class: Keyword { value: "class", position: 38, }, name: Identifier { position: 44, value: "Collection", }, templates: Some( TemplateGroupDefinition { comments: CommentGroup { comments: [], }, less_than: 54, members: CommaSeparated { inner: [ TemplateDefinition { variance: Invaraint, name: Identifier { position: 55, value: "T", }, constraint: None, }, ], commas: [], }, greater_than: 56, }, ), extends: None, implements: None, body: ClassDefinitionBody { left_brace: 58, members: [ Method( MethodDefinition { comments: CommentGroup { comments: [], }, attributes: [], modifiers: ModifierGroupDefinition { position: 71, modifiers: [ Public( Keyword { value: "public", position: 64, }, ), ], }, function: Keyword { value: "function", position: 71, }, name: Identifier { position: 80, value: "__construct", }, templates: None, parameters: MethodParameterListDefinition { comments: CommentGroup { comments: [], }, left_parenthesis: 91, parameters: CommaSeparated { inner: [ MethodParameterDefinition { attributes: [], comments: CommentGroup { comments: [], }, modifiers: ModifierGroupDefinition { position: 109, modifiers: [ Private( Keyword { value: "private", position: 101, }, ), ], }, type_definition: Vec( Keyword { value: "vec", position: 109, }, TypeTemplateGroupDefinition { comments: CommentGroup { comments: [], }, less_than: 112, members: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 113, value: "T", }, templates: None, }, ), ], commas: [], }, greater_than: 114, }, ), ellipsis: None, variable: Variable { position: 116, name: "$items", }, default: Some( FunctionLikeParameterDefaultValueDefinition { equals: 123, value: Vec( VecExpression { comments: CommentGroup { comments: [], }, vec: Keyword { value: "vec", position: 125, }, left_bracket: 128, elements: CommaSeparated { inner: [], commas: [], }, right_bracket: 129, }, ), }, ), }, ], commas: [ 130, ], }, right_parenthesis: 136, }, return_type: None, constraints: None, body: Concrete( BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 138, statements: [], right_brace: 139, }, ), }, ), Method( MethodDefinition { comments: CommentGroup { comments: [], }, attributes: [], modifiers: ModifierGroupDefinition { position: 153, modifiers: [ Public( Keyword { value: "public", position: 146, }, ), ], }, function: Keyword { value: "function", position: 153, }, name: Identifier { position: 162, value: "filter", }, templates: None, parameters: MethodParameterListDefinition { comments: CommentGroup { comments: [], }, left_parenthesis: 168, parameters: CommaSeparated { inner: [ MethodParameterDefinition { attributes: [], comments: CommentGroup { comments: [], }, modifiers: ModifierGroupDefinition { position: 169, modifiers: [], }, type_definition: Identifier( TemplatedIdentifier { name: Identifier { position: 169, value: "Closure", }, templates: Some( TypeTemplateGroupDefinition { comments: CommentGroup { comments: [], }, less_than: 176, members: CommaSeparated { inner: [ Tuple { left_parenthesis: 177, type_definitions: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 178, value: "T", }, templates: None, }, ), ], commas: [], }, right_parenthesis: 179, }, Boolean( Keyword { value: "bool", position: 182, }, ), ], commas: [ 180, ], }, greater_than: 186, }, ), }, ), ellipsis: None, variable: Variable { position: 188, name: "$func", }, default: None, }, ], commas: [], }, right_parenthesis: 193, }, return_type: Some( FunctionLikeReturnTypeDefinition { colon: 194, type_definition: Identifier( TemplatedIdentifier { name: Identifier { position: 196, value: "Collection", }, templates: Some( TypeTemplateGroupDefinition { comments: CommentGroup { comments: [], }, less_than: 206, members: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 207, value: "T", }, templates: None, }, ), ], commas: [], }, greater_than: 208, }, ), }, ), }, ), constraints: None, body: Concrete( BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 210, statements: [ Expression( ExpressionStatement { comments: CommentGroup { comments: [], }, expression: AssignmentOperation( Assignment { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 220, name: "$result", }, ), equals: 228, right: Vec( VecExpression { comments: CommentGroup { comments: [], }, vec: Keyword { value: "vec", position: 230, }, left_bracket: 233, elements: CommaSeparated { inner: [], commas: [], }, right_bracket: 234, }, ), }, ), semicolon: 235, }, ), Foreach( ForeachStatement { comments: CommentGroup { comments: [], }, foreach: Keyword { value: "foreach", position: 245, }, iterator: Value { expression: ObjectOperation( PropertyFetch { comments: CommentGroup { comments: [], }, object: Variable( Variable { position: 253, name: "$this", }, ), arrow: 258, property: Identifier { position: 260, value: "items", }, }, ), as: Keyword { value: "as", position: 266, }, value: Variable { position: 269, name: "$item", }, }, block: BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 275, statements: [ If( IfStatement { comments: CommentGroup { comments: [], }, if: Keyword { value: "if", position: 289, }, conditions: CommaSeparated { inner: [ FunctionOperation( Call { comments: CommentGroup { comments: [], }, function: Variable( Variable { position: 292, name: "$func", }, ), generics: None, arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 297, arguments: CommaSeparated { inner: [ Value { comments: CommentGroup { comments: [], }, value: Variable( Variable { position: 298, name: "$item", }, ), }, ], commas: [], }, right_parenthesis: 303, }, }, ), ], commas: [], }, block: BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 305, statements: [ Expression( ExpressionStatement { comments: CommentGroup { comments: [], }, expression: AssignmentOperation( Assignment { comments: CommentGroup { comments: [], }, left: ArrayOperation( Push { comments: CommentGroup { comments: [], }, array: Variable( Variable { position: 323, name: "$result", }, ), left_bracket: 330, right_bracket: 331, }, ), equals: 333, right: Variable( Variable { position: 335, name: "$item", }, ), }, ), semicolon: 340, }, ), ], right_brace: 354, }, elseifs: [], else: None, }, ), ], right_brace: 364, }, else: None, else_block: None, }, ), Return( Explicit { comments: CommentGroup { comments: [], }, return: Keyword { value: "return", position: 375, }, expression: Some( ClassOperation( Initialization { comments: CommentGroup { comments: [], }, new: Keyword { value: "new", position: 382, }, class: Identifier( Identifier { position: 386, value: "Collection", }, ), generics: Some( GenericGroupExpression { double_colon_less_than: 396, types: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 399, value: "T", }, templates: None, }, ), ], commas: [], }, greater_than: 400, }, ), arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 401, arguments: CommaSeparated { inner: [ Value { comments: CommentGroup { comments: [], }, value: Variable( Variable { position: 402, name: "$result", }, ), }, ], commas: [], }, right_parenthesis: 409, }, }, ), ), semicolon: 410, }, ), ], right_brace: 416, }, ), }, ), Method( MethodDefinition { comments: CommentGroup { comments: [], }, attributes: [], modifiers: ModifierGroupDefinition { position: 430, modifiers: [ Public( Keyword { value: "public", position: 423, }, ), ], }, function: Keyword { value: "function", position: 430, }, name: Identifier { position: 439, value: "map", }, templates: Some( TemplateGroupDefinition { comments: CommentGroup { comments: [], }, less_than: 442, members: CommaSeparated { inner: [ TemplateDefinition { variance: Invaraint, name: Identifier { position: 443, value: "Tout", }, constraint: None, }, ], commas: [], }, greater_than: 447, }, ), parameters: MethodParameterListDefinition { comments: CommentGroup { comments: [], }, left_parenthesis: 448, parameters: CommaSeparated { inner: [ MethodParameterDefinition { attributes: [], comments: CommentGroup { comments: [], }, modifiers: ModifierGroupDefinition { position: 449, modifiers: [], }, type_definition: Identifier( TemplatedIdentifier { name: Identifier { position: 449, value: "Closure", }, templates: Some( TypeTemplateGroupDefinition { comments: CommentGroup { comments: [], }, less_than: 456, members: CommaSeparated { inner: [ Tuple { left_parenthesis: 457, type_definitions: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 458, value: "T", }, templates: None, }, ), ], commas: [], }, right_parenthesis: 459, }, Identifier( TemplatedIdentifier { name: Identifier { position: 462, value: "Tout", }, templates: None, }, ), ], commas: [ 460, ], }, greater_than: 466, }, ), }, ), ellipsis: None, variable: Variable { position: 468, name: "$func", }, default: None, }, ], commas: [], }, right_parenthesis: 473, }, return_type: Some( FunctionLikeReturnTypeDefinition { colon: 474, type_definition: Identifier( TemplatedIdentifier { name: Identifier { position: 476, value: "Collection", }, templates: Some( TypeTemplateGroupDefinition { comments: CommentGroup { comments: [], }, less_than: 486, members: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 487, value: "Tout", }, templates: None, }, ), ], commas: [], }, greater_than: 491, }, ), }, ), }, ), constraints: None, body: Concrete( BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 493, statements: [ Expression( ExpressionStatement { comments: CommentGroup { comments: [], }, expression: AssignmentOperation( Assignment { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 503, name: "$result", }, ), equals: 511, right: Vec( VecExpression { comments: CommentGroup { comments: [], }, vec: Keyword { value: "vec", position: 513, }, left_bracket: 516, elements: CommaSeparated { inner: [], commas: [], }, right_bracket: 517, }, ), }, ), semicolon: 518, }, ), Foreach( ForeachStatement { comments: CommentGroup { comments: [], }, foreach: Keyword { value: "foreach", position: 528, }, iterator: Value { expression: ObjectOperation( PropertyFetch { comments: CommentGroup { comments: [], }, object: Variable( Variable { position: 536, name: "$this", }, ), arrow: 541, property: Identifier { position: 543, value: "items", }, }, ), as: Keyword { value: "as", position: 549, }, value: Variable { position: 552, name: "$item", }, }, block: BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 558, statements: [ Expression( ExpressionStatement { comments: CommentGroup { comments: [], }, expression: AssignmentOperation( Assignment { comments: CommentGroup { comments: [], }, left: ArrayOperation( Push { comments: CommentGroup { comments: [], }, array: Variable( Variable { position: 572, name: "$result", }, ), left_bracket: 579, right_bracket: 580, }, ), equals: 582, right: FunctionOperation( Call { comments: CommentGroup { comments: [], }, function: Variable( Variable { position: 584, name: "$func", }, ), generics: None, arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 589, arguments: CommaSeparated { inner: [ Value { comments: CommentGroup { comments: [], }, value: Variable( Variable { position: 590, name: "$item", }, ), }, ], commas: [], }, right_parenthesis: 595, }, }, ), }, ), semicolon: 596, }, ), ], right_brace: 606, }, else: None, else_block: None, }, ), Return( Explicit { comments: CommentGroup { comments: [], }, return: Keyword { value: "return", position: 617, }, expression: Some( ClassOperation( Initialization { comments: CommentGroup { comments: [], }, new: Keyword { value: "new", position: 624, }, class: Identifier( Identifier { position: 628, value: "Collection", }, ), generics: Some( GenericGroupExpression { double_colon_less_than: 638, types: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 641, value: "Tout", }, templates: None, }, ), ], commas: [], }, greater_than: 645, }, ), arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 646, arguments: CommaSeparated { inner: [ Value { comments: CommentGroup { comments: [], }, value: Variable( Variable { position: 647, name: "$result", }, ), }, ], commas: [], }, right_parenthesis: 654, }, }, ), ), semicolon: 655, }, ), ], right_brace: 661, }, ), }, ), Method( MethodDefinition { comments: CommentGroup { comments: [], }, attributes: [], modifiers: ModifierGroupDefinition { position: 675, modifiers: [ Public( Keyword { value: "public", position: 668, }, ), ], }, function: Keyword { value: "function", position: 675, }, name: Identifier { position: 684, value: "sum", }, templates: None, parameters: MethodParameterListDefinition { comments: CommentGroup { comments: [], }, left_parenthesis: 687, parameters: CommaSeparated { inner: [], commas: [], }, right_parenthesis: 688, }, return_type: Some( FunctionLikeReturnTypeDefinition { colon: 689, type_definition: SignedInteger( Default( Keyword { value: "int", position: 691, }, ), ), }, ), constraints: Some( MethodTypeConstraintGroupDefinition { comments: CommentGroup { comments: [], }, where: Keyword { value: "where", position: 695, }, constraints: CommaSeparated { inner: [ MethodTypeConstraintDefinition { comments: CommentGroup { comments: [], }, identifier: Identifier { position: 701, value: "T", }, is: Keyword { value: "is", position: 703, }, type_definition: Identifier( TemplatedIdentifier { name: Identifier { position: 706, value: "num", }, templates: None, }, ), }, ], commas: [], }, }, ), body: Concrete( BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 710, statements: [ Expression( ExpressionStatement { comments: CommentGroup { comments: [], }, expression: AssignmentOperation( Assignment { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 720, name: "$result", }, ), equals: 728, right: Literal( Integer( LiteralInteger { comments: CommentGroup { comments: [], }, value: "0", position: 730, }, ), ), }, ), semicolon: 731, }, ), Foreach( ForeachStatement { comments: CommentGroup { comments: [], }, foreach: Keyword { value: "foreach", position: 741, }, iterator: Value { expression: ObjectOperation( PropertyFetch { comments: CommentGroup { comments: [], }, object: Variable( Variable { position: 749, name: "$this", }, ), arrow: 754, property: Identifier { position: 756, value: "items", }, }, ), as: Keyword { value: "as", position: 762, }, value: Variable { position: 765, name: "$item", }, }, block: BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 771, statements: [ Expression( ExpressionStatement { comments: CommentGroup { comments: [], }, expression: AssignmentOperation( Addition { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 785, name: "$result", }, ), plus_equals: 793, right: Variable( Variable { position: 796, name: "$item", }, ), }, ), semicolon: 801, }, ), ], right_brace: 811, }, else: None, else_block: None, }, ), Return( Implicit { comments: CommentGroup { comments: [], }, expression: Variable( Variable { position: 822, name: "$result", }, ), }, ), ], right_brace: 834, }, ), }, ), ], right_brace: 836, }, }, ), Function( FunctionDefinition { comments: CommentGroup { comments: [], }, attributes: [], function: Keyword { value: "function", position: 839, }, name: Identifier { position: 848, value: "example", }, templates: None, parameters: FunctionLikeParameterListDefinition { comments: CommentGroup { comments: [], }, left_parenthesis: 855, parameters: CommaSeparated { inner: [], commas: [], }, right_parenthesis: 856, }, return_type: FunctionLikeReturnTypeDefinition { colon: 857, type_definition: SignedInteger( Default( Keyword { value: "int", position: 859, }, ), ), }, body: BlockStatement { comments: CommentGroup { comments: [], }, left_brace: 863, statements: [ Expression( ExpressionStatement { comments: CommentGroup { comments: [], }, expression: AssignmentOperation( Assignment { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 869, name: "$collection", }, ), equals: 881, right: ClassOperation( Initialization { comments: CommentGroup { comments: [], }, new: Keyword { value: "new", position: 883, }, class: Identifier( Identifier { position: 887, value: "Collection", }, ), generics: Some( GenericGroupExpression { double_colon_less_than: 897, types: CommaSeparated { inner: [ Identifier( TemplatedIdentifier { name: Identifier { position: 900, value: "num", }, templates: None, }, ), ], commas: [], }, greater_than: 903, }, ), arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 904, arguments: CommaSeparated { inner: [ Value { comments: CommentGroup { comments: [], }, value: Vec( VecExpression { comments: CommentGroup { comments: [], }, vec: Keyword { value: "vec", position: 905, }, left_bracket: 908, elements: CommaSeparated { inner: [ VecElementExpression { value: Literal( Integer( LiteralInteger { comments: CommentGroup { comments: [], }, value: "1", position: 918, }, ), ), }, VecElementExpression { value: Literal( Integer( LiteralInteger { comments: CommentGroup { comments: [], }, value: "2", position: 921, }, ), ), }, VecElementExpression { value: Literal( Float( LiteralFloat { comments: CommentGroup { comments: [], }, value: "3.0", position: 924, }, ), ), }, VecElementExpression { value: Literal( Float( LiteralFloat { comments: CommentGroup { comments: [], }, value: "4.0", position: 929, }, ), ), }, VecElementExpression { value: Literal( Integer( LiteralInteger { comments: CommentGroup { comments: [], }, value: "5", position: 934, }, ), ), }, VecElementExpression { value: Literal( Integer( LiteralInteger { comments: CommentGroup { comments: [], }, value: "6", position: 937, }, ), ), }, VecElementExpression { value: Literal( Float( LiteralFloat { comments: CommentGroup { comments: [], }, value: "7.0", position: 940, }, ), ), }, VecElementExpression { value: Literal( Float( LiteralFloat { comments: CommentGroup { comments: [], }, value: "9.0", position: 945, }, ), ), }, VecElementExpression { value: Literal( Integer( LiteralInteger { comments: CommentGroup { comments: [], }, value: "10", position: 950, }, ), ), }, ], commas: [ 919, 922, 927, 932, 935, 938, 943, 948, ], }, right_bracket: 957, }, ), }, ], commas: [], }, right_parenthesis: 958, }, }, ), }, ), semicolon: 959, }, ), Return( Implicit { comments: CommentGroup { comments: [], }, expression: ObjectOperation( MethodCall { comments: CommentGroup { comments: [], }, object: ObjectOperation( MethodCall { comments: CommentGroup { comments: [], }, object: ObjectOperation( MethodCall { comments: CommentGroup { comments: [], }, object: Variable( Variable { position: 966, name: "$collection", }, ), arrow: 984, method: Identifier { position: 986, value: "filter", }, generics: None, arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 992, arguments: CommaSeparated { inner: [ Value { comments: CommentGroup { comments: [], }, value: ArrowFunction( ArrowFunctionExpression { comments: CommentGroup { comments: [], }, attributes: [], static: None, fn: Keyword { value: "fn", position: 993, }, parameters: FunctionLikeParameterListDefinition { comments: CommentGroup { comments: [], }, left_parenthesis: 995, parameters: CommaSeparated { inner: [ FunctionLikeParameterDefinition { comments: CommentGroup { comments: [], }, attributes: [], type_definition: Identifier( TemplatedIdentifier { name: Identifier { position: 996, value: "num", }, templates: None, }, ), ellipsis: None, variable: Variable { position: 1000, name: "$n", }, default: None, }, ], commas: [], }, right_parenthesis: 1002, }, return_type: FunctionLikeReturnTypeDefinition { colon: 1003, type_definition: Boolean( Keyword { value: "bool", position: 1005, }, ), }, double_arrow: 1010, body: ComparisonOperation( LessThan { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 1013, name: "$n", }, ), less_than: 1016, right: Literal( Integer( LiteralInteger { comments: CommentGroup { comments: [], }, value: "8", position: 1018, }, ), ), }, ), }, ), }, ], commas: [], }, right_parenthesis: 1019, }, }, ), arrow: 1027, method: Identifier { position: 1029, value: "map", }, generics: Some( GenericGroupExpression { double_colon_less_than: 1032, types: CommaSeparated { inner: [ FloatingPoint( Default( Keyword { value: "float", position: 1035, }, ), ), ], commas: [], }, greater_than: 1040, }, ), arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 1041, arguments: CommaSeparated { inner: [ Value { comments: CommentGroup { comments: [], }, value: ArrowFunction( ArrowFunctionExpression { comments: CommentGroup { comments: [], }, attributes: [], static: None, fn: Keyword { value: "fn", position: 1051, }, parameters: FunctionLikeParameterListDefinition { comments: CommentGroup { comments: [], }, left_parenthesis: 1053, parameters: CommaSeparated { inner: [ FunctionLikeParameterDefinition { comments: CommentGroup { comments: [], }, attributes: [], type_definition: Identifier( TemplatedIdentifier { name: Identifier { position: 1054, value: "num", }, templates: None, }, ), ellipsis: None, variable: Variable { position: 1058, name: "$n", }, default: None, }, ], commas: [], }, right_parenthesis: 1060, }, return_type: FunctionLikeReturnTypeDefinition { colon: 1061, type_definition: FloatingPoint( Default( Keyword { value: "float", position: 1063, }, ), ), }, double_arrow: 1069, body: TernaryOperation( Ternary { comments: CommentGroup { comments: [], }, condition: TypeOperation( Is { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 1072, name: "$n", }, ), is: Keyword { value: "is", position: 1075, }, right: FloatingPoint( Default( Keyword { value: "float", position: 1078, }, ), ), }, ), question: 1084, if_true: Variable( Variable { position: 1086, name: "$n", }, ), colon: 1089, if_false: ArithmeticOperation( Addition { comments: CommentGroup { comments: [], }, left: Variable( Variable { position: 1091, name: "$n", }, ), plus: 1094, right: Literal( Float( LiteralFloat { comments: CommentGroup { comments: [], }, value: "0.0", position: 1096, }, ), ), }, ), }, ), }, ), }, ], commas: [], }, right_parenthesis: 1106, }, }, ), arrow: 1114, method: Identifier { position: 1116, value: "sum", }, generics: None, arguments: ArgumentListExpression { comments: CommentGroup { comments: [], }, left_parenthesis: 1119, arguments: CommaSeparated { inner: [], commas: [], }, right_parenthesis: 1120, }, }, ), }, ), ], right_brace: 1122, }, }, ), ], eof: 1123, }