summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Mueller <smueller@cpan.org>2013-04-15 07:59:28 +0200
committerSteffen Mueller <smueller@cpan.org>2013-06-25 08:00:24 +0200
commitaf3a4c14a1fd680991b78f47f538a57744c93103 (patch)
tree5ca4f3a59199677d7a654782c9835721619240fa
parente02e72da331b25be4c961af88dd7fa3469929cf3 (diff)
downloadperl-af3a4c14a1fd680991b78f47f538a57744c93103.tar.gz
EU::ParseXS: Only initialize some parser regexps once
-rw-r--r--dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm26
1 files changed, 14 insertions, 12 deletions
diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
index 22482f2b31..45cb4e571d 100644
--- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
+++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
@@ -156,18 +156,20 @@ sub process_file {
"|$END)\\s*:";
our ($C_group_rex, $C_arg);
- # Group in C (no support for comments or literals)
- $C_group_rex = qr/ [({\[]
- (?: (?> [^()\[\]{}]+ ) | (??{ $C_group_rex }) )*
- [)}\]] /x;
- # Chunk in C without comma at toplevel (no comments):
- $C_arg = qr/ (?: (?> [^()\[\]{},"']+ )
- | (??{ $C_group_rex })
- | " (?: (?> [^\\"]+ )
- | \\.
- )* " # String literal
- | ' (?: (?> [^\\']+ ) | \\. )* ' # Char literal
- )* /xs;
+ if (not defined $C_group_rex) {
+ # Group in C (no support for comments or literals)
+ $C_group_rex = qr/ [({\[]
+ (?: (?> [^()\[\]{}]+ ) | (??{ $C_group_rex }) )*
+ [)}\]] /x;
+ # Chunk in C without comma at toplevel (no comments):
+ $C_arg = qr/ (?: (?> [^()\[\]{},"']+ )
+ | (??{ $C_group_rex })
+ | " (?: (?> [^\\"]+ )
+ | \\.
+ )* " # String literal
+ | ' (?: (?> [^\\']+ ) | \\. )* ' # Char literal
+ )* /xs;
+ }
# Since at this point we're ready to begin printing to the output file and
# reading from the input file, I want to get as much data as possible into