From 4e6734e04d172908d286bfb8daae6de762d8a1b0 Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Thu, 14 Nov 2024 12:42:54 -0500 Subject: [PATCH 1/6] improved text and rule names --- standard/statements.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/standard/statements.md b/standard/statements.md index a634876e3..b471f4ac5 100644 --- a/standard/statements.md +++ b/standard/statements.md @@ -302,12 +302,10 @@ A *local_variable_declaration* declares one or more local variables. local_variable_declaration : implicitly_typed_local_variable_declaration | explicitly_typed_local_variable_declaration - | ref_local_variable_declaration + | explicitly_typed_ref_local_variable_declaration ; ``` -Local variable declarations fall into one of the three categories: implicitly typed, explicitly typed, and ref local. - Implicitly typed declarations contain the contextual keyword ([§6.4.4](lexical-structure.md#644-keywords)) `var` resulting in a syntactic ambiguity between the three categories which is resolved as follows: - If there is no type named `var` in scope and the input matches *implicitly_typed_local_variable_declaration* then it is chosen; @@ -366,7 +364,7 @@ implicitly_typed_local_variable_declarator ; ``` -An *implicity_typed_local_variable_declaration* introduces a single local variable, *identifier*. The *expression* or *variable_reference* shall have a compile-time type, `T`. The first alternative declares a variable with an initial value of *expression*; its type is `T?` when `T` is a non-nullable reference type, otherwise its type is `T`. The second alternative declares a ref variable with an initial value of `ref` *variable_reference*; its type is `ref T?` when `T` is a non-nullable reference type, otherwise its type is `ref T`. +An *implicity_typed_local_variable_declaration* introduces a single local variable, *identifier*. The *expression* or *variable_reference* shall have a compile-time type, `T`. The first alternative declares a variable with an initial value of *expression*; its type is `T?` when `T` is a non-nullable reference type, otherwise its type is `T`. The second alternative declares a ref variable with an initial value of `ref` *variable_reference*; its type is `ref T?` when `T` is a non-nullable reference type, otherwise its type is `ref T`. (`ref_kind` is described in [§15.6.1](classes.md#1561-general).) > *Example*: > @@ -433,14 +431,14 @@ An *explicity_typed_local_variable_declaration* introduces one or more local var If a *local_variable_initializer* is present then its type shall be appropriate according to the rules of simple assignment ([§12.21.2](expressions.md#12212-simple-assignment)) or array initialization ([§17.7](arrays.md#177-array-initializers)) and its value is assigned as the initial value of the variable. -#### 13.6.2.4 Ref local variable declarations +#### 13.6.2.4 Explicitly typed ref local variable declarations ```ANTLR -ref_local_variable_declaration - : ref_kind type ref_local_variable_declarators +explicitly_typed_ref_local_variable_declaration + : explicitly_typed_ref_kind type ref_local_variable_declarators ; -ref_local_variable_declarators +explicitly_typed_ref_local_variable_declarators : ref_local_variable_declarator (',' ref_local_variable_declarator)* ; From 3f75e651004aa70a01e29ce3a75875ce74174485 Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Thu, 14 Nov 2024 12:45:37 -0500 Subject: [PATCH 2/6] change section heading --- standard/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/README.md b/standard/README.md index 1525cc8da..c82b7d153 100644 --- a/standard/README.md +++ b/standard/README.md @@ -453,7 +453,7 @@ - [§13.6.2.1](statements.md#13621-general) General - [§13.6.2.2](statements.md#13622-implicitly-typed-local-variable-declarations) Implicitly typed local variable declarations - [§13.6.2.3](statements.md#13623-explicitly-typed-local-variable-declarations) Explicitly typed local variable declarations - - [§13.6.2.4](statements.md#13624-ref-local-variable-declarations) Ref local variable declarations + - [§13.6.2.4](statements.md#13624-explicitly-typed-ref-local-variable-declarations) Explicitly typed ref local variable declarations - [§13.6.3](statements.md#1363-local-constant-declarations) Local constant declarations - [§13.6.4](statements.md#1364-local-function-declarations) Local function declarations - [§13.7](statements.md#137-expression-statements) Expression statements From b29c023a32e9de22c10f0361751d734a3e245d23 Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Thu, 14 Nov 2024 13:08:07 -0500 Subject: [PATCH 3/6] fix grammar edit error --- standard/statements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/statements.md b/standard/statements.md index b471f4ac5..ddbd9f6d5 100644 --- a/standard/statements.md +++ b/standard/statements.md @@ -435,7 +435,7 @@ If a *local_variable_initializer* is present then its type shall be appropriate ```ANTLR explicitly_typed_ref_local_variable_declaration - : explicitly_typed_ref_kind type ref_local_variable_declarators + : ref_kind type explicitly_typed_ref_local_variable_declarators ; explicitly_typed_ref_local_variable_declarators From ec9eb9309ce8708f832b068a0157f22db69155d5 Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Sat, 16 Nov 2024 08:35:44 -0500 Subject: [PATCH 4/6] Update standard/statements.md Co-authored-by: Nigel-Ecma --- standard/statements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/statements.md b/standard/statements.md index ddbd9f6d5..034669c1f 100644 --- a/standard/statements.md +++ b/standard/statements.md @@ -435,7 +435,7 @@ If a *local_variable_initializer* is present then its type shall be appropriate ```ANTLR explicitly_typed_ref_local_variable_declaration - : ref_kind type explicitly_typed_ref_local_variable_declarators + : ref_kind type ref_local_variable_declarators ; explicitly_typed_ref_local_variable_declarators From 240a2ec984ccda5bf6399cd5b20d7e147bdab32e Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Sat, 16 Nov 2024 08:36:38 -0500 Subject: [PATCH 5/6] Update standard/statements.md Co-authored-by: Nigel-Ecma --- standard/statements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/statements.md b/standard/statements.md index 034669c1f..437cae976 100644 --- a/standard/statements.md +++ b/standard/statements.md @@ -438,7 +438,7 @@ explicitly_typed_ref_local_variable_declaration : ref_kind type ref_local_variable_declarators ; -explicitly_typed_ref_local_variable_declarators +ref_local_variable_declarators : ref_local_variable_declarator (',' ref_local_variable_declarator)* ; From e172769ae897ab25170c85a727b3f8c2e2eaac9f Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Sun, 17 Nov 2024 12:21:25 -0500 Subject: [PATCH 6/6] Update standard/statements.md Co-authored-by: Kalle Olavi Niemitalo --- standard/statements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/statements.md b/standard/statements.md index 437cae976..245bb6d55 100644 --- a/standard/statements.md +++ b/standard/statements.md @@ -364,7 +364,7 @@ implicitly_typed_local_variable_declarator ; ``` -An *implicity_typed_local_variable_declaration* introduces a single local variable, *identifier*. The *expression* or *variable_reference* shall have a compile-time type, `T`. The first alternative declares a variable with an initial value of *expression*; its type is `T?` when `T` is a non-nullable reference type, otherwise its type is `T`. The second alternative declares a ref variable with an initial value of `ref` *variable_reference*; its type is `ref T?` when `T` is a non-nullable reference type, otherwise its type is `ref T`. (`ref_kind` is described in [§15.6.1](classes.md#1561-general).) +An *implicitly_typed_local_variable_declaration* introduces a single local variable, *identifier*. The *expression* or *variable_reference* shall have a compile-time type, `T`. The first alternative declares a variable with an initial value of *expression*; its type is `T?` when `T` is a non-nullable reference type, otherwise its type is `T`. The second alternative declares a ref variable with an initial value of `ref` *variable_reference*; its type is `ref T?` when `T` is a non-nullable reference type, otherwise its type is `ref T`. (*ref_kind* is described in [§15.6.1](classes.md#1561-general).) > *Example*: >