Skip to content

Commit 8ace24a

Browse files
committed
ParseXS: refactor: inline _maybe_skip_pod()
(This commit is part of a series which will extend the AST parse tree from just representing individual XSUBs to representing the whole XS file.) Inline the one use of _maybe_skip_pod() into fetch_para().
1 parent d86a388 commit 8ace24a

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -508,23 +508,6 @@ sub Q {
508508
}
509509

510510

511-
# Skip any embedded POD sections, reading in lines from {in_fh} as necessary.
512-
513-
sub _maybe_skip_pod {
514-
my ExtUtils::ParseXS $self = shift;
515-
516-
while ($self->{lastline} =~ /^=/) {
517-
while ($self->{lastline} = readline($self->{in_fh})) {
518-
last if ($self->{lastline} =~ /^=cut\s*$/);
519-
}
520-
$self->death("Error: Unterminated pod") unless defined $self->{lastline};
521-
$self->{lastline} = readline($self->{in_fh});
522-
chomp $self->{lastline};
523-
$self->{lastline} =~ s/^\s+$//;
524-
}
525-
}
526-
527-
528511
# fetch_para(): private helper method for process_file().
529512
#
530513
# Read in all the lines associated with the next XSUB, or associated with
@@ -633,7 +616,20 @@ sub fetch_para {
633616
my $if_level = 0;
634617

635618
for (;;) {
636-
$self->_maybe_skip_pod;
619+
620+
# Skip any embedded POD sections, reading in lines from {in_fh} as
621+
# necessary.
622+
623+
while ($self->{lastline} =~ /^=/) {
624+
while ($self->{lastline} = readline($self->{in_fh})) {
625+
last if ($self->{lastline} =~ /^=cut\s*$/);
626+
}
627+
$self->death("Error: Unterminated pod")
628+
unless defined $self->{lastline};
629+
$self->{lastline} = readline($self->{in_fh});
630+
chomp $self->{lastline};
631+
$self->{lastline} =~ s/^\s+$//;
632+
}
637633

638634
# if present, extract out a TYPEMAP block as a paragraph
639635
if ($self->{lastline} =~ /^TYPEMAP\s*:/) {

0 commit comments

Comments
 (0)