line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: yamltidy parse tree element |
2
|
6
|
|
|
6
|
|
34
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
148
|
|
3
|
6
|
|
|
6
|
|
25
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
119
|
|
4
|
6
|
|
|
6
|
|
59
|
use v5.20; |
|
6
|
|
|
|
|
47
|
|
5
|
6
|
|
|
6
|
|
32
|
use experimental qw/ signatures /; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package YAML::Tidy::Node; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.007'; # VERSION |
10
|
6
|
|
|
6
|
|
1711
|
use overload '""' => \&_stringify; |
|
6
|
|
|
|
|
753
|
|
|
6
|
|
|
|
|
37
|
|
11
|
|
|
|
|
|
|
|
12
|
31844
|
|
|
31844
|
0
|
35994
|
sub new($class, %args) { |
|
31844
|
|
|
|
|
35066
|
|
|
31844
|
|
|
|
|
70459
|
|
|
31844
|
|
|
|
|
31857
|
|
13
|
31844
|
|
|
|
|
88289
|
my $self = { |
14
|
|
|
|
|
|
|
%args, |
15
|
|
|
|
|
|
|
}; |
16
|
31844
|
|
|
|
|
86191
|
return bless $self, $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
46370
|
|
|
46370
|
|
51352
|
sub _stringify($self, @args) { |
|
46370
|
|
|
|
|
48993
|
|
|
46370
|
|
|
|
|
64502
|
|
|
46370
|
|
|
|
|
45589
|
|
20
|
46370
|
|
100
|
|
|
78553
|
my $type = $self->{type} // ''; |
21
|
46370
|
|
|
|
|
68380
|
my $str = "($type)"; |
22
|
46370
|
100
|
|
|
|
65366
|
if ($self->is_collection) { |
23
|
44872
|
|
|
|
|
60248
|
my $open = $self->open; |
24
|
44872
|
|
|
|
|
63032
|
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
|
|
|
|
|
183870
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
1498
|
|
|
|
|
2868
|
my $val = substr($self->{value}, 0, 20); |
33
|
1498
|
|
|
|
|
2027
|
local $Data::Dumper::Useqq = 1; |
34
|
1498
|
|
|
|
|
6533
|
$val = Data::Dumper->Dump([$val], ['val']); |
35
|
1498
|
|
|
|
|
57322
|
chomp $val; |
36
|
|
|
|
|
|
|
$str .= sprintf " - | %s", |
37
|
|
|
|
|
|
|
$self->start->{line}, $self->start->{column}, |
38
|
1498
|
|
|
|
|
3024
|
$self->end->{line}, $self->end->{column}, $val |
39
|
|
|
|
|
|
|
} |
40
|
46370
|
|
|
|
|
111184
|
return $str; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
2359
|
|
|
2359
|
0
|
2657
|
sub is_mapping_value($node, $parent) { |
|
2359
|
|
|
|
|
3035
|
|
|
2359
|
|
|
|
|
2755
|
|
|
2359
|
|
|
|
|
2655
|
|
44
|
2359
|
|
100
|
|
|
10138
|
return ($parent->{type} eq 'MAP' and not $node->{index} % 2); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
package YAML::Tidy::Node::Collection; |
48
|
6
|
50
|
|
6
|
|
2408
|
use constant DEBUG => $ENV{YAML_TIDY_DEBUG} ? 1 : 0; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
347
|
|
49
|
|
|
|
|
|
|
|
50
|
6
|
|
|
6
|
|
36
|
use base 'YAML::Tidy::Node'; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
7809
|
|
51
|
|
|
|
|
|
|
|
52
|
67903
|
|
|
67903
|
|
107310
|
sub is_collection { 1 } |
53
|
|
|
|
|
|
|
|
54
|
35911
|
|
|
35911
|
|
38162
|
sub indent($self) { |
|
35911
|
|
|
|
|
38528
|
|
|
35911
|
|
|
|
|
34144
|
|
55
|
35911
|
|
|
|
|
45632
|
my $firstevent = $self->open; |
56
|
35911
|
100
|
|
|
|
63720
|
if ($firstevent->{name} eq 'document_start_event') { |
57
|
7460
|
|
|
|
|
13627
|
return 0; |
58
|
|
|
|
|
|
|
} |
59
|
28451
|
|
|
|
|
35820
|
my $startcol = $firstevent->{end}->{column}; |
60
|
28451
|
|
|
|
|
44040
|
return $startcol; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
131921
|
|
|
131921
|
|
130999
|
sub open($self) { $self->{start} } |
|
131921
|
|
|
|
|
131225
|
|
|
131921
|
|
|
|
|
125224
|
|
|
131921
|
|
|
|
|
192781
|
|
64
|
76128
|
|
|
76128
|
|
77842
|
sub close($self) { $self->{end} } |
|
76128
|
|
|
|
|
76473
|
|
|
76128
|
|
|
|
|
70643
|
|
|
76128
|
|
|
|
|
112542
|
|
65
|
|
|
|
|
|
|
|
66
|
749
|
|
|
749
|
|
1007
|
sub sibling($self, $node, $diff) { |
|
749
|
|
|
|
|
887
|
|
|
749
|
|
|
|
|
862
|
|
|
749
|
|
|
|
|
887
|
|
|
749
|
|
|
|
|
845
|
|
67
|
749
|
50
|
|
|
|
1304
|
return unless $diff; |
68
|
749
|
|
|
|
|
1111
|
my $children = $self->{children}; |
69
|
|
|
|
|
|
|
# double check if $node is child of $parent |
70
|
749
|
50
|
|
|
|
1864
|
unless ("$children->[ $node->{index} - 1 ]" eq "$node") { |
71
|
0
|
|
|
|
|
0
|
die ">$node< is not a child of >$self<"; |
72
|
|
|
|
|
|
|
} |
73
|
749
|
|
|
|
|
1708
|
my $new_index = $node->{index} - 1 + $diff; |
74
|
749
|
50
|
33
|
|
|
3049
|
if ($new_index < 0 or $new_index > $#$children) { |
75
|
0
|
|
|
|
|
0
|
die "$new_index out of range for '$self'"; |
76
|
|
|
|
|
|
|
} |
77
|
749
|
|
|
|
|
1829
|
return $children->[ $new_index ]; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
13945
|
|
|
13945
|
|
15671
|
sub end($self) { |
|
13945
|
|
|
|
|
14945
|
|
|
13945
|
|
|
|
|
13640
|
|
82
|
13945
|
|
|
|
|
20434
|
return $self->close->{end}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
588
|
|
|
588
|
|
696
|
sub realendline($self) { |
|
588
|
|
|
|
|
712
|
|
|
588
|
|
|
|
|
685
|
|
86
|
588
|
|
|
|
|
1072
|
$self->close->{end}->{line} - 1; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
18819
|
|
|
18819
|
|
19795
|
sub start($self) { |
|
18819
|
|
|
|
|
20069
|
|
|
18819
|
|
|
|
|
19158
|
|
90
|
18819
|
|
|
|
|
28000
|
return $self->open->{start}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
10917
|
|
|
10917
|
|
12227
|
sub line($self) { |
|
10917
|
|
|
|
|
11361
|
|
|
10917
|
|
|
|
|
11066
|
|
94
|
|
|
|
|
|
|
|
95
|
10917
|
|
|
|
|
16908
|
my $contentstart = $self->contentstart; |
96
|
10917
|
|
|
|
|
16900
|
return $contentstart->{line}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
10917
|
|
|
10917
|
|
11237
|
sub contentstart($self) { |
|
10917
|
|
|
|
|
11562
|
|
|
10917
|
|
|
|
|
11138
|
|
100
|
10917
|
|
|
|
|
14820
|
my $firstevent = $self->open; |
101
|
10917
|
|
|
|
|
14847
|
return $firstevent->{end}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
786
|
|
|
786
|
|
1107
|
sub fix_node_indent($self, $fix) { |
|
786
|
|
|
|
|
995
|
|
|
786
|
|
|
|
|
959
|
|
|
786
|
|
|
|
|
905
|
|
105
|
786
|
|
|
|
|
1360
|
for my $e ($self->open, $self->close) { |
106
|
1572
|
|
|
|
|
2684
|
for my $pos (@$e{qw/ start end /}) { |
107
|
3144
|
|
|
|
|
4536
|
$pos->{column} += $fix; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
786
|
|
|
|
|
1087
|
for my $c (@{ $self->{children} }) { |
|
786
|
|
|
|
|
1451
|
|
111
|
1931
|
|
|
|
|
3217
|
$c->fix_node_indent($fix); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
6620
|
|
|
6620
|
|
7165
|
sub _move_columns($self, $line, $offset, $fix) { |
|
6620
|
|
|
|
|
6823
|
|
|
6620
|
|
|
|
|
6642
|
|
|
6620
|
|
|
|
|
6560
|
|
|
6620
|
|
|
|
|
6779
|
|
|
6620
|
|
|
|
|
6054
|
|
116
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": _move_columns $self $line $offset $fix\n"; |
117
|
6620
|
100
|
|
|
|
8976
|
return if $self->end->{line} < $line; |
118
|
5874
|
100
|
|
|
|
8924
|
return if $self->start->{line} > $line; |
119
|
4965
|
|
|
|
|
6776
|
for my $e ($self->open, $self->close) { |
120
|
9930
|
|
|
|
|
13955
|
for my $pos (@$e{qw/ start end /}) { |
121
|
19860
|
100
|
100
|
|
|
38471
|
if ($pos->{line} == $line and $pos->{column} >= $offset) { |
122
|
770
|
|
|
|
|
1136
|
$pos->{column} += $fix; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
4965
|
|
|
|
|
5321
|
for my $c (@{ $self->{children} }) { |
|
4965
|
|
|
|
|
7118
|
|
127
|
13544
|
|
|
|
|
20138
|
$c->_move_columns($line, $offset, $fix); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
3668
|
|
|
3668
|
|
3913
|
sub _fix_flow_indent($self, %args) { |
|
3668
|
|
|
|
|
3974
|
|
|
3668
|
|
|
|
|
5555
|
|
|
3668
|
|
|
|
|
3722
|
|
133
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": ========== _fix_flow_indent l=$line diff=$diff\n"; |
134
|
3668
|
|
|
|
|
4424
|
my $line = $args{line}; |
135
|
3668
|
|
|
|
|
4096
|
my $diff = $args{diff}; |
136
|
3668
|
|
|
|
|
5180
|
my $start = $self->open; |
137
|
3668
|
|
|
|
|
5367
|
my $end = $self->close; |
138
|
3668
|
|
|
|
|
6684
|
for my $pos ($start->{start}, $start->{end}, $end->{start}, $end->{end}) { |
139
|
14672
|
100
|
|
|
|
22983
|
if ($pos->{line} == $line) { |
140
|
3207
|
|
|
|
|
4252
|
$pos->{column} += $diff; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
} |
143
|
3668
|
|
|
|
|
3882
|
for my $c (@{ $self->{children} }) { |
|
3668
|
|
|
|
|
5732
|
|
144
|
7790
|
|
|
|
|
14422
|
$c->_fix_flow_indent(%args); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
3957
|
|
|
3957
|
|
4174
|
sub fix_lines($self, $startline, $diff) { |
|
3957
|
|
|
|
|
4325
|
|
|
3957
|
|
|
|
|
4235
|
|
|
3957
|
|
|
|
|
4046
|
|
|
3957
|
|
|
|
|
3982
|
|
149
|
3957
|
|
|
|
|
4948
|
my $start = $self->open; |
150
|
3957
|
|
|
|
|
4365
|
DEBUG and warn __PACKAGE__.':'.__LINE__.": ======== fix_lines $startline $diff ($self)\n"; |
151
|
3957
|
|
|
|
|
5410
|
my $end = $self->close; |
152
|
3957
|
|
|
|
|
6179
|
for my $pos ($start->{start}, $start->{end}) { |
153
|
7914
|
100
|
|
|
|
13235
|
if ($pos->{line} >= $startline) { |
154
|
3336
|
|
|
|
|
4407
|
$pos->{line} += $diff; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
} |
157
|
3957
|
|
|
|
|
5865
|
for my $pos ($end->{start}, $end->{end}) { |
158
|
7914
|
100
|
100
|
|
|
23201
|
if ($pos->{column} == 0 and $pos->{line} == $startline) { |
|
|
100
|
|
|
|
|
|
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
elsif ($pos->{line} >= $startline) { |
161
|
3846
|
|
|
|
|
5131
|
$pos->{line} += $diff; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
3957
|
|
|
|
|
4558
|
for my $c (@{ $self->{children} }) { |
|
3957
|
|
|
|
|
5900
|
|
165
|
7476
|
|
|
|
|
11249
|
$c->fix_lines($startline, $diff); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
package YAML::Tidy::Node::Scalar; |
170
|
6
|
50
|
|
6
|
|
43
|
use constant DEBUG => $ENV{YAML_TIDY_DEBUG} ? 1 : 0; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
339
|
|
171
|
6
|
|
|
|
|
384
|
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
|
|
2348
|
/; |
|
6
|
|
|
|
|
8067
|
|
177
|
|
|
|
|
|
|
|
178
|
6
|
|
|
6
|
|
37
|
use base 'YAML::Tidy::Node'; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
6107
|
|
179
|
|
|
|
|
|
|
|
180
|
29217
|
|
|
29217
|
|
59173
|
sub is_collection { 0 } |
181
|
|
|
|
|
|
|
|
182
|
707
|
|
|
707
|
|
921
|
sub is_quoted($self) { |
|
707
|
|
|
|
|
857
|
|
|
707
|
|
|
|
|
791
|
|
183
|
707
|
|
|
|
|
2764
|
return $self->{style} ne YAML_PLAIN_SCALAR_STYLE |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
18207
|
|
|
18207
|
|
18723
|
sub indent($self) { |
|
18207
|
|
|
|
|
19817
|
|
|
18207
|
|
|
|
|
18532
|
|
187
|
18207
|
|
|
|
|
23658
|
return $self->open->{column}; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
42525
|
|
|
42525
|
|
42996
|
sub start($self) { |
|
42525
|
|
|
|
|
43208
|
|
|
42525
|
|
|
|
|
43212
|
|
191
|
42525
|
|
|
|
|
53390
|
return $self->open; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
133611
|
|
|
133611
|
|
133289
|
sub open($self) { $self->{start} } |
|
133611
|
|
|
|
|
129811
|
|
|
133611
|
|
|
|
|
125995
|
|
|
133611
|
|
|
|
|
220031
|
|
195
|
106187
|
|
|
106187
|
|
104378
|
sub close($self) { $self->{end} } |
|
106187
|
|
|
|
|
104011
|
|
|
106187
|
|
|
|
|
102578
|
|
|
106187
|
|
|
|
|
176918
|
|
196
|
|
|
|
|
|
|
|
197
|
21633
|
|
|
21633
|
|
23206
|
sub end($self) { |
|
21633
|
|
|
|
|
23179
|
|
|
21633
|
|
|
|
|
22224
|
|
198
|
21633
|
|
|
|
|
27753
|
return $self->close; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
13114
|
|
|
13114
|
|
14207
|
sub realendline($self) { |
|
13114
|
|
|
|
|
13556
|
|
|
13114
|
|
|
|
|
12711
|
|
202
|
13114
|
|
|
|
|
17827
|
my $end = $self->close; |
203
|
13114
|
100
|
100
|
|
|
38862
|
if ($self->{style} == YAML_LITERAL_SCALAR_STYLE |
204
|
|
|
|
|
|
|
or $self->{style} == YAML_FOLDED_SCALAR_STYLE) { |
205
|
2494
|
100
|
|
|
|
5419
|
if ($end->{column} == 0) { |
206
|
2414
|
|
|
|
|
4960
|
return $end->{line} - 1; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
} |
209
|
10700
|
|
|
|
|
18091
|
$end->{line}; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
20670
|
|
|
20670
|
|
23333
|
sub line($self) { |
|
20670
|
|
|
|
|
21649
|
|
|
20670
|
|
|
|
|
21545
|
|
213
|
20670
|
|
|
|
|
31186
|
my $contentstart = $self->contentstart; |
214
|
20670
|
|
|
|
|
33502
|
return $contentstart->{line}; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
20670
|
|
|
20670
|
|
22215
|
sub contentstart($self) { |
|
20670
|
|
|
|
|
20875
|
|
|
20670
|
|
|
|
|
20123
|
|
218
|
20670
|
|
|
|
|
28379
|
return $self->start; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
22922
|
|
|
22922
|
|
25259
|
sub multiline($self) { |
|
22922
|
|
|
|
|
24338
|
|
|
22922
|
|
|
|
|
23272
|
|
222
|
22922
|
100
|
|
|
|
30465
|
if ($self->open->{line} < $self->close->{line}) { |
223
|
2930
|
|
|
|
|
9651
|
return 1; |
224
|
|
|
|
|
|
|
} |
225
|
19992
|
|
|
|
|
50376
|
return 0; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
23549
|
|
|
23549
|
|
25137
|
sub empty_scalar($self) { |
|
23549
|
|
|
|
|
25389
|
|
|
23549
|
|
|
|
|
23496
|
|
229
|
23549
|
|
|
|
|
30523
|
my ($start, $end) = ($self->open, $self->close); |
230
|
23549
|
100
|
100
|
|
|
70351
|
if ($start->{line} == $end->{line} and $start->{column} == $end->{column}) { |
231
|
551
|
|
|
|
|
1854
|
return 1; |
232
|
|
|
|
|
|
|
} |
233
|
22998
|
|
|
|
|
50176
|
return 0; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
1733
|
|
|
1733
|
|
1844
|
sub fix_node_indent($self, $fix) { |
|
1733
|
|
|
|
|
1924
|
|
|
1733
|
|
|
|
|
1874
|
|
|
1733
|
|
|
|
|
1718
|
|
237
|
1733
|
|
|
|
|
2577
|
for my $pos ($self->open, $self->close) { |
238
|
3466
|
|
|
|
|
5364
|
$pos->{column} += $fix; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
8240
|
|
|
8240
|
|
8738
|
sub _move_columns($self, $line, $offset, $fix) { |
|
8240
|
|
|
|
|
8685
|
|
|
8240
|
|
|
|
|
8208
|
|
|
8240
|
|
|
|
|
7961
|
|
|
8240
|
|
|
|
|
8234
|
|
|
8240
|
|
|
|
|
7773
|
|
243
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": _move_columns $self $line $offset $fix\n"; |
244
|
8240
|
100
|
|
|
|
10867
|
return if $self->end->{line} < $line; |
245
|
5276
|
100
|
|
|
|
10374
|
return if $self->start->{line} > $line; |
246
|
2673
|
|
|
|
|
3881
|
for my $pos ($self->open, $self->close) { |
247
|
5346
|
100
|
100
|
|
|
14715
|
if ($pos->{line} == $line and $pos->{column} >= $offset) { |
248
|
1402
|
|
|
|
|
2516
|
$pos->{column} += $fix; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
5236
|
|
|
5236
|
|
5285
|
sub _fix_flow_indent($self, %args) { |
|
5236
|
|
|
|
|
5450
|
|
|
5236
|
|
|
|
|
6425
|
|
|
5236
|
|
|
|
|
5510
|
|
254
|
5236
|
|
|
|
|
5875
|
my $line = $args{line}; |
255
|
5236
|
|
|
|
|
5807
|
my $diff = $args{diff}; |
256
|
|
|
|
|
|
|
# warn __PACKAGE__.':'.__LINE__.": ========== _fix_flow_indent l=$line diff=$diff\n"; |
257
|
5236
|
|
|
|
|
6997
|
for my $pos ($self->open, $self->close) { |
258
|
10472
|
100
|
|
|
|
20472
|
if ($pos->{line} == $line) { |
259
|
2989
|
|
|
|
|
6012
|
$pos->{column} += $diff; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
4500
|
|
|
4500
|
|
4558
|
sub fix_lines($self, $startline, $diff) { |
|
4500
|
|
|
|
|
4622
|
|
|
4500
|
|
|
|
|
4701
|
|
|
4500
|
|
|
|
|
4493
|
|
|
4500
|
|
|
|
|
4512
|
|
265
|
4500
|
|
|
|
|
4253
|
DEBUG and warn __PACKAGE__.':'.__LINE__.": ======== fix_lines $startline $diff ($self)\n"; |
266
|
4500
|
|
|
|
|
6378
|
for my $pos ($self->open) { |
267
|
4500
|
100
|
100
|
|
|
5989
|
if ($self->empty_scalar and $pos->{column} == 0 and $pos->{line} == $startline) { |
|
|
100
|
100
|
|
|
|
|
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
elsif ($pos->{line} >= $startline) { |
270
|
2178
|
|
|
|
|
3190
|
$pos->{line} += $diff; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
} |
273
|
4500
|
|
|
|
|
6300
|
for my $pos ($self->close) { |
274
|
4500
|
100
|
100
|
|
|
12666
|
if ($pos->{column} == 0 and $pos->{line} == $startline) { |
|
|
100
|
|
|
|
|
|
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
elsif ($pos->{line} >= $startline) { |
277
|
2178
|
|
|
|
|
4236
|
$pos->{line} += $diff; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
1; |