Skip to content

Commit fc392db

Browse files
committed
ParseXS: refactor: chomp TYPEMAP lines
(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.) For consistency with everything else in fetch_para(), chomp any lines extracted from a TYPEMAP section before stuffing them in @{$pxs->{line}}. Later, make Node::TYPEMAP::parse() stick a newline back on each line before passing them to the typemap parser.
1 parent a83466f commit fc392db

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ sub fetch_para {
655655
last if $last;
656656
$self->death("Error: Unterminated TYPEMAP section")
657657
unless defined $self->{lastline};
658+
chomp $self->{lastline};
658659
$last = $self->{lastline} =~ /^$end_marker\s*$/;
659660
}
660661
return 1;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ sub parse {
14101410
$pxs->{line} = [];
14111411

14121412
my $tmap = ExtUtils::Typemaps->new(
1413-
string => join("", @{$self->{lines}}),
1413+
string => join("", map "$_\n", @{$self->{lines}}),
14141414
lineno_offset => 1 + ($pxs->current_line_number() || 0),
14151415
fake_filename => $pxs->{in_filename},
14161416
);

0 commit comments

Comments
 (0)