@@ -302,8 +302,8 @@ def find_next_statement_start(position)
302
302
def on_BEGIN ( statements )
303
303
lbrace = find_token ( LBrace )
304
304
rbrace = find_token ( RBrace )
305
- start_char = find_next_statement_start ( lbrace . location . end_char )
306
305
306
+ start_char = find_next_statement_start ( lbrace . location . end_char )
307
307
statements . bind (
308
308
start_char ,
309
309
start_char - line_counts [ lbrace . location . start_line - 1 ] . start ,
@@ -340,8 +340,8 @@ def on_CHAR(value)
340
340
def on_END ( statements )
341
341
lbrace = find_token ( LBrace )
342
342
rbrace = find_token ( RBrace )
343
- start_char = find_next_statement_start ( lbrace . location . end_char )
344
343
344
+ start_char = find_next_statement_start ( lbrace . location . end_char )
345
345
statements . bind (
346
346
start_char ,
347
347
start_char - line_counts [ lbrace . location . start_line - 1 ] . start ,
@@ -831,8 +831,8 @@ def on_brace_block(block_var, statements)
831
831
lbrace = find_token ( LBrace )
832
832
rbrace = find_token ( RBrace )
833
833
location = ( block_var || lbrace ) . location
834
- start_char = find_next_statement_start ( location . end_char )
835
834
835
+ start_char = find_next_statement_start ( location . end_char )
836
836
statements . bind (
837
837
start_char ,
838
838
start_char - line_counts [ location . start_line - 1 ] . start ,
@@ -1329,8 +1329,8 @@ def on_else(statements)
1329
1329
1330
1330
node = tokens [ index ]
1331
1331
ending = node . value == "end" ? tokens . delete_at ( index ) : node
1332
- start_char = find_next_statement_start ( keyword . location . end_char )
1333
1332
1333
+ start_char = find_next_statement_start ( keyword . location . end_char )
1334
1334
statements . bind (
1335
1335
start_char ,
1336
1336
start_char - line_counts [ keyword . location . start_line - 1 ] . start ,
@@ -1355,9 +1355,10 @@ def on_elsif(predicate, statements, consequent)
1355
1355
beginning = find_token ( Kw , "elsif" )
1356
1356
ending = consequent || find_token ( Kw , "end" )
1357
1357
1358
+ start_char = find_next_statement_start ( predicate . location . end_char )
1358
1359
statements . bind (
1359
- predicate . location . end_char ,
1360
- predicate . location . end_column ,
1360
+ start_char ,
1361
+ start_char - line_counts [ predicate . location . start_line - 1 ] . start ,
1361
1362
ending . location . start_char ,
1362
1363
ending . location . start_column
1363
1364
)
@@ -1598,9 +1599,10 @@ def on_for(index, collection, statements)
1598
1599
tokens . delete ( keyword )
1599
1600
end
1600
1601
1602
+ start_char = find_next_statement_start ( ( keyword || collection ) . location . end_char )
1601
1603
statements . bind (
1602
- ( keyword || collection ) . location . end_char ,
1603
- ( keyword || collection ) . location . end_column ,
1604
+ start_char ,
1605
+ start_char - line_counts [ ( keyword || collection ) . location . end_line - 1 ] . start ,
1604
1606
ending . location . start_char ,
1605
1607
ending . location . start_column
1606
1608
)
@@ -1778,9 +1780,10 @@ def on_if(predicate, statements, consequent)
1778
1780
beginning = find_token ( Kw , "if" )
1779
1781
ending = consequent || find_token ( Kw , "end" )
1780
1782
1783
+ start_char = find_next_statement_start ( predicate . location . end_char )
1781
1784
statements . bind (
1782
- predicate . location . end_char ,
1783
- predicate . location . end_column ,
1785
+ start_char ,
1786
+ start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
1784
1787
ending . location . start_char ,
1785
1788
ending . location . start_column
1786
1789
)
@@ -2024,9 +2027,10 @@ def on_lambda(params, statements)
2024
2027
closing = find_token ( Kw , "end" )
2025
2028
end
2026
2029
2030
+ start_char = find_next_statement_start ( opening . location . end_char )
2027
2031
statements . bind (
2028
- opening . location . end_char ,
2029
- opening . location . end_column ,
2032
+ start_char ,
2033
+ start_char - line_counts [ opening . location . end_line - 1 ] . start ,
2030
2034
closing . location . start_char ,
2031
2035
closing . location . start_column
2032
2036
)
@@ -3456,9 +3460,10 @@ def on_unless(predicate, statements, consequent)
3456
3460
beginning = find_token ( Kw , "unless" )
3457
3461
ending = consequent || find_token ( Kw , "end" )
3458
3462
3463
+ start_char = find_next_statement_start ( predicate . location . end_char )
3459
3464
statements . bind (
3460
- predicate . location . end_char ,
3461
- predicate . location . end_column ,
3465
+ start_char ,
3466
+ start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3462
3467
ending . location . start_char ,
3463
3468
ending . location . start_column
3464
3469
)
@@ -3498,9 +3503,10 @@ def on_until(predicate, statements)
3498
3503
end
3499
3504
3500
3505
# Update the Statements location information
3506
+ start_char = find_next_statement_start ( predicate . location . end_char )
3501
3507
statements . bind (
3502
- predicate . location . end_char ,
3503
- predicate . location . end_column ,
3508
+ start_char ,
3509
+ start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3504
3510
ending . location . start_char ,
3505
3511
ending . location . start_column
3506
3512
)
@@ -3633,9 +3639,10 @@ def on_while(predicate, statements)
3633
3639
end
3634
3640
3635
3641
# Update the Statements location information
3642
+ start_char = find_next_statement_start ( predicate . location . end_char )
3636
3643
statements . bind (
3637
- predicate . location . end_char ,
3638
- predicate . location . end_column ,
3644
+ start_char ,
3645
+ start_char - line_counts [ predicate . location . end_line - 1 ] . start ,
3639
3646
ending . location . start_char ,
3640
3647
ending . location . start_column
3641
3648
)
0 commit comments