- qr/^\s*PROGRAMS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
- => sub {
- if (!@skip || $skip[$#skip] > 0) {
- my @a = tokenize($1, qr|\s*,\s*|);
- my @p = tokenize($expand_variables->($2));
- push @programs, @p;
- foreach my $a (@a) {
- my $ak = $a;
- my $av = 1;
- if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
- $ak = $1;
- $av = $2;
- }
- foreach my $p (@p) {
- $attributes{$p}->{$ak} = $av;
- }
- }
- }
- },
- qr/^\s*LIBS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
- => sub {
- if (!@skip || $skip[$#skip] > 0) {
- my @a = tokenize($1, qr|\s*,\s*|);
- my @l = tokenize($expand_variables->($2));
- push @libraries, @l;
- foreach my $a (@a) {
- my $ak = $a;
- my $av = 1;
- if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
- $ak = $1;
- $av = $2;
- }
- foreach my $l (@l) {
- $attributes{$l}->{$ak} = $av;
- }
- }
- }
- },
- qr/^\s*MODULES(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
- => sub {
- if (!@skip || $skip[$#skip] > 0) {
- my @a = tokenize($1, qr|\s*,\s*|);
- my @m = tokenize($expand_variables->($2));
- push @modules, @m;
- foreach my $a (@a) {
- my $ak = $a;
- my $av = 1;
- if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
- $ak = $1;
- $av = $2;
- }
- foreach my $m (@m) {
- $attributes{$m}->{$ak} = $av;
- }
- }
- }
- },
- qr/^\s*SCRIPTS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
- => sub {
- if (!@skip || $skip[$#skip] > 0) {
- my @a = tokenize($1, qr|\s*,\s*|);
- my @s = tokenize($expand_variables->($2));
- push @scripts, @s;
- foreach my $a (@a) {
- my $ak = $a;
- my $av = 1;
- if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
- $ak = $1;
- $av = $2;
- }
- foreach my $s (@s) {
- $attributes{$s}->{$ak} = $av;
- }
- }
- }
- },
-
- qr/^\s*ORDINALS\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/,
- => sub { push @{$ordinals{$1}}, tokenize($expand_variables->($2))
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*SOURCE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
- => sub { push @{$sources{$1}}, tokenize($expand_variables->($2))
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*SHARED_SOURCE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
- => sub { push @{$shared_sources{$1}},
- tokenize($expand_variables->($2))
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*INCLUDE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
- => sub { push @{$includes{$1}}, tokenize($expand_variables->($2))
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*DEFINE\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
- => sub { push @{$defines{$1}}, tokenize($expand_variables->($2))
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*DEPEND\[((?:\\.|[^\\\]])*)\]\s*=\s*(.*)\s*$/
- => sub { push @{$depends{$1}}, tokenize($expand_variables->($2))
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*GENERATE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
- => sub { push @{$generate{$1}}, $2
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*(?:#.*)?$/ => sub { },
+ qr/^\s* PROGRAMS ${attribs_re} \s* = ${value_re} $/x
+ => sub { $push_to->(\@programs, undef,
+ \$attributes{programs}, $+{ATTRIBS},
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* LIBS ${attribs_re} \s* = ${value_re} $/x
+ => sub { $push_to->(\@libraries, undef,
+ \$attributes{libraries}, $+{ATTRIBS},
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* MODULES ${attribs_re} \s* = ${value_re} $/x
+ => sub { $push_to->(\@modules, undef,
+ \$attributes{modules}, $+{ATTRIBS},
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* SCRIPTS ${attribs_re} \s* = ${value_re} $/x
+ => sub { $push_to->(\@scripts, undef,
+ \$attributes{scripts}, $+{ATTRIBS},
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* HTMLDOCS ${index_re} = ${value_re} $/x
+ => sub { $push_to->(\%htmldocs, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* MANDOCS ${index_re} = ${value_re} $/x
+ => sub { $push_to->(\%mandocs, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* SOURCE ${index_re} = ${value_re} $/x
+ => sub { $push_to->(\%sources, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* SHARED_SOURCE ${index_re} = ${value_re} $/x
+ => sub { $push_to->(\%shared_sources, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* INCLUDE ${index_re} = ${value_re} $/x
+ => sub { $push_to->(\%includes, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* DEFINE ${index_re} = ${value_re} $/x
+ => sub { $push_to->(\%defines, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* DEPEND ${index_re} ${attribs_re} = ${value_re} $/x
+ => sub { $push_to->(\%depends, $expand_variables->($+{INDEX}),
+ \$attributes{depends}, $+{ATTRIBS},
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* GENERATE ${index_re} = ${value_re} $/x
+ => sub { $push_to->(\%generate, $expand_variables->($+{INDEX}),
+ undef, undef, $+{VALUE})
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* (?:\#.*)? $/x => sub { },