Skip to content

Commit

Permalink
WIP: Review config.yml: documentation, types and field names
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jul 27, 2024
1 parent 89c22f0 commit 5f7e4ba
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -770,15 +770,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
^^^^
Expand All @@ -798,8 +808,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: |
Expand Down Expand Up @@ -897,6 +915,9 @@ nodes:
fields:
- name: constant
type: node?
# TODO requireds seems not symmetric with posts, maybe it could be pre/rest/post?
# Also posts are also required, so requireds seems not a great name.
# Somewhat related: https://github.com/ruby/prism/issues/1600
- name: requireds
type: node[]
- name: rest
Expand Down Expand Up @@ -1030,7 +1051,7 @@ nodes:
- name: operator_loc
type: location
comment: |
Represents block method arguments.
Represents a block argument using `&`.
bar(&args)
^^^^^^^^^^
Expand All @@ -1050,8 +1071,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
Expand All @@ -1071,7 +1099,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)
^^
Expand Down Expand Up @@ -2158,8 +2186,13 @@ nodes:
baz
^^^
end
# TODO: consequent should mean then_clause in logic, but it's actually else_clause here.
# BTW, BeginNode has a `else_clause` field, maybe a good name for this?
- 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.
Expand Down

0 comments on commit 5f7e4ba

Please sign in to comment.