From c0e465361b3fffff05bbf3252ec7cefa38499dcc Mon Sep 17 00:00:00 2001 From: Kennedy Tedesco Date: Thu, 28 Sep 2023 16:17:50 -0300 Subject: [PATCH] new: allow `async` as a modifier (#44) --- src/parser/internal/definition/function.rs | 9 +- src/parser/internal/definition/mod.rs | 2 +- src/parser/internal/definition/modifier.rs | 4 + src/parser/internal/expression/function.rs | 21 +- src/tree/definition/function.rs | 4 +- src/tree/definition/modifier.rs | 6 + src/tree/expression/function.rs | 24 +- tests/samples/0001/tree.txt | 6 +- tests/samples/0002/tree.txt | 6 +- tests/samples/0004/tree.txt | 6 +- tests/samples/0005/tree.txt | 6 +- tests/samples/0006/tree.txt | 6 +- tests/samples/0007/tree.txt | 6 +- tests/samples/0008/tree.txt | 6 +- tests/samples/0009/tree.txt | 6 +- tests/samples/0010/tree.txt | 6 +- tests/samples/0011/tree.txt | 6 +- tests/samples/0012/tree.txt | 6 +- tests/samples/0013/tree.txt | 6 +- tests/samples/0014/tree.txt | 6 +- tests/samples/0015/tree.txt | 6 +- tests/samples/0016/tree.txt | 6 +- tests/samples/0017/tree.txt | 6 +- tests/samples/0021/tree.txt | 6 +- tests/samples/0022/tree.txt | 6 +- tests/samples/0024/tree.txt | 6 +- tests/samples/0026/tree.txt | 6 +- tests/samples/0027/tree.txt | 6 +- tests/samples/0031/tree.txt | 6 +- tests/samples/0032/tree.txt | 6 +- tests/samples/0037/tree.txt | 6 +- tests/samples/0038/tree.txt | 6 +- tests/samples/0039/tree.txt | 6 +- tests/samples/0042/tree.txt | 6 +- tests/samples/0051/tree.txt | 6 +- tests/samples/0052/tree.txt | 6 +- tests/samples/0053/tree.txt | 6 +- tests/samples/0054/tree.txt | 6 +- tests/samples/0056/tree.txt | 54 +++- tests/samples/0061/tree.txt | 11 +- tests/samples/0063/tree.txt | 6 +- tests/samples/0066/tree.txt | 6 +- tests/samples/0069/tree.txt | 22 +- tests/samples/0070/tree.txt | 6 +- tests/samples/0071/tree.txt | 54 +++- tests/samples/0072/tree.txt | 6 +- tests/samples/0073/tree.txt | 12 +- tests/samples/0074/tree.txt | 18 +- tests/samples/0075/tree.txt | 16 +- tests/samples/0076/tree.txt | 24 +- tests/samples/0078/tree.txt | 36 ++- tests/samples/0079/tree.txt | 6 +- tests/samples/0081/tree.txt | 6 +- tests/samples/0082/code.ara | 2 +- tests/samples/0082/tree.txt | 71 ++-- tests/samples/0084/tree.txt | 30 +- tests/samples/0085/tree.txt | 10 +- tests/samples/0087/tree.txt | 12 +- tests/samples/0088/tree.txt | 6 +- tests/samples/0089/tree.txt | 12 +- tests/samples/0090/tree.txt | 6 +- tests/samples/0091/tree.txt | 6 +- tests/samples/0093/tree.txt | 12 +- tests/samples/0094/tree.txt | 6 +- tests/samples/0095/tree.txt | 6 +- tests/samples/0096/tree.txt | 6 +- tests/samples/0097/tree.txt | 6 +- tests/samples/0098/tree.txt | 6 +- tests/samples/0099/tree.txt | 6 +- tests/samples/0100/tree.txt | 6 +- tests/samples/0101/tree.txt | 6 +- tests/samples/0102/tree.txt | 6 +- tests/samples/0103/tree.txt | 6 +- tests/samples/0104/tree.txt | 20 +- tests/samples/0105/tree.txt | 6 +- tests/samples/0106/tree.txt | 6 +- tests/samples/0107/code.ara | 2 +- tests/samples/0107/tree.txt | 115 ++++--- tests/samples/0108/tree.txt | 78 ++++- tests/samples/0109/tree.txt | 6 +- tests/samples/0110/code.ara | 13 + tests/samples/0110/tree.txt | 357 +++++++++++++++++++++ 82 files changed, 1124 insertions(+), 245 deletions(-) create mode 100644 tests/samples/0110/code.ara create mode 100644 tests/samples/0110/tree.txt diff --git a/src/parser/internal/definition/function.rs b/src/parser/internal/definition/function.rs index c98f5b8..106fbb9 100644 --- a/src/parser/internal/definition/function.rs +++ b/src/parser/internal/definition/function.rs @@ -1,4 +1,5 @@ use crate::lexer::token::TokenKind; +use crate::parser::internal::definition::modifier; use crate::parser::internal::definition::parameter; use crate::parser::internal::definition::r#type; use crate::parser::internal::definition::template; @@ -16,12 +17,10 @@ use crate::tree::definition::function::MethodTypeConstraintGroupDefinition; use crate::tree::definition::modifier::ModifierGroupDefinition; pub fn function_definition(state: &mut State) -> ParseResult { - let comments = state.iterator.comments(); - let attributes = state.get_attributes(); - Ok(FunctionDefinition { - comments, - attributes, + comments: state.iterator.comments(), + attributes: state.get_attributes(), + modifiers: modifier::collect(state)?, function: utils::skip_keyword(state, TokenKind::Function)?, name: identifier::identifier_maybe_soft_reserved(state)?, templates: if state.iterator.current().kind == TokenKind::LessThan { diff --git a/src/parser/internal/definition/mod.rs b/src/parser/internal/definition/mod.rs index 5113a19..a781e37 100644 --- a/src/parser/internal/definition/mod.rs +++ b/src/parser/internal/definition/mod.rs @@ -76,7 +76,7 @@ pub fn definition(state: &mut State) -> ParseResult { ))); } - if current.kind == TokenKind::Function { + if matches!(current.kind, TokenKind::Async | TokenKind::Function) { return Ok(Definition::Function(Box::new( function::function_definition(state)?, ))); diff --git a/src/parser/internal/definition/modifier.rs b/src/parser/internal/definition/modifier.rs index e44c9a4..c5b9948 100644 --- a/src/parser/internal/definition/modifier.rs +++ b/src/parser/internal/definition/modifier.rs @@ -15,6 +15,7 @@ pub fn collect(state: &mut State) -> ParseResult { TokenKind::Abstract, TokenKind::Static, TokenKind::Readonly, + TokenKind::Async, ]; let mut current = state.iterator.current().clone(); @@ -44,6 +45,9 @@ pub fn collect(state: &mut State) -> ParseResult { TokenKind::Readonly => { ModifierDefinition::Readonly(utils::skip_keyword(state, TokenKind::Readonly)?) } + TokenKind::Async => { + ModifierDefinition::Async(utils::skip_keyword(state, TokenKind::Async)?) + } _ => unreachable!(), }); diff --git a/src/parser/internal/expression/function.rs b/src/parser/internal/expression/function.rs index 3cc3b79..8088ff9 100644 --- a/src/parser/internal/expression/function.rs +++ b/src/parser/internal/expression/function.rs @@ -1,4 +1,5 @@ use crate::lexer::token::TokenKind; +use crate::parser::internal::definition::modifier; use crate::parser::internal::definition::parameter; use crate::parser::internal::definition::r#type; use crate::parser::internal::expression; @@ -18,12 +19,7 @@ pub fn anonymous_function_expression( ) -> ParseResult { let comments = state.iterator.comments(); let attributes = state.get_attributes(); - let current = state.iterator.current(); - let r#static = if current.kind == TokenKind::Static { - Some(utils::skip_keyword(state, TokenKind::Static)?) - } else { - None - }; + let modifiers = modifier::collect(state)?; let function = utils::skip_keyword(state, TokenKind::Function)?; let parameters = parameter::function_like_parameter_list_definition(state)?; @@ -55,9 +51,9 @@ pub fn anonymous_function_expression( Ok(AnonymousFunctionExpression { comments, - r#static, - function, attributes, + modifiers, + function, parameters, use_clause: uses, return_type: FunctionLikeReturnTypeDefinition { @@ -69,19 +65,14 @@ pub fn anonymous_function_expression( } pub fn arrow_function_expression(state: &mut State) -> ParseResult { - let current = state.iterator.current(); - let comments = state.iterator.comments(); let attributes = state.get_attributes(); + let modifiers = modifier::collect(state)?; Ok(ArrowFunctionExpression { comments, attributes, - r#static: if current.kind == TokenKind::Static { - Some(utils::skip_keyword(state, TokenKind::Static)?) - } else { - None - }, + modifiers, r#fn: utils::skip_keyword(state, TokenKind::Fn)?, parameters: parameter::function_like_parameter_list_definition(state)?, return_type: FunctionLikeReturnTypeDefinition { diff --git a/src/tree/definition/function.rs b/src/tree/definition/function.rs index d1b8334..d371aaf 100644 --- a/src/tree/definition/function.rs +++ b/src/tree/definition/function.rs @@ -54,8 +54,9 @@ pub struct FunctionLikeParameterListDefinition { #[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, Serialize, Encode, Decode, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct FunctionDefinition { - pub comments: CommentGroup, pub attributes: Vec, + pub comments: CommentGroup, + pub modifiers: ModifierGroupDefinition, pub function: Keyword, pub name: Identifier, pub templates: Option, @@ -255,6 +256,7 @@ impl Node for FunctionDefinition { children.push(templates); } + children.push(&self.modifiers); children.push(&self.parameters); children.push(&self.return_type); children.push(&self.body); diff --git a/src/tree/definition/modifier.rs b/src/tree/definition/modifier.rs index 1437b7a..fa84638 100644 --- a/src/tree/definition/modifier.rs +++ b/src/tree/definition/modifier.rs @@ -17,6 +17,7 @@ pub enum ModifierDefinition { Readonly(Keyword), Final(Keyword), Abstract(Keyword), + Async(Keyword), } #[derive(Debug, Clone, Hash, Eq, PartialEq, Deserialize, Serialize, Encode, Decode, JsonSchema)] @@ -62,6 +63,7 @@ impl Node for ModifierDefinition { | Self::Readonly(keyword) | Self::Static(keyword) | Self::Abstract(keyword) + | Self::Async(keyword) | Self::Final(keyword) => keyword.initial_position(), } } @@ -74,6 +76,7 @@ impl Node for ModifierDefinition { | Self::Readonly(keyword) | Self::Static(keyword) | Self::Abstract(keyword) + | Self::Async(keyword) | Self::Final(keyword) => keyword.final_position(), } } @@ -86,6 +89,7 @@ impl Node for ModifierDefinition { | Self::Readonly(keyword) | Self::Static(keyword) | Self::Abstract(keyword) + | Self::Async(keyword) | Self::Final(keyword) => vec![keyword as &dyn Node], } } @@ -98,6 +102,7 @@ impl Node for ModifierDefinition { Self::Readonly(_keyword) => "readonly modifier definition".to_string(), Self::Static(_keyword) => "static modifier definition".to_string(), Self::Abstract(_keyword) => "abstract modifier definition".to_string(), + Self::Async(_keyword) => "async modifier definition".to_string(), Self::Final(_keyword) => "final modifier definition".to_string(), } } @@ -112,6 +117,7 @@ impl std::fmt::Display for ModifierDefinition { | Self::Readonly(keyword) | Self::Static(keyword) | Self::Abstract(keyword) + | Self::Async(keyword) | Self::Final(keyword) => write!(f, "{}", keyword.value), } } diff --git a/src/tree/expression/function.rs b/src/tree/expression/function.rs index ca91a41..b07d5af 100644 --- a/src/tree/expression/function.rs +++ b/src/tree/expression/function.rs @@ -8,6 +8,7 @@ use crate::tree::comment::CommentGroup; use crate::tree::definition::attribute::AttributeGroupDefinition; use crate::tree::definition::function::FunctionLikeParameterListDefinition; use crate::tree::definition::function::FunctionLikeReturnTypeDefinition; +use crate::tree::definition::modifier::ModifierGroupDefinition; use crate::tree::expression::Expression; use crate::tree::statement::block::BlockStatement; use crate::tree::token::Keyword; @@ -20,7 +21,7 @@ use crate::tree::Node; pub struct ArrowFunctionExpression { pub comments: CommentGroup, pub attributes: Vec, - pub r#static: Option, + pub modifiers: ModifierGroupDefinition, pub r#fn: Keyword, pub parameters: FunctionLikeParameterListDefinition, pub return_type: FunctionLikeReturnTypeDefinition, @@ -33,7 +34,7 @@ pub struct ArrowFunctionExpression { pub struct AnonymousFunctionExpression { pub comments: CommentGroup, pub attributes: Vec, - pub r#static: Option, + pub modifiers: ModifierGroupDefinition, pub function: Keyword, pub parameters: FunctionLikeParameterListDefinition, pub use_clause: Option, @@ -68,8 +69,8 @@ impl Node for ArrowFunctionExpression { return attribute.initial_position(); } - if let Some(r#static) = &self.r#static { - return r#static.initial_position(); + if !&self.modifiers.modifiers.is_empty() { + return self.modifiers.initial_position(); } self.r#fn.initial_position() @@ -86,12 +87,8 @@ impl Node for ArrowFunctionExpression { children.push(attribute); } - if let Some(r#static) = &self.r#static { - children.push(r#static); - } - children.push(&self.r#fn); - + children.push(&self.modifiers); children.push(&self.parameters); children.push(&self.return_type); children.push(self.body.as_ref()); @@ -114,8 +111,8 @@ impl Node for AnonymousFunctionExpression { return attribute.initial_position(); } - if let Some(r#static) = &self.r#static { - return r#static.initial_position(); + if !&self.modifiers.modifiers.is_empty() { + return self.modifiers.initial_position(); } self.function.initial_position() @@ -132,11 +129,8 @@ impl Node for AnonymousFunctionExpression { children.push(attribute); } - if let Some(r#static) = &self.r#static { - children.push(r#static); - } - children.push(&self.function); + children.push(&self.modifiers); children.push(&self.parameters); children.push(&self.return_type); children.push(&self.body); diff --git a/tests/samples/0001/tree.txt b/tests/samples/0001/tree.txt index f4a6754..151bd9c 100644 --- a/tests/samples/0001/tree.txt +++ b/tests/samples/0001/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0002/tree.txt b/tests/samples/0002/tree.txt index 20040ea..0783d43 100644 --- a/tests/samples/0002/tree.txt +++ b/tests/samples/0002/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1, + modifiers: [], + }, function: Keyword { value: "function", position: 1, diff --git a/tests/samples/0004/tree.txt b/tests/samples/0004/tree.txt index e3bba8f..04259d9 100644 --- a/tests/samples/0004/tree.txt +++ b/tests/samples/0004/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0005/tree.txt b/tests/samples/0005/tree.txt index 7ef159b..a7cfd4a 100644 --- a/tests/samples/0005/tree.txt +++ b/tests/samples/0005/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0006/tree.txt b/tests/samples/0006/tree.txt index 517d87a..ed2bf65 100644 --- a/tests/samples/0006/tree.txt +++ b/tests/samples/0006/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0007/tree.txt b/tests/samples/0007/tree.txt index b2e4fad..c60d1ca 100644 --- a/tests/samples/0007/tree.txt +++ b/tests/samples/0007/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0008/tree.txt b/tests/samples/0008/tree.txt index d08718b..e083899 100644 --- a/tests/samples/0008/tree.txt +++ b/tests/samples/0008/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0009/tree.txt b/tests/samples/0009/tree.txt index 19c1a11..cc379ae 100644 --- a/tests/samples/0009/tree.txt +++ b/tests/samples/0009/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0010/tree.txt b/tests/samples/0010/tree.txt index 57c47d1..2a973a4 100644 --- a/tests/samples/0010/tree.txt +++ b/tests/samples/0010/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0011/tree.txt b/tests/samples/0011/tree.txt index c73ffca..c228c6c 100644 --- a/tests/samples/0011/tree.txt +++ b/tests/samples/0011/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0012/tree.txt b/tests/samples/0012/tree.txt index 5895145..7c83d75 100644 --- a/tests/samples/0012/tree.txt +++ b/tests/samples/0012/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0013/tree.txt b/tests/samples/0013/tree.txt index a8b0134..df4c89d 100644 --- a/tests/samples/0013/tree.txt +++ b/tests/samples/0013/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0014/tree.txt b/tests/samples/0014/tree.txt index 22c066b..bddd0e4 100644 --- a/tests/samples/0014/tree.txt +++ b/tests/samples/0014/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0015/tree.txt b/tests/samples/0015/tree.txt index 68dde8b..3d007a0 100644 --- a/tests/samples/0015/tree.txt +++ b/tests/samples/0015/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0016/tree.txt b/tests/samples/0016/tree.txt index a3f0a6e..77d85b3 100644 --- a/tests/samples/0016/tree.txt +++ b/tests/samples/0016/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0017/tree.txt b/tests/samples/0017/tree.txt index 6d4b35a..4373fe8 100644 --- a/tests/samples/0017/tree.txt +++ b/tests/samples/0017/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0021/tree.txt b/tests/samples/0021/tree.txt index 535a703..3ead562 100644 --- a/tests/samples/0021/tree.txt +++ b/tests/samples/0021/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0022/tree.txt b/tests/samples/0022/tree.txt index 3726847..722e192 100644 --- a/tests/samples/0022/tree.txt +++ b/tests/samples/0022/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0024/tree.txt b/tests/samples/0024/tree.txt index 217179c..abc1020 100644 --- a/tests/samples/0024/tree.txt +++ b/tests/samples/0024/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1, + modifiers: [], + }, function: Keyword { value: "function", position: 1, diff --git a/tests/samples/0026/tree.txt b/tests/samples/0026/tree.txt index 0d5f67b..6f7d841 100644 --- a/tests/samples/0026/tree.txt +++ b/tests/samples/0026/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 2, + modifiers: [], + }, function: Keyword { value: "function", position: 2, diff --git a/tests/samples/0027/tree.txt b/tests/samples/0027/tree.txt index af841ff..b641808 100644 --- a/tests/samples/0027/tree.txt +++ b/tests/samples/0027/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0031/tree.txt b/tests/samples/0031/tree.txt index c54c906..4b4451a 100644 --- a/tests/samples/0031/tree.txt +++ b/tests/samples/0031/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0032/tree.txt b/tests/samples/0032/tree.txt index 1b69c0d..718db57 100644 --- a/tests/samples/0032/tree.txt +++ b/tests/samples/0032/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0037/tree.txt b/tests/samples/0037/tree.txt index e964bad..9486939 100644 --- a/tests/samples/0037/tree.txt +++ b/tests/samples/0037/tree.txt @@ -14,10 +14,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 22, + modifiers: [], + }, function: Keyword { value: "function", position: 22, diff --git a/tests/samples/0038/tree.txt b/tests/samples/0038/tree.txt index 0e4f72a..ca419e9 100644 --- a/tests/samples/0038/tree.txt +++ b/tests/samples/0038/tree.txt @@ -14,10 +14,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 22, + modifiers: [], + }, function: Keyword { value: "function", position: 22, diff --git a/tests/samples/0039/tree.txt b/tests/samples/0039/tree.txt index 8b7d382..b525325 100644 --- a/tests/samples/0039/tree.txt +++ b/tests/samples/0039/tree.txt @@ -14,10 +14,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 22, + modifiers: [], + }, function: Keyword { value: "function", position: 22, diff --git a/tests/samples/0042/tree.txt b/tests/samples/0042/tree.txt index 72778d6..e600247 100644 --- a/tests/samples/0042/tree.txt +++ b/tests/samples/0042/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0051/tree.txt b/tests/samples/0051/tree.txt index 11374c3..0b68a88 100644 --- a/tests/samples/0051/tree.txt +++ b/tests/samples/0051/tree.txt @@ -94,10 +94,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 61, + modifiers: [], + }, function: Keyword { value: "function", position: 61, diff --git a/tests/samples/0052/tree.txt b/tests/samples/0052/tree.txt index 25ac1c5..58b7268 100644 --- a/tests/samples/0052/tree.txt +++ b/tests/samples/0052/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0053/tree.txt b/tests/samples/0053/tree.txt index 80b337a..1cfc0bb 100644 --- a/tests/samples/0053/tree.txt +++ b/tests/samples/0053/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0054/tree.txt b/tests/samples/0054/tree.txt index 79e798a..c12db70 100644 --- a/tests/samples/0054/tree.txt +++ b/tests/samples/0054/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1, + modifiers: [], + }, function: Keyword { value: "function", position: 1, diff --git a/tests/samples/0056/tree.txt b/tests/samples/0056/tree.txt index 8afcc33..0543578 100644 --- a/tests/samples/0056/tree.txt +++ b/tests/samples/0056/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, @@ -47,10 +51,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 25, + modifiers: [], + }, function: Keyword { value: "function", position: 25, @@ -92,10 +100,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 51, + modifiers: [], + }, function: Keyword { value: "function", position: 51, @@ -137,10 +149,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 76, + modifiers: [], + }, function: Keyword { value: "function", position: 76, @@ -182,10 +198,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 105, + modifiers: [], + }, function: Keyword { value: "function", position: 105, @@ -227,10 +247,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 130, + modifiers: [], + }, function: Keyword { value: "function", position: 130, @@ -272,10 +296,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 157, + modifiers: [], + }, function: Keyword { value: "function", position: 157, @@ -317,10 +345,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 182, + modifiers: [], + }, function: Keyword { value: "function", position: 182, @@ -362,10 +394,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 208, + modifiers: [], + }, function: Keyword { value: "function", position: 208, diff --git a/tests/samples/0061/tree.txt b/tests/samples/0061/tree.txt index 748dabf..d620652 100644 --- a/tests/samples/0061/tree.txt +++ b/tests/samples/0061/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, @@ -75,7 +79,10 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 31, + modifiers: [], + }, fn: Keyword { value: "fn", position: 31, diff --git a/tests/samples/0063/tree.txt b/tests/samples/0063/tree.txt index 2e3b1a0..13e381f 100644 --- a/tests/samples/0063/tree.txt +++ b/tests/samples/0063/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0066/tree.txt b/tests/samples/0066/tree.txt index 30e9f7c..2d1483e 100644 --- a/tests/samples/0066/tree.txt +++ b/tests/samples/0066/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0069/tree.txt b/tests/samples/0069/tree.txt index d27f10d..ae8ca10 100644 --- a/tests/samples/0069/tree.txt +++ b/tests/samples/0069/tree.txt @@ -39,10 +39,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 40, + modifiers: [], + }, function: Keyword { value: "function", position: 40, @@ -241,7 +245,10 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 120, + modifiers: [], + }, fn: Keyword { value: "fn", position: 120, @@ -377,10 +384,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 188, + modifiers: [], + }, function: Keyword { value: "function", position: 188, @@ -543,7 +554,10 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 251, + modifiers: [], + }, fn: Keyword { value: "fn", position: 251, diff --git a/tests/samples/0070/tree.txt b/tests/samples/0070/tree.txt index 4053d63..52e22f9 100644 --- a/tests/samples/0070/tree.txt +++ b/tests/samples/0070/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0071/tree.txt b/tests/samples/0071/tree.txt index 0b50090..155b1f7 100644 --- a/tests/samples/0071/tree.txt +++ b/tests/samples/0071/tree.txt @@ -110,10 +110,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 79, + modifiers: [], + }, function: Keyword { value: "function", position: 79, @@ -250,10 +254,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 134, + modifiers: [], + }, function: Keyword { value: "function", position: 134, @@ -434,10 +442,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 220, + modifiers: [], + }, function: Keyword { value: "function", position: 220, @@ -908,10 +920,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 448, + modifiers: [], + }, function: Keyword { value: "function", position: 448, @@ -1105,10 +1121,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 517, + modifiers: [], + }, function: Keyword { value: "function", position: 517, @@ -1264,10 +1284,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 591, + modifiers: [], + }, function: Keyword { value: "function", position: 591, @@ -1845,10 +1869,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 837, + modifiers: [], + }, function: Keyword { value: "function", position: 837, @@ -2118,10 +2146,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 999, + modifiers: [], + }, function: Keyword { value: "function", position: 999, @@ -2423,10 +2455,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1190, + modifiers: [], + }, function: Keyword { value: "function", position: 1190, diff --git a/tests/samples/0072/tree.txt b/tests/samples/0072/tree.txt index bda5912..52909e3 100644 --- a/tests/samples/0072/tree.txt +++ b/tests/samples/0072/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0073/tree.txt b/tests/samples/0073/tree.txt index b83eb16..fa674da 100644 --- a/tests/samples/0073/tree.txt +++ b/tests/samples/0073/tree.txt @@ -89,10 +89,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 41, + modifiers: [], + }, function: Keyword { value: "function", position: 41, @@ -638,10 +642,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 326, + modifiers: [], + }, function: Keyword { value: "function", position: 326, diff --git a/tests/samples/0074/tree.txt b/tests/samples/0074/tree.txt index 4f34b1c..599186a 100644 --- a/tests/samples/0074/tree.txt +++ b/tests/samples/0074/tree.txt @@ -51,10 +51,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 45, + modifiers: [], + }, function: Keyword { value: "function", position: 45, @@ -518,10 +522,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 356, + modifiers: [], + }, function: Keyword { value: "function", position: 356, @@ -616,10 +624,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 421, + modifiers: [], + }, function: Keyword { value: "function", position: 421, diff --git a/tests/samples/0075/tree.txt b/tests/samples/0075/tree.txt index c35c57d..f66668b 100644 --- a/tests/samples/0075/tree.txt +++ b/tests/samples/0075/tree.txt @@ -1275,10 +1275,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 839, + modifiers: [], + }, function: Keyword { value: "function", position: 839, @@ -1585,7 +1589,10 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 993, + modifiers: [], + }, fn: Keyword { value: "fn", position: 993, @@ -1709,7 +1716,10 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 1051, + modifiers: [], + }, fn: Keyword { value: "fn", position: 1051, diff --git a/tests/samples/0076/tree.txt b/tests/samples/0076/tree.txt index 738cf2a..358787b 100644 --- a/tests/samples/0076/tree.txt +++ b/tests/samples/0076/tree.txt @@ -211,10 +211,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 143, + modifiers: [], + }, function: Keyword { value: "function", position: 143, @@ -612,10 +616,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 386, + modifiers: [], + }, function: Keyword { value: "function", position: 386, @@ -885,10 +893,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 560, + modifiers: [], + }, function: Keyword { value: "function", position: 560, @@ -1286,10 +1298,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 779, + modifiers: [], + }, function: Keyword { value: "function", position: 779, diff --git a/tests/samples/0078/tree.txt b/tests/samples/0078/tree.txt index 7d11bf2..24ca78a 100644 --- a/tests/samples/0078/tree.txt +++ b/tests/samples/0078/tree.txt @@ -344,10 +344,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 149, + modifiers: [], + }, function: Keyword { value: "function", position: 149, @@ -715,10 +719,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 372, + modifiers: [], + }, function: Keyword { value: "function", position: 372, @@ -1127,10 +1135,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 575, + modifiers: [], + }, function: Keyword { value: "function", position: 575, @@ -1541,10 +1553,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 825, + modifiers: [], + }, function: Keyword { value: "function", position: 825, @@ -2006,10 +2022,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1060, + modifiers: [], + }, function: Keyword { value: "function", position: 1060, @@ -2472,10 +2492,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1328, + modifiers: [], + }, function: Keyword { value: "function", position: 1328, diff --git a/tests/samples/0079/tree.txt b/tests/samples/0079/tree.txt index f2848c4..fa9fdab 100644 --- a/tests/samples/0079/tree.txt +++ b/tests/samples/0079/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1, + modifiers: [], + }, function: Keyword { value: "function", position: 1, diff --git a/tests/samples/0081/tree.txt b/tests/samples/0081/tree.txt index 0c01bca..485456a 100644 --- a/tests/samples/0081/tree.txt +++ b/tests/samples/0081/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0082/code.ara b/tests/samples/0082/code.ara index f562d56..148c058 100644 --- a/tests/samples/0082/code.ara +++ b/tests/samples/0082/code.ara @@ -43,7 +43,7 @@ function example(): int { $collection ->filter(fn(num $n): bool => $n < 8) ->map::( - fn(num $n): float => $n is float ? $n : $n + 0.0 + static fn(num $n): float => $n is float ? $n : $n + 0.0 ) ->sum() } \ No newline at end of file diff --git a/tests/samples/0082/tree.txt b/tests/samples/0082/tree.txt index 255f1fc..6d05458 100644 --- a/tests/samples/0082/tree.txt +++ b/tests/samples/0082/tree.txt @@ -1275,10 +1275,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 839, + modifiers: [], + }, function: Keyword { value: "function", position: 839, @@ -1585,7 +1589,10 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 993, + modifiers: [], + }, fn: Keyword { value: "fn", position: 993, @@ -1709,16 +1716,26 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 1058, + modifiers: [ + Static( + Keyword { + value: "static", + position: 1051, + }, + ), + ], + }, fn: Keyword { value: "fn", - position: 1051, + position: 1058, }, parameters: FunctionLikeParameterListDefinition { comments: CommentGroup { comments: [], }, - left_parenthesis: 1053, + left_parenthesis: 1060, parameters: CommaSeparated { inner: [ FunctionLikeParameterDefinition { @@ -1729,7 +1746,7 @@ DefinitionTree { type_definition: Identifier( TemplatedIdentifier { name: Identifier { - position: 1054, + position: 1061, value: "num", }, templates: None, @@ -1737,7 +1754,7 @@ DefinitionTree { ), ellipsis: None, variable: Variable { - position: 1058, + position: 1065, name: "$n", }, default: None, @@ -1745,20 +1762,20 @@ DefinitionTree { ], commas: [], }, - right_parenthesis: 1060, + right_parenthesis: 1067, }, return_type: FunctionLikeReturnTypeDefinition { - colon: 1061, + colon: 1068, type_definition: FloatingPoint( Default( Keyword { value: "float", - position: 1063, + position: 1070, }, ), ), }, - double_arrow: 1069, + double_arrow: 1076, body: TernaryOperation( Ternary { comments: CommentGroup { @@ -1771,32 +1788,32 @@ DefinitionTree { }, left: Variable( Variable { - position: 1072, + position: 1079, name: "$n", }, ), is: Keyword { value: "is", - position: 1075, + position: 1082, }, right: FloatingPoint( Default( Keyword { value: "float", - position: 1078, + position: 1085, }, ), ), }, ), - question: 1084, + question: 1091, if_true: Variable( Variable { - position: 1086, + position: 1093, name: "$n", }, ), - colon: 1089, + colon: 1096, if_false: ArithmeticOperation( Addition { comments: CommentGroup { @@ -1804,11 +1821,11 @@ DefinitionTree { }, left: Variable( Variable { - position: 1091, + position: 1098, name: "$n", }, ), - plus: 1094, + plus: 1101, right: Literal( Float( LiteralFloat { @@ -1816,7 +1833,7 @@ DefinitionTree { comments: [], }, value: "0.0", - position: 1096, + position: 1103, }, ), ), @@ -1830,13 +1847,13 @@ DefinitionTree { ], commas: [], }, - right_parenthesis: 1106, + right_parenthesis: 1113, }, }, ), - arrow: 1114, + arrow: 1121, method: Identifier { - position: 1116, + position: 1123, value: "sum", }, generics: None, @@ -1844,22 +1861,22 @@ DefinitionTree { comments: CommentGroup { comments: [], }, - left_parenthesis: 1119, + left_parenthesis: 1126, arguments: CommaSeparated { inner: [], commas: [], }, - right_parenthesis: 1120, + right_parenthesis: 1127, }, }, ), }, ), ], - right_brace: 1122, + right_brace: 1129, }, }, ), ], - eof: 1123, + eof: 1130, } \ No newline at end of file diff --git a/tests/samples/0084/tree.txt b/tests/samples/0084/tree.txt index 8dcd69a..06780b4 100644 --- a/tests/samples/0084/tree.txt +++ b/tests/samples/0084/tree.txt @@ -182,6 +182,7 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [ Comment { @@ -191,7 +192,10 @@ DefinitionTree { }, ], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 208, + modifiers: [], + }, function: Keyword { value: "function", position: 208, @@ -468,6 +472,7 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [ Comment { @@ -477,7 +482,10 @@ DefinitionTree { }, ], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 406, + modifiers: [], + }, function: Keyword { value: "function", position: 406, @@ -852,6 +860,7 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [ Comment { @@ -861,7 +870,10 @@ DefinitionTree { }, ], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 636, + modifiers: [], + }, function: Keyword { value: "function", position: 636, @@ -1326,6 +1338,7 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [ Comment { @@ -1335,7 +1348,10 @@ DefinitionTree { }, ], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 884, + modifiers: [], + }, function: Keyword { value: "function", position: 884, @@ -1602,6 +1618,7 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [ Comment { @@ -1611,7 +1628,10 @@ DefinitionTree { }, ], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 1097, + modifiers: [], + }, function: Keyword { value: "function", position: 1097, diff --git a/tests/samples/0085/tree.txt b/tests/samples/0085/tree.txt index 403a85b..b17ff34 100644 --- a/tests/samples/0085/tree.txt +++ b/tests/samples/0085/tree.txt @@ -1105,9 +1105,6 @@ DefinitionTree { ), Function( FunctionDefinition { - comments: CommentGroup { - comments: [], - }, attributes: [ AttributeGroupDefinition { hash_left_bracket: 502, @@ -2120,6 +2117,13 @@ DefinitionTree { right_bracket: 923, }, ], + comments: CommentGroup { + comments: [], + }, + modifiers: ModifierGroupDefinition { + position: 925, + modifiers: [], + }, function: Keyword { value: "function", position: 925, diff --git a/tests/samples/0087/tree.txt b/tests/samples/0087/tree.txt index 984f5de..34a2379 100644 --- a/tests/samples/0087/tree.txt +++ b/tests/samples/0087/tree.txt @@ -343,6 +343,7 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [ Comment { @@ -352,7 +353,10 @@ DefinitionTree { }, ], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 281, + modifiers: [], + }, function: Keyword { value: "function", position: 281, @@ -548,10 +552,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 380, + modifiers: [], + }, function: Keyword { value: "function", position: 380, diff --git a/tests/samples/0088/tree.txt b/tests/samples/0088/tree.txt index 32bcc60..e55b729 100644 --- a/tests/samples/0088/tree.txt +++ b/tests/samples/0088/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0089/tree.txt b/tests/samples/0089/tree.txt index e150d1e..08b64d8 100644 --- a/tests/samples/0089/tree.txt +++ b/tests/samples/0089/tree.txt @@ -211,10 +211,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 125, + modifiers: [], + }, function: Keyword { value: "function", position: 125, @@ -612,10 +616,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 296, + modifiers: [], + }, function: Keyword { value: "function", position: 296, diff --git a/tests/samples/0090/tree.txt b/tests/samples/0090/tree.txt index cbe2e36..e2491d5 100644 --- a/tests/samples/0090/tree.txt +++ b/tests/samples/0090/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0091/tree.txt b/tests/samples/0091/tree.txt index 1dc5033..d8429f8 100644 --- a/tests/samples/0091/tree.txt +++ b/tests/samples/0091/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0093/tree.txt b/tests/samples/0093/tree.txt index d9588f0..1415729 100644 --- a/tests/samples/0093/tree.txt +++ b/tests/samples/0093/tree.txt @@ -211,10 +211,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 143, + modifiers: [], + }, function: Keyword { value: "function", position: 143, @@ -612,10 +616,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 386, + modifiers: [], + }, function: Keyword { value: "function", position: 386, diff --git a/tests/samples/0094/tree.txt b/tests/samples/0094/tree.txt index ce1a48e..e45cc5d 100644 --- a/tests/samples/0094/tree.txt +++ b/tests/samples/0094/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0095/tree.txt b/tests/samples/0095/tree.txt index da6334b..bb7a0e7 100644 --- a/tests/samples/0095/tree.txt +++ b/tests/samples/0095/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0096/tree.txt b/tests/samples/0096/tree.txt index 7ac7bd1..9595e65 100644 --- a/tests/samples/0096/tree.txt +++ b/tests/samples/0096/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0097/tree.txt b/tests/samples/0097/tree.txt index e76210e..3cb1bec 100644 --- a/tests/samples/0097/tree.txt +++ b/tests/samples/0097/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0098/tree.txt b/tests/samples/0098/tree.txt index 010cc4d..0c188bd 100644 --- a/tests/samples/0098/tree.txt +++ b/tests/samples/0098/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0099/tree.txt b/tests/samples/0099/tree.txt index db38b76..5e5b973 100644 --- a/tests/samples/0099/tree.txt +++ b/tests/samples/0099/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0100/tree.txt b/tests/samples/0100/tree.txt index 90a40a0..631b97a 100644 --- a/tests/samples/0100/tree.txt +++ b/tests/samples/0100/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0101/tree.txt b/tests/samples/0101/tree.txt index 7fb1d45..ab75f23 100644 --- a/tests/samples/0101/tree.txt +++ b/tests/samples/0101/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0102/tree.txt b/tests/samples/0102/tree.txt index 73fcff5..4827ab6 100644 --- a/tests/samples/0102/tree.txt +++ b/tests/samples/0102/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0103/tree.txt b/tests/samples/0103/tree.txt index 9f64a7b..91a77fc 100644 --- a/tests/samples/0103/tree.txt +++ b/tests/samples/0103/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0104/tree.txt b/tests/samples/0104/tree.txt index d2361f8..2b08251 100644 --- a/tests/samples/0104/tree.txt +++ b/tests/samples/0104/tree.txt @@ -2,9 +2,6 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { - comments: CommentGroup { - comments: [], - }, attributes: [ AttributeGroupDefinition { hash_left_bracket: 1, @@ -48,6 +45,13 @@ DefinitionTree { right_bracket: 14, }, ], + comments: CommentGroup { + comments: [], + }, + modifiers: ModifierGroupDefinition { + position: 16, + modifiers: [], + }, function: Keyword { value: "function", position: 16, @@ -159,9 +163,6 @@ DefinitionTree { ), Function( FunctionDefinition { - comments: CommentGroup { - comments: [], - }, attributes: [ AttributeGroupDefinition { hash_left_bracket: 74, @@ -205,6 +206,13 @@ DefinitionTree { right_bracket: 87, }, ], + comments: CommentGroup { + comments: [], + }, + modifiers: ModifierGroupDefinition { + position: 89, + modifiers: [], + }, function: Keyword { value: "function", position: 89, diff --git a/tests/samples/0105/tree.txt b/tests/samples/0105/tree.txt index 98d5f9b..b634775 100644 --- a/tests/samples/0105/tree.txt +++ b/tests/samples/0105/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0106/tree.txt b/tests/samples/0106/tree.txt index 4425efc..1cc1be3 100644 --- a/tests/samples/0106/tree.txt +++ b/tests/samples/0106/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0107/code.ara b/tests/samples/0107/code.ara index 0f0fde6..26792d5 100644 --- a/tests/samples/0107/code.ara +++ b/tests/samples/0107/code.ara @@ -1,7 +1,7 @@ const Foo ONE = new Foo(); class Foo { - const \Closure FOO = fn(): int => 1; + const \Closure FOO = static fn(): int => 1; public static abstract Abstract readonly private static protected string $baz = 'baz'; diff --git a/tests/samples/0107/tree.txt b/tests/samples/0107/tree.txt index 1397738..561b465 100644 --- a/tests/samples/0107/tree.txt +++ b/tests/samples/0107/tree.txt @@ -113,34 +113,44 @@ DefinitionTree { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 72, + modifiers: [ + Static( + Keyword { + value: "static", + position: 65, + }, + ), + ], + }, fn: Keyword { value: "fn", - position: 65, + position: 72, }, parameters: FunctionLikeParameterListDefinition { comments: CommentGroup { comments: [], }, - left_parenthesis: 67, + left_parenthesis: 74, parameters: CommaSeparated { inner: [], commas: [], }, - right_parenthesis: 68, + right_parenthesis: 75, }, return_type: FunctionLikeReturnTypeDefinition { - colon: 69, + colon: 76, type_definition: SignedInteger( Default( Keyword { value: "int", - position: 71, + position: 78, }, ), ), }, - double_arrow: 75, + double_arrow: 82, body: Literal( Integer( LiteralInteger { @@ -148,67 +158,67 @@ DefinitionTree { comments: [], }, value: "1", - position: 78, + position: 85, }, ), ), }, ), - semicolon: 79, + semicolon: 86, }, ), Property( PropertyDefinition { attributes: [], modifiers: ModifierGroupDefinition { - position: 152, + position: 159, modifiers: [ Public( Keyword { value: "public", - position: 86, + position: 93, }, ), Static( Keyword { value: "static", - position: 93, + position: 100, }, ), Abstract( Keyword { value: "abstract", - position: 100, + position: 107, }, ), Abstract( Keyword { value: "Abstract", - position: 109, + position: 116, }, ), Readonly( Keyword { value: "readonly", - position: 118, + position: 125, }, ), Private( Keyword { value: "private", - position: 127, + position: 134, }, ), Static( Keyword { value: "static", - position: 135, + position: 142, }, ), Protected( Keyword { value: "protected", - position: 142, + position: 149, }, ), ], @@ -216,15 +226,15 @@ DefinitionTree { type_definition: String( Keyword { value: "string", - position: 152, + position: 159, }, ), entry: Initialized { variable: Variable { - position: 159, + position: 166, name: "$baz", }, - equals: 164, + equals: 171, value: Literal( String( LiteralString { @@ -232,24 +242,24 @@ DefinitionTree { comments: [], }, value: "'baz'", - position: 166, + position: 173, }, ), ), }, - semicolon: 171, + semicolon: 178, }, ), Property( PropertyDefinition { attributes: [], modifiers: ModifierGroupDefinition { - position: 185, + position: 192, modifiers: [ Public( Keyword { value: "public", - position: 178, + position: 185, }, ), ], @@ -258,51 +268,54 @@ DefinitionTree { Default( Keyword { value: "int", - position: 185, + position: 192, }, ), ), entry: Initialized { variable: Variable { - position: 189, + position: 196, name: "$bar", }, - equals: 194, + equals: 201, value: ArrowFunction( ArrowFunctionExpression { comments: CommentGroup { comments: [], }, attributes: [], - static: None, + modifiers: ModifierGroupDefinition { + position: 203, + modifiers: [], + }, fn: Keyword { value: "fn", - position: 196, + position: 203, }, parameters: FunctionLikeParameterListDefinition { comments: CommentGroup { comments: [], }, - left_parenthesis: 198, + left_parenthesis: 205, parameters: CommaSeparated { inner: [], commas: [], }, - right_parenthesis: 199, + right_parenthesis: 206, }, return_type: FunctionLikeReturnTypeDefinition { - colon: 200, + colon: 207, type_definition: Identifier( TemplatedIdentifier { name: Identifier { - position: 202, + position: 209, value: "Foo", }, templates: None, }, ), }, - double_arrow: 206, + double_arrow: 213, body: ClassOperation( Initialization { comments: CommentGroup { @@ -310,11 +323,11 @@ DefinitionTree { }, new: Keyword { value: "new", - position: 209, + position: 216, }, class: Identifier( Identifier { - position: 213, + position: 220, value: "Foo", }, ), @@ -323,31 +336,31 @@ DefinitionTree { comments: CommentGroup { comments: [], }, - left_parenthesis: 216, + left_parenthesis: 223, arguments: CommaSeparated { inner: [], commas: [], }, - right_parenthesis: 217, + right_parenthesis: 224, }, }, ), }, ), }, - semicolon: 218, + semicolon: 225, }, ), Property( PropertyDefinition { attributes: [], modifiers: ModifierGroupDefinition { - position: 232, + position: 239, modifiers: [ Public( Keyword { value: "public", - position: 225, + position: 232, }, ), ], @@ -356,16 +369,16 @@ DefinitionTree { Default( Keyword { value: "int", - position: 232, + position: 239, }, ), ), entry: Initialized { variable: Variable { - position: 236, + position: 243, name: "$foo", }, - equals: 241, + equals: 248, value: ObjectOperation( PropertyFetch { comments: CommentGroup { @@ -373,26 +386,26 @@ DefinitionTree { }, object: Variable( Variable { - position: 243, + position: 250, name: "$this", }, ), - arrow: 248, + arrow: 255, property: Identifier { - position: 250, + position: 257, value: "bar", }, }, ), }, - semicolon: 253, + semicolon: 260, }, ), ], - right_brace: 255, + right_brace: 262, }, }, ), ], - eof: 257, + eof: 264, } \ No newline at end of file diff --git a/tests/samples/0108/tree.txt b/tests/samples/0108/tree.txt index 54bb817..51cd115 100644 --- a/tests/samples/0108/tree.txt +++ b/tests/samples/0108/tree.txt @@ -169,10 +169,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 135, + modifiers: [], + }, function: Keyword { value: "function", position: 135, @@ -242,10 +246,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 187, + modifiers: [], + }, function: Keyword { value: "function", position: 187, @@ -315,10 +323,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 260, + modifiers: [], + }, function: Keyword { value: "function", position: 260, @@ -388,10 +400,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 312, + modifiers: [], + }, function: Keyword { value: "function", position: 312, @@ -461,10 +477,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 355, + modifiers: [], + }, function: Keyword { value: "function", position: 355, @@ -534,10 +554,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 393, + modifiers: [], + }, function: Keyword { value: "function", position: 393, @@ -607,10 +631,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 429, + modifiers: [], + }, function: Keyword { value: "function", position: 429, @@ -680,10 +708,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 483, + modifiers: [], + }, function: Keyword { value: "function", position: 483, @@ -753,10 +785,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 526, + modifiers: [], + }, function: Keyword { value: "function", position: 526, @@ -826,10 +862,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 564, + modifiers: [], + }, function: Keyword { value: "function", position: 564, @@ -899,10 +939,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 600, + modifiers: [], + }, function: Keyword { value: "function", position: 600, @@ -972,10 +1016,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 648, + modifiers: [], + }, function: Keyword { value: "function", position: 648, @@ -1045,10 +1093,14 @@ DefinitionTree { ), Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 704, + modifiers: [], + }, function: Keyword { value: "function", position: 704, diff --git a/tests/samples/0109/tree.txt b/tests/samples/0109/tree.txt index 5a88341..1d4c0cb 100644 --- a/tests/samples/0109/tree.txt +++ b/tests/samples/0109/tree.txt @@ -2,10 +2,14 @@ DefinitionTree { definitions: [ Function( FunctionDefinition { + attributes: [], comments: CommentGroup { comments: [], }, - attributes: [], + modifiers: ModifierGroupDefinition { + position: 0, + modifiers: [], + }, function: Keyword { value: "function", position: 0, diff --git a/tests/samples/0110/code.ara b/tests/samples/0110/code.ara new file mode 100644 index 0000000..349f761 --- /dev/null +++ b/tests/samples/0110/code.ara @@ -0,0 +1,13 @@ +async function baz(): string { + return foo(); +} + +final class Foo { + async public function bar(): string { + return bar(); + } + + async public static function baz(): string { + return baz(); + } +} diff --git a/tests/samples/0110/tree.txt b/tests/samples/0110/tree.txt new file mode 100644 index 0000000..161308b --- /dev/null +++ b/tests/samples/0110/tree.txt @@ -0,0 +1,357 @@ +DefinitionTree { + definitions: [ + Function( + FunctionDefinition { + attributes: [], + comments: CommentGroup { + comments: [], + }, + modifiers: ModifierGroupDefinition { + position: 6, + modifiers: [ + Async( + Keyword { + value: "async", + position: 0, + }, + ), + ], + }, + function: Keyword { + value: "function", + position: 6, + }, + name: Identifier { + position: 15, + value: "baz", + }, + templates: None, + parameters: FunctionLikeParameterListDefinition { + comments: CommentGroup { + comments: [], + }, + left_parenthesis: 18, + parameters: CommaSeparated { + inner: [], + commas: [], + }, + right_parenthesis: 19, + }, + return_type: FunctionLikeReturnTypeDefinition { + colon: 20, + type_definition: String( + Keyword { + value: "string", + position: 22, + }, + ), + }, + body: BlockStatement { + comments: CommentGroup { + comments: [], + }, + left_brace: 29, + statements: [ + Return( + Explicit { + comments: CommentGroup { + comments: [], + }, + return: Keyword { + value: "return", + position: 35, + }, + expression: Some( + FunctionOperation( + Call { + comments: CommentGroup { + comments: [], + }, + function: Identifier( + Identifier { + position: 42, + value: "foo", + }, + ), + generics: None, + arguments: ArgumentListExpression { + comments: CommentGroup { + comments: [], + }, + left_parenthesis: 45, + arguments: CommaSeparated { + inner: [], + commas: [], + }, + right_parenthesis: 46, + }, + }, + ), + ), + semicolon: 47, + }, + ), + ], + right_brace: 49, + }, + }, + ), + Class( + ClassDefinition { + comments: CommentGroup { + comments: [], + }, + attributes: [], + modifiers: ModifierGroupDefinition { + position: 62, + modifiers: [ + Final( + Keyword { + value: "final", + position: 56, + }, + ), + ], + }, + class: Keyword { + value: "class", + position: 62, + }, + name: Identifier { + position: 68, + value: "Foo", + }, + templates: None, + extends: None, + implements: None, + body: ClassDefinitionBody { + left_brace: 72, + members: [ + Method( + MethodDefinition { + comments: CommentGroup { + comments: [], + }, + attributes: [], + modifiers: ModifierGroupDefinition { + position: 91, + modifiers: [ + Async( + Keyword { + value: "async", + position: 78, + }, + ), + Public( + Keyword { + value: "public", + position: 84, + }, + ), + ], + }, + function: Keyword { + value: "function", + position: 91, + }, + name: Identifier { + position: 100, + value: "bar", + }, + templates: None, + parameters: MethodParameterListDefinition { + comments: CommentGroup { + comments: [], + }, + left_parenthesis: 103, + parameters: CommaSeparated { + inner: [], + commas: [], + }, + right_parenthesis: 104, + }, + return_type: Some( + FunctionLikeReturnTypeDefinition { + colon: 105, + type_definition: String( + Keyword { + value: "string", + position: 107, + }, + ), + }, + ), + constraints: None, + body: Concrete( + BlockStatement { + comments: CommentGroup { + comments: [], + }, + left_brace: 114, + statements: [ + Return( + Explicit { + comments: CommentGroup { + comments: [], + }, + return: Keyword { + value: "return", + position: 124, + }, + expression: Some( + FunctionOperation( + Call { + comments: CommentGroup { + comments: [], + }, + function: Identifier( + Identifier { + position: 131, + value: "bar", + }, + ), + generics: None, + arguments: ArgumentListExpression { + comments: CommentGroup { + comments: [], + }, + left_parenthesis: 134, + arguments: CommaSeparated { + inner: [], + commas: [], + }, + right_parenthesis: 135, + }, + }, + ), + ), + semicolon: 136, + }, + ), + ], + right_brace: 142, + }, + ), + }, + ), + Method( + MethodDefinition { + comments: CommentGroup { + comments: [], + }, + attributes: [], + modifiers: ModifierGroupDefinition { + position: 173, + modifiers: [ + Async( + Keyword { + value: "async", + position: 153, + }, + ), + Public( + Keyword { + value: "public", + position: 159, + }, + ), + Static( + Keyword { + value: "static", + position: 166, + }, + ), + ], + }, + function: Keyword { + value: "function", + position: 173, + }, + name: Identifier { + position: 182, + value: "baz", + }, + templates: None, + parameters: MethodParameterListDefinition { + comments: CommentGroup { + comments: [], + }, + left_parenthesis: 185, + parameters: CommaSeparated { + inner: [], + commas: [], + }, + right_parenthesis: 186, + }, + return_type: Some( + FunctionLikeReturnTypeDefinition { + colon: 187, + type_definition: String( + Keyword { + value: "string", + position: 189, + }, + ), + }, + ), + constraints: None, + body: Concrete( + BlockStatement { + comments: CommentGroup { + comments: [], + }, + left_brace: 196, + statements: [ + Return( + Explicit { + comments: CommentGroup { + comments: [], + }, + return: Keyword { + value: "return", + position: 206, + }, + expression: Some( + FunctionOperation( + Call { + comments: CommentGroup { + comments: [], + }, + function: Identifier( + Identifier { + position: 213, + value: "baz", + }, + ), + generics: None, + arguments: ArgumentListExpression { + comments: CommentGroup { + comments: [], + }, + left_parenthesis: 216, + arguments: CommaSeparated { + inner: [], + commas: [], + }, + right_parenthesis: 217, + }, + }, + ), + ), + semicolon: 218, + }, + ), + ], + right_brace: 224, + }, + ), + }, + ), + ], + right_brace: 226, + }, + }, + ), + ], + eof: 228, +} \ No newline at end of file