Allow semi-colon on TYPEMAP: line to work without it on the closing delim.
authorMatthew Horsfall <wolfsage@gmail.com>
Thu, 12 Sep 2013 18:26:45 +0000 (14:26 -0400)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 12 Sep 2013 21:35:23 +0000 (14:35 -0700)
This means:

TYPEMAP: <<FOO;
Something T_IV
FOO

will now work.

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
dist/ExtUtils-ParseXS/t/002-more.t
dist/ExtUtils-ParseXS/t/XSMore.xs

index aeeaf24..8ac143e 100644 (file)
@@ -1702,7 +1702,7 @@ sub fetch_para {
     # which support a HEREdoc-alike block syntax.
     # This is special cased from the usual paragraph-handler logic
     # due to the HEREdoc-ish syntax.
-    if ($self->{lastline} =~ /^TYPEMAP\s*:\s*<<\s*(?:(["'])(.+?)\1|([^\s'"]+))\s*;?\s*$/) {
+    if ($self->{lastline} =~ /^TYPEMAP\s*:\s*<<\s*(?:(["'])(.+?)\1|([^\s'"]+?))\s*;?\s*$/) {
       my $end_marker = quotemeta(defined($1) ? $2 : $3);
       my @tmaplines;
       while (1) {
index 4178ec0..4849c39 100644 (file)
@@ -9,7 +9,7 @@ use ExtUtils::CBuilder;
 use attributes;
 use overload;
 
-plan tests => 28;
+plan tests => 29;
 
 my ($source_file, $obj_file, $lib_file);
 
@@ -95,6 +95,7 @@ SKIP: {
   is XSMore::typemaptest1(), 42, 'Simple embedded typemap works';
   is XSMore::typemaptest2(), 42, 'Simple embedded typemap works with funny end marker';
   is XSMore::typemaptest3(12, 13, 14), 12, 'Simple embedded typemap works for input, too';
+  is XSMore::typemaptest6(5), 5, '<<END; (with semicolon) matches delimiter "END"';
 
   # Win32 needs to close the DLL before it can unlink it, but unfortunately
   # dl_unload_file was missing on Win32 prior to perl change #24679!
index 322fc1d..21ad41d 100644 (file)
@@ -7,6 +7,7 @@ typedef IV MyType2;
 typedef IV MyType3;
 typedef IV MyType4;
 typedef IV MyType5;
+typedef IV MyType6;
 
 
 =for testing
@@ -99,6 +100,9 @@ T_WITHSEMICOLON
     $var = ($type)SvIV($arg); 
 END
 
+TYPEMAP: <<SEMICOLONHERE;
+MyType6        T_IV
+SEMICOLONHERE
 
 MyType
 typemaptest1()
@@ -126,6 +130,14 @@ typemaptest3(foo, bar, baz)
   OUTPUT:
     RETVAL
 
+MyType6
+typemaptest6(foo)
+    MyType6 foo
+  CODE:
+    RETVAL = foo;
+  OUTPUT:
+    RETVAL
+
 void
 prototype_ssa()
 PROTOTYPE: $$@