@@ -1131,7 +1131,8 @@ def format(q)
1131
1131
end
1132
1132
end
1133
1133
1134
- # [LBracket] the bracket that opens this array
1134
+ # [nil | LBracket | QSymbolsBeg | QWordsBeg | SymbolsBeg | WordsBeg] the
1135
+ # bracket that opens this array
1135
1136
attr_reader :lbracket
1136
1137
1137
1138
# [nil | Args] the contents of the array
@@ -1485,7 +1486,7 @@ class Assoc < Node
1485
1486
# [Node] the key of this pair
1486
1487
attr_reader :key
1487
1488
1488
- # [Node] the value of this pair
1489
+ # [nil | Node] the value of this pair
1489
1490
attr_reader :value
1490
1491
1491
1492
# [Array[ Comment | EmbDoc ]] the comments attached to this node
@@ -3508,16 +3509,16 @@ def align(q, node, &block)
3508
3509
# object.method argument
3509
3510
#
3510
3511
class CommandCall < Node
3511
- # [Node] the receiver of the message
3512
+ # [nil | Node] the receiver of the message
3512
3513
attr_reader :receiver
3513
3514
3514
- # [:"::" | Op | Period] the operator used to send the message
3515
+ # [nil | :"::" | Op | Period] the operator used to send the message
3515
3516
attr_reader :operator
3516
3517
3517
- # [Const | Ident | Op] the message being send
3518
+ # [:call | Const | Ident | Op] the message being send
3518
3519
attr_reader :message
3519
3520
3520
- # [nil | Args] the arguments going along with the message
3521
+ # [nil | Args | ArgParen ] the arguments going along with the message
3521
3522
attr_reader :arguments
3522
3523
3523
3524
# [nil | BlockNode] the block associated with this method call
@@ -4603,7 +4604,7 @@ class DynaSymbol < Node
4603
4604
# dynamic symbol
4604
4605
attr_reader :parts
4605
4606
4606
- # [String] the quote used to delimit the dynamic symbol
4607
+ # [nil | String] the quote used to delimit the dynamic symbol
4607
4608
attr_reader :quote
4608
4609
4609
4610
# [Array[ Comment | EmbDoc ]] the comments attached to this node
@@ -5947,7 +5948,7 @@ def comments
5947
5948
end
5948
5949
5949
5950
def format ( q )
5950
- q . format ( key )
5951
+ HashKeyFormatter :: Labels . new . format_key ( q , key )
5951
5952
5952
5953
if value
5953
5954
q . text ( " " )
@@ -5978,8 +5979,8 @@ def format(q)
5978
5979
# [nil | Node] the optional constant wrapper
5979
5980
attr_reader :constant
5980
5981
5981
- # [Array[ [Label, Node] ]] the set of tuples representing the keywords
5982
- # that should be matched against in the pattern
5982
+ # [Array[ [DynaSymbol | Label, nil | Node] ]] the set of tuples
5983
+ # representing the keywords that should be matched against in the pattern
5983
5984
attr_reader :keywords
5984
5985
5985
5986
# [nil | VarField] an optional parameter to gather up all remaining keywords
@@ -7510,7 +7511,7 @@ def ===(other)
7510
7511
# method {}
7511
7512
#
7512
7513
class MethodAddBlock < Node
7513
- # [CallNode | Command | CommandCall] the method call
7514
+ # [ARef | CallNode | Command | CommandCall | Super | ZSuper ] the method call
7514
7515
attr_reader :call
7515
7516
7516
7517
# [BlockNode] the block being sent with the method call
@@ -7585,8 +7586,12 @@ def format_contents(q)
7585
7586
# first, second, third = value
7586
7587
#
7587
7588
class MLHS < Node
7588
- # [Array[ARefField | ArgStar | Field | Ident | MLHSParen | VarField]] the
7589
- # parts of the left-hand side of a multiple assignment
7589
+ # [
7590
+ # Array[
7591
+ # ARefField | ArgStar | ConstPathField | Field | Ident | MLHSParen |
7592
+ # TopConstField | VarField
7593
+ # ]
7594
+ # ] the parts of the left-hand side of a multiple assignment
7590
7595
attr_reader :parts
7591
7596
7592
7597
# [boolean] whether or not there is a trailing comma at the end of this
@@ -8211,7 +8216,7 @@ def format(q)
8211
8216
end
8212
8217
end
8213
8218
8214
- # [Array[ Ident ]] any required parameters
8219
+ # [Array[ Ident | MLHSParen ]] any required parameters
8215
8220
attr_reader :requireds
8216
8221
8217
8222
# [Array[ [ Ident, Node ] ]] any optional parameters and their default
@@ -8226,11 +8231,12 @@ def format(q)
8226
8231
# parameter
8227
8232
attr_reader :posts
8228
8233
8229
- # [Array[ [ Ident , nil | Node ] ]] any keyword parameters and their
8234
+ # [Array[ [ Label , nil | Node ] ]] any keyword parameters and their
8230
8235
# optional default values
8231
8236
attr_reader :keywords
8232
8237
8233
- # [nil | :nil | KwRestParam] the optional keyword rest parameter
8238
+ # [nil | :nil | ArgsForward | KwRestParam] the optional keyword rest
8239
+ # parameter
8234
8240
attr_reader :keyword_rest
8235
8241
8236
8242
# [nil | BlockArg] the optional block parameter
@@ -9268,7 +9274,7 @@ def ambiguous?(q)
9268
9274
# end
9269
9275
#
9270
9276
class RescueEx < Node
9271
- # [Node] the list of exceptions being rescued
9277
+ # [nil | Node] the list of exceptions being rescued
9272
9278
attr_reader :exceptions
9273
9279
9274
9280
# [nil | Field | VarField] the expression being used to capture the raised
@@ -9346,7 +9352,7 @@ class Rescue < Node
9346
9352
# [Kw] the rescue keyword
9347
9353
attr_reader :keyword
9348
9354
9349
- # [RescueEx] the exceptions being rescued
9355
+ # [nil | RescueEx] the exceptions being rescued
9350
9356
attr_reader :exception
9351
9357
9352
9358
# [Statements] the expressions to evaluate when an error is rescued
@@ -9995,9 +10001,13 @@ class StringContent < Node
9995
10001
# string
9996
10002
attr_reader :parts
9997
10003
10004
+ # [Array[ Comment | EmbDoc ]] the comments attached to this node
10005
+ attr_reader :comments
10006
+
9998
10007
def initialize ( parts :, location :)
9999
10008
@parts = parts
10000
10009
@location = location
10010
+ @comments = [ ]
10001
10011
end
10002
10012
10003
10013
def accept ( visitor )
@@ -10024,6 +10034,33 @@ def deconstruct_keys(_keys)
10024
10034
def ===( other )
10025
10035
other . is_a? ( StringContent ) && ArrayMatch . call ( parts , other . parts )
10026
10036
end
10037
+
10038
+ def format ( q )
10039
+ q . text ( q . quote )
10040
+ q . group do
10041
+ parts . each do |part |
10042
+ if part . is_a? ( TStringContent )
10043
+ value = Quotes . normalize ( part . value , q . quote )
10044
+ first = true
10045
+
10046
+ value . each_line ( chomp : true ) do |line |
10047
+ if first
10048
+ first = false
10049
+ else
10050
+ q . breakable_return
10051
+ end
10052
+
10053
+ q . text ( line )
10054
+ end
10055
+
10056
+ q . breakable_return if value . end_with? ( "\n " )
10057
+ else
10058
+ q . format ( part )
10059
+ end
10060
+ end
10061
+ end
10062
+ q . text ( q . quote )
10063
+ end
10027
10064
end
10028
10065
10029
10066
# StringConcat represents concatenating two strings together using a backward
@@ -10033,7 +10070,8 @@ def ===(other)
10033
10070
# "second"
10034
10071
#
10035
10072
class StringConcat < Node
10036
- # [StringConcat | StringLiteral] the left side of the concatenation
10073
+ # [Heredoc | StringConcat | StringLiteral] the left side of the
10074
+ # concatenation
10037
10075
attr_reader :left
10038
10076
10039
10077
# [StringLiteral] the right side of the concatenation
@@ -10230,7 +10268,7 @@ class StringLiteral < Node
10230
10268
# string literal
10231
10269
attr_reader :parts
10232
10270
10233
- # [String] which quote was used by the string literal
10271
+ # [nil | String] which quote was used by the string literal
10234
10272
attr_reader :quote
10235
10273
10236
10274
# [Array[ Comment | EmbDoc ]] the comments attached to this node
@@ -10475,8 +10513,8 @@ def ===(other)
10475
10513
# :symbol
10476
10514
#
10477
10515
class SymbolLiteral < Node
10478
- # [Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op] the value of the
10479
- # symbol
10516
+ # [Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op | TStringContent]
10517
+ # the value of the symbol
10480
10518
attr_reader :value
10481
10519
10482
10520
# [Array[ Comment | EmbDoc ]] the comments attached to this node
@@ -11430,7 +11468,7 @@ def modifier?
11430
11468
#
11431
11469
# In the example above, the VarField node represents the +variable+ token.
11432
11470
class VarField < Node
11433
- # [nil | Const | CVar | GVar | Ident | IVar] the target of this node
11471
+ # [nil | :nil | Const | CVar | GVar | Ident | IVar] the target of this node
11434
11472
attr_reader :value
11435
11473
11436
11474
# [Array[ Comment | EmbDoc ]] the comments attached to this node
@@ -11569,7 +11607,7 @@ def pin(parent, pin)
11569
11607
# This can be a plain local variable like the example above. It can also be a
11570
11608
# a class variable, a global variable, or an instance variable.
11571
11609
class PinnedVarRef < Node
11572
- # [VarRef ] the value of this node
11610
+ # [Const | CVar | GVar | Ident | IVar ] the value of this node
11573
11611
attr_reader :value
11574
11612
11575
11613
# [Array[ Comment | EmbDoc ]] the comments attached to this node
0 commit comments