From d6764076a1721a1acb8429931f1815491038d2a6 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Thu, 25 Jul 2024 22:49:42 +0200 Subject: [PATCH] [ruby/prism] Review config.yml: documentation, types and field names https://github.com/ruby/prism/commit/d43333539e --- prism/config.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/prism/config.yml b/prism/config.yml index 88fccce4d1..abe411a04b 100644 --- a/prism/config.yml +++ b/prism/config.yml @@ -774,15 +774,25 @@ nodes: fields: - name: new_name type: node + kind: + - GlobalVariableReadNode + - BackReferenceReadNode + - NumberedReferenceReadNode comment: | - Represents the new name of the global variable that can be used after aliasing. This can be either a global variable, a back reference, or a numbered reference. + Represents the new name of the global variable that can be used after aliasing. alias $foo $bar ^^^^ - name: old_name type: node + kind: + - GlobalVariableReadNode + - BackReferenceReadNode + - NumberedReferenceReadNode + - SymbolNode # On parsing error of `alias $a b` + - MissingNode # On parsing error of `alias $a 42` comment: | - Represents the old name of the global variable that could be used before aliasing. This can be either a global variable, a back reference, or a numbered reference. + Represents the old name of the global variable that can be used before aliasing. alias $foo $bar ^^^^ @@ -802,8 +812,16 @@ nodes: fields: - name: new_name type: node + kind: + - SymbolNode + - InterpolatedSymbolNode - name: old_name type: node + kind: + - SymbolNode + - InterpolatedSymbolNode + - GlobalVariableReadNode # On parsing error of `alias a $b` + - MissingNode # On parsing error of `alias a 42` - name: keyword_loc type: location comment: | @@ -1034,7 +1052,7 @@ nodes: - name: operator_loc type: location comment: | - Represents block method arguments. + Represents a block argument using `&`. bar(&args) ^^^^^^^^^^ @@ -1054,8 +1072,15 @@ nodes: type: constant[] - name: parameters type: node? + kind: + - BlockParametersNode + - NumberedParametersNode + - ItParametersNode - name: body type: node? + kind: + - StatementsNode + - BeginNode - name: opening_loc type: location - name: closing_loc @@ -1075,7 +1100,7 @@ nodes: - name: operator_loc type: location comment: | - Represents a block parameter to a method, block, or lambda definition. + Represents a block parameter of a method, block, or lambda definition. def a(&b) ^^ @@ -2164,6 +2189,9 @@ nodes: end - name: consequent type: node? + kind: + - ElseNode + - IfNode comment: | Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.