line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: yamltidy parse tree element |
2
|
6
|
|
|
6
|
|
33
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
145
|
|
3
|
6
|
|
|
6
|
|
23
|
use warnings; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
108
|
|
4
|
6
|
|
|
6
|
|
46
|
use v5.20; |
|
6
|
|
|
|
|
27
|
|
5
|
6
|
|
|
6
|
|
33
|
use experimental qw/ signatures /; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
38
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package YAML::Tidy::Node; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.006_001'; # TRIAL VERSION |
10
|
6
|
|
|
6
|
|
1671
|
use overload '""' => \&_stringify; |
|
6
|
|
|
|
|
771
|
|
|
6
|
|
|
|
|
35
|
|
11
|
|
|
|
|
|
|
|
12
|
31844
|
|
|
31844
|
0
|
35904
|
sub new($class, %args) { |
|
31844
|
|
|
|
|
35997
|
|
|
31844
|
|
|
|
|
66105
|
|
|
31844
|
|
|
|
|
32071
|
|
13
|
31844
|
|
|
|
|
85595
|
my $self = { |
14
|
|
|
|
|
|
|
%args, |
15
|
|
|
|
|
|
|
}; |
16
|
31844
|
|
|
|
|
83323
|
return bless $self, $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
46370
|
|
|
46370
|
|
50967
|
sub _stringify($self, @args) { |
|
46370
|
|
|
|
|
46829
|
|
|
46370
|
|
|
|
|
62390
|
|
|
46370
|
|
|
|
|
45220
|
|
20
|
46370
|
|
100
|
|
|
75887
|
my $type = $self->{type} // ''; |
21
|
46370
|
|
|
|
|
67743
|
my $str = "($type)"; |
22
|
46370
|
100
|
|
|
|
62527
|
if ($self->is_collection) { |
23
|
44872
|
|
|
|
|
55994
|
my $open = $self->open; |
24
|
44872
|
|
|
|
|
59244
|
my $close = $self->close; |
25
|
|
|
|
|
|
|
$str .= sprintf " - ", |
26
|
|
|
|
|
|
|
$open->{start}->{line}, $open->{start}->{column}, |
27
|
|
|
|
|
|
|
$open->{end}->{line}, $open->{end}->{column}, |
28
|
|
|
|
|
|
|
$close->{start}->{line}, $close->{start}->{column}, |
29
|
|
|
|
|
|
|
$close->{end}->{line}, $close->{end}->{column}, |
30
|
44872
|
|
|
|
|
178093
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
1498
|
|
|
|
|
2645
|
my $val = substr($self->{value}, 0, 20); |
33
|
1498
|
|
|
|
|
2106
|
local $Data::Dumper::Useqq = 1; |
34
|
1498
|
|
|
|
|
6916
|
$val = Data::Dumper->Dump([$val], ['val']); |
35
|
1498
|
|
|
|
|
58659
|
chomp $val; |
36
|
|
|
|
|
|
|
$str .= sprintf " - | %s", |
37
|
|
|
|
|
|
|
$self->start->{line}, $self->start->{column}, |
38
|
1498
|
|
|
|
|
3184
|
$self->end->{line}, $self->end->{column}, $val |
39
|
|
|
|
|
|
|
} |
40
|
46370
|
|
|
|
|
110279
|
return $str; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
2359
|
|
|
2359
|
0
|
2838
|
sub is_mapping_value($node, $parent) { |
|
2359
|
|
|
|
|
2831
|
|
|
2359
|
|
|
|
|
2695
|
|
|
2359
|
|
|
|
|
2596
|
|
44
|
2359
|
|
100
|
|
|
10085
|
return ($parent->{type} eq 'MAP' and not $node->{index} % 2); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
package YAML::Tidy::Node::Collection; |
48
|
6
|
50
|
|
6
|
|
2360
|
use constant DEBUG => $ENV{YAML_TIDY_DEBUG} ? 1 : 0; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
419
|
|
49
|
|
|
|
|
|
|
|
50
|
6
|
|
|
6
|
|
34
|
use base 'YAML::Tidy::Node'; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
7658
|
|
51
|
|
|
|
|
|
|
|
52
|
67903
|
|
|
67903
|
|
99486
|
sub is_collection { 1 } |
53
|
|
|
|
|
|
|
|
54
|
35911
|
|
|
35911
|
|
37268
|
sub indent($self) { |
|
35911
|
|
|
|
|
37541
|
|
|
35911
|
|
|
|
|
37736
|
|
55
|
35911
|
|
|
|
|
42968
|
my $firstevent = $self->open; |
56
|
35911
|
100
|
|
|
|
60179
|
if ($firstevent->{name} eq 'document_start_event') { |
57
|
7460
|
|
|
|
|
14179
|
return 0; |
58
|
|
|
|
|
|
|
} |
59
|
28451
|
|
|
|
|
35094
|
my $startcol = $firstevent->{end}->{column}; |
60
|
28451
|
|
|
|
|
42676
|
return $startcol; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
131921
|
|
|
131921
|
|
127601
|
sub open($self) { $self->{start} } |
|
131921
|
|
|
|
|
130100
|
|
|
131921
|
|
|
|
|
122137
|
|
|
131921
|
|
|
|
|
190721
|
|
64
|
76128
|
|
|
76128
|
|
75638
|
sub close($self) { $self->{end} } |
|
76128
|
|
|
|
|
73819
|
|
|
76128
|
|
|
|
|
74250
|
|
|
76128
|
|
|
|
|
108003
|
|
65
|
|
|
|
|
|
|
|
66
|
749
|
|
|
749
|
|
952
|
sub sibling($self, $node, $diff) { |
|
749
|
|
|
|
|
956
|
|
|
749
|
|
|
|
|
928
|
|
|
749
|
|
|
|
|
921
|
|
|
749
|
|
|
|
|
798
|
|
67
|
749
|
50
|
|
|
|
1435
|
return unless $diff; |
68
|
749
|
|
|
|
|
1295
|
my $children = $self->{children}; |
69
|
|
|
|
|
|
|
# double check if $node is child of $parent |
70
|
749
|
50
|
|
|
|
1943
|
unless ("$children->[ $node->{index} - 1 ]" eq "$node") { |
71
|
0
|
|
|
|
|
0
|
die ">$node< is not a child of >$self<"; |
72
|
|
|
|
|
|
|
} |
73
|
749
|
|
|
|
|
1796
|
my $new_index = $node->{index} - 1 + $diff; |
74
|
749
|
50
|
33
|
|
|
3165
|
if ($new_index < 0 or $new_index > $#$children) { |
75
|
0
|
|
|
|
|
0
|
die "$new_index out of range for '$self'"; |
76
|
|
|
|
|
|
|
} |
77
|
749
|
|
|
|
|
1976
|
return $children->[ $new_index ]; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
13945
|
|
|
13945
|
|
15973
|
sub end($self) { |
|
13945
|
|
|
|
|
14772
|
|
|
13945
|
|
|
|
|
13896
|
|
82
|
13945
|
|
|
|
|
19588
|
return $self->close->{end}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
588
|
|
|
588
|
|
881
|
sub realendline($self) { |
|
588
|
|
|
|
|
783
|
|
|
588
|
|
|
|
|
684
|
|
86
|
588
|
|
|
|
|
1026
|
$self->close->{end}->{line} - 1; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
18819
|
|
|
18819
|
|
20661
|
sub start($self) { |
|
18819
|
|
|
|
|
19659
|
|
|
18819
|
|
|
|
|
18494
|
|
90
|
18819
|
|
|
|
|
24492
|
return $self->open->{start}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
10917
|
|
|
10917
|
|
11807
|
sub line($self) { |
|
10917
|
|
|
|
|
11767
|
|
|
10917
|
|
|
|
|
11423
|
|
94
|
|
|
|
|
|
|
|
95
|
10917
|
|
|
|
|
15911
|
my $contentstart = $self->contentstart; |
96
|
10917
|
|
|
|
|
17552
|
return $contentstart->{line}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
10917
|
|
|
10917
|
|
10994
|
sub contentstart($self) { |
|
10917
|
|
|
|
|
11838
|
|
|
10917
|
|
|
|
|
10732
|
|
100
|
10917
|
|
|
|
|
14593
|
my $firstevent = $self->open; |
101
|
10917
|
|
|
|
|
14883
|
return $firstevent->{end}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
786
|
|
|
786
|
|
1053
|
sub fix_node_indent($self, $fix) { |
|
786
|
|
|
|
|
1106
|
|
|
786
|
|
|
|
|
1004
|
|
|
786
|
|
|
|
|
960
|
|
105
|
786
|
|
|
|
|
1463
|
for my $e ($self->open, $self->close) { |
106
|
1572
|
|
|
|
|
2801
|
for my $pos (@$e{qw/ start end /}) { |
107
|
3144
|
|
|
|
|
4509
|
$pos->{column} += $fix; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
786
|
|
|
|
|
1172
|
for my $c (@{ $self->{children} }) { |
|
786
|
|
|
|
|
1610
|
|
111
|
1931
|
|
|
|
|
3150
|
$c->fix_node_indent($fix); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
6620
|
|
|
6620
|
|
6620
|
sub _move_columns($self, $line, $offset, $fix) { |
|
6620
|
|
|
|
|
7012
|
|
|
6620
|
|
|
|
|
6700
|
|
|
6620
|
|
|
|
|
6806
|
|
|
6620
|
|
|
|
|
7096
|
|
|
6620
|
|
|
|
|
6504
|
|
116
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": _move_columns $self $line $offset $fix\n"; |
117
|
6620
|
100
|
|
|
|
8416
|
return if $self->end->{line} < $line; |
118
|
5874
|
100
|
|
|
|
7951
|
return if $self->start->{line} > $line; |
119
|
4965
|
|
|
|
|
6568
|
for my $e ($self->open, $self->close) { |
120
|
9930
|
|
|
|
|
13620
|
for my $pos (@$e{qw/ start end /}) { |
121
|
19860
|
100
|
100
|
|
|
38409
|
if ($pos->{line} == $line and $pos->{column} >= $offset) { |
122
|
770
|
|
|
|
|
1196
|
$pos->{column} += $fix; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
4965
|
|
|
|
|
5419
|
for my $c (@{ $self->{children} }) { |
|
4965
|
|
|
|
|
7886
|
|
127
|
13544
|
|
|
|
|
18698
|
$c->_move_columns($line, $offset, $fix); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
3668
|
|
|
3668
|
|
3967
|
sub _fix_flow_indent($self, %args) { |
|
3668
|
|
|
|
|
4012
|
|
|
3668
|
|
|
|
|
5992
|
|
|
3668
|
|
|
|
|
3753
|
|
133
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": ========== _fix_flow_indent l=$line diff=$diff\n"; |
134
|
3668
|
|
|
|
|
4669
|
my $line = $args{line}; |
135
|
3668
|
|
|
|
|
4192
|
my $diff = $args{diff}; |
136
|
3668
|
|
|
|
|
4957
|
my $start = $self->open; |
137
|
3668
|
|
|
|
|
5244
|
my $end = $self->close; |
138
|
3668
|
|
|
|
|
6712
|
for my $pos ($start->{start}, $start->{end}, $end->{start}, $end->{end}) { |
139
|
14672
|
100
|
|
|
|
22807
|
if ($pos->{line} == $line) { |
140
|
3207
|
|
|
|
|
4214
|
$pos->{column} += $diff; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
} |
143
|
3668
|
|
|
|
|
4022
|
for my $c (@{ $self->{children} }) { |
|
3668
|
|
|
|
|
5768
|
|
144
|
7790
|
|
|
|
|
14200
|
$c->_fix_flow_indent(%args); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
3957
|
|
|
3957
|
|
3997
|
sub fix_lines($self, $startline, $diff) { |
|
3957
|
|
|
|
|
4277
|
|
|
3957
|
|
|
|
|
4237
|
|
|
3957
|
|
|
|
|
4052
|
|
|
3957
|
|
|
|
|
3782
|
|
149
|
3957
|
|
|
|
|
5068
|
my $start = $self->open; |
150
|
3957
|
|
|
|
|
4325
|
DEBUG and warn __PACKAGE__.':'.__LINE__.": ======== fix_lines $startline $diff ($self)\n"; |
151
|
3957
|
|
|
|
|
5068
|
my $end = $self->close; |
152
|
3957
|
|
|
|
|
6161
|
for my $pos ($start->{start}, $start->{end}) { |
153
|
7914
|
100
|
|
|
|
12576
|
if ($pos->{line} >= $startline) { |
154
|
3336
|
|
|
|
|
4134
|
$pos->{line} += $diff; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
} |
157
|
3957
|
|
|
|
|
5590
|
for my $pos ($end->{start}, $end->{end}) { |
158
|
7914
|
100
|
100
|
|
|
20801
|
if ($pos->{column} == 0 and $pos->{line} == $startline) { |
|
|
100
|
|
|
|
|
|
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
elsif ($pos->{line} >= $startline) { |
161
|
3846
|
|
|
|
|
4799
|
$pos->{line} += $diff; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
3957
|
|
|
|
|
4117
|
for my $c (@{ $self->{children} }) { |
|
3957
|
|
|
|
|
5968
|
|
165
|
7476
|
|
|
|
|
11278
|
$c->fix_lines($startline, $diff); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
package YAML::Tidy::Node::Scalar; |
170
|
6
|
50
|
|
6
|
|
41
|
use constant DEBUG => $ENV{YAML_TIDY_DEBUG} ? 1 : 0; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
333
|
|
171
|
6
|
|
|
|
|
366
|
use YAML::PP::Common qw/ |
172
|
|
|
|
|
|
|
YAML_PLAIN_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE |
173
|
|
|
|
|
|
|
YAML_DOUBLE_QUOTED_SCALAR_STYLE YAML_LITERAL_SCALAR_STYLE |
174
|
|
|
|
|
|
|
YAML_FOLDED_SCALAR_STYLE |
175
|
|
|
|
|
|
|
YAML_FLOW_SEQUENCE_STYLE YAML_FLOW_MAPPING_STYLE |
176
|
6
|
|
|
6
|
|
2607
|
/; |
|
6
|
|
|
|
|
7620
|
|
177
|
|
|
|
|
|
|
|
178
|
6
|
|
|
6
|
|
37
|
use base 'YAML::Tidy::Node'; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
6053
|
|
179
|
|
|
|
|
|
|
|
180
|
29217
|
|
|
29217
|
|
57654
|
sub is_collection { 0 } |
181
|
|
|
|
|
|
|
|
182
|
707
|
|
|
707
|
|
1082
|
sub is_quoted($self) { |
|
707
|
|
|
|
|
989
|
|
|
707
|
|
|
|
|
1035
|
|
183
|
707
|
|
|
|
|
2818
|
return $self->{style} ne YAML_PLAIN_SCALAR_STYLE |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
18207
|
|
|
18207
|
|
20050
|
sub indent($self) { |
|
18207
|
|
|
|
|
20587
|
|
|
18207
|
|
|
|
|
18279
|
|
187
|
18207
|
|
|
|
|
23361
|
return $self->open->{column}; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
42525
|
|
|
42525
|
|
44211
|
sub start($self) { |
|
42525
|
|
|
|
|
43498
|
|
|
42525
|
|
|
|
|
40854
|
|
191
|
42525
|
|
|
|
|
54395
|
return $self->open; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
133611
|
|
|
133611
|
|
131370
|
sub open($self) { $self->{start} } |
|
133611
|
|
|
|
|
137624
|
|
|
133611
|
|
|
|
|
127768
|
|
|
133611
|
|
|
|
|
210397
|
|
195
|
106187
|
|
|
106187
|
|
103118
|
sub close($self) { $self->{end} } |
|
106187
|
|
|
|
|
104224
|
|
|
106187
|
|
|
|
|
102728
|
|
|
106187
|
|
|
|
|
174129
|
|
196
|
|
|
|
|
|
|
|
197
|
21633
|
|
|
21633
|
|
22326
|
sub end($self) { |
|
21633
|
|
|
|
|
21996
|
|
|
21633
|
|
|
|
|
21525
|
|
198
|
21633
|
|
|
|
|
27210
|
return $self->close; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
13114
|
|
|
13114
|
|
14313
|
sub realendline($self) { |
|
13114
|
|
|
|
|
13773
|
|
|
13114
|
|
|
|
|
13581
|
|
202
|
13114
|
|
|
|
|
16813
|
my $end = $self->close; |
203
|
13114
|
100
|
100
|
|
|
37341
|
if ($self->{style} == YAML_LITERAL_SCALAR_STYLE |
204
|
|
|
|
|
|
|
or $self->{style} == YAML_FOLDED_SCALAR_STYLE) { |
205
|
2494
|
100
|
|
|
|
5287
|
if ($end->{column} == 0) { |
206
|
2414
|
|
|
|
|
5031
|
return $end->{line} - 1; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
} |
209
|
10700
|
|
|
|
|
17089
|
$end->{line}; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
20670
|
|
|
20670
|
|
21973
|
sub line($self) { |
|
20670
|
|
|
|
|
21900
|
|
|
20670
|
|
|
|
|
21200
|
|
213
|
20670
|
|
|
|
|
29392
|
my $contentstart = $self->contentstart; |
214
|
20670
|
|
|
|
|
33683
|
return $contentstart->{line}; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
20670
|
|
|
20670
|
|
20688
|
sub contentstart($self) { |
|
20670
|
|
|
|
|
20913
|
|
|
20670
|
|
|
|
|
22561
|
|
218
|
20670
|
|
|
|
|
28413
|
return $self->start; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
22922
|
|
|
22922
|
|
24095
|
sub multiline($self) { |
|
22922
|
|
|
|
|
23528
|
|
|
22922
|
|
|
|
|
22069
|
|
222
|
22922
|
100
|
|
|
|
28730
|
if ($self->open->{line} < $self->close->{line}) { |
223
|
2930
|
|
|
|
|
9890
|
return 1; |
224
|
|
|
|
|
|
|
} |
225
|
19992
|
|
|
|
|
47025
|
return 0; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
23549
|
|
|
23549
|
|
24904
|
sub empty_scalar($self) { |
|
23549
|
|
|
|
|
24472
|
|
|
23549
|
|
|
|
|
25668
|
|
229
|
23549
|
|
|
|
|
32278
|
my ($start, $end) = ($self->open, $self->close); |
230
|
23549
|
100
|
100
|
|
|
66215
|
if ($start->{line} == $end->{line} and $start->{column} == $end->{column}) { |
231
|
551
|
|
|
|
|
2091
|
return 1; |
232
|
|
|
|
|
|
|
} |
233
|
22998
|
|
|
|
|
48282
|
return 0; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
1733
|
|
|
1733
|
|
1866
|
sub fix_node_indent($self, $fix) { |
|
1733
|
|
|
|
|
1949
|
|
|
1733
|
|
|
|
|
1893
|
|
|
1733
|
|
|
|
|
1727
|
|
237
|
1733
|
|
|
|
|
2622
|
for my $pos ($self->open, $self->close) { |
238
|
3466
|
|
|
|
|
5485
|
$pos->{column} += $fix; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
8240
|
|
|
8240
|
|
8783
|
sub _move_columns($self, $line, $offset, $fix) { |
|
8240
|
|
|
|
|
8244
|
|
|
8240
|
|
|
|
|
8183
|
|
|
8240
|
|
|
|
|
8050
|
|
|
8240
|
|
|
|
|
8065
|
|
|
8240
|
|
|
|
|
7617
|
|
243
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": _move_columns $self $line $offset $fix\n"; |
244
|
8240
|
100
|
|
|
|
10405
|
return if $self->end->{line} < $line; |
245
|
5276
|
100
|
|
|
|
6877
|
return if $self->start->{line} > $line; |
246
|
2673
|
|
|
|
|
3489
|
for my $pos ($self->open, $self->close) { |
247
|
5346
|
100
|
100
|
|
|
14639
|
if ($pos->{line} == $line and $pos->{column} >= $offset) { |
248
|
1402
|
|
|
|
|
2351
|
$pos->{column} += $fix; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
5236
|
|
|
5236
|
|
5506
|
sub _fix_flow_indent($self, %args) { |
|
5236
|
|
|
|
|
5447
|
|
|
5236
|
|
|
|
|
6423
|
|
|
5236
|
|
|
|
|
5178
|
|
254
|
5236
|
|
|
|
|
5909
|
my $line = $args{line}; |
255
|
5236
|
|
|
|
|
5798
|
my $diff = $args{diff}; |
256
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": ========== _fix_flow_indent l=$line diff=$diff\n"; |
257
|
5236
|
|
|
|
|
6916
|
for my $pos ($self->open, $self->close) { |
258
|
10472
|
100
|
|
|
|
20632
|
if ($pos->{line} == $line) { |
259
|
2989
|
|
|
|
|
5779
|
$pos->{column} += $diff; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
4500
|
|
|
4500
|
|
5353
|
sub fix_lines($self, $startline, $diff) { |
|
4500
|
|
|
|
|
4717
|
|
|
4500
|
|
|
|
|
4471
|
|
|
4500
|
|
|
|
|
4747
|
|
|
4500
|
|
|
|
|
4366
|
|
265
|
4500
|
|
|
|
|
4628
|
DEBUG and warn __PACKAGE__.':'.__LINE__.": ======== fix_lines $startline $diff ($self)\n"; |
266
|
4500
|
|
|
|
|
6004
|
for my $pos ($self->open) { |
267
|
4500
|
100
|
100
|
|
|
5839
|
if ($self->empty_scalar and $pos->{column} == 0 and $pos->{line} == $startline) { |
|
|
100
|
100
|
|
|
|
|
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
elsif ($pos->{line} >= $startline) { |
270
|
2178
|
|
|
|
|
2952
|
$pos->{line} += $diff; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
} |
273
|
4500
|
|
|
|
|
6187
|
for my $pos ($self->close) { |
274
|
4500
|
100
|
100
|
|
|
12040
|
if ($pos->{column} == 0 and $pos->{line} == $startline) { |
|
|
100
|
|
|
|
|
|
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
elsif ($pos->{line} >= $startline) { |
277
|
2178
|
|
|
|
|
4170
|
$pos->{line} += $diff; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
1; |