diff options
author | Tzafrir Cohen <tzafrir@cohens.org.il> | 2011-12-08 19:25:50 +0200 |
---|---|---|
committer | Tzafrir Cohen <tzafrir@cohens.org.il> | 2011-12-08 19:25:50 +0200 |
commit | 66d42272d2c3b040e6118d1a30d3ab45c1432468 (patch) | |
tree | fea52b07842d30d2bf6f0f724c9db1f4aba869ed | |
parent | ef48ff09e66d008e90c0994d9317b3b7a742eb35 (diff) |
menuselect: fix support_level and more
* Parsing <support_level> requires adding '_' to the regex.
* Parse attribute in the main tag and treat them the same as sub-tags.
* ' */' can also terminate MODULEINFO. Be more strict about the end.
(and make sure we don't get the terminating ' ***/' from the DOCUMENTATION
in app_macro.c).
-rwxr-xr-x | menuselect/menuselect | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/menuselect/menuselect b/menuselect/menuselect index 7e26a9c..993ab27 100755 --- a/menuselect/menuselect +++ b/menuselect/menuselect @@ -110,14 +110,23 @@ sub warning($) { # Convert XML syntax to mail-header-like syntax: # <var>value</var> --> Var: value sub extract_xml_key($) { + my %attr = (); my $xml_line = shift; if ($xml_line !~ m{^\s*<([a-z_A-Z0-9]+)(\s+([^>]*))?>([^<]*)</\1>}) { warning "parsed empty value from XML line $xml_line"; return ('', ''); # warn? } - my ($var, $val) = ($1, $2); + my ($var, $val) = ($1, $4); $var =~ s{^[a-z]}{\u$&}; - return ($var, $val); + if (defined $3) { + my $attr_text = $3; + while ($attr_text =~ /^( *([^=]+)="([^"]+)")/) { + my ($var, $val) = ($2, $3); + $attr_text =~ s/^$1//; + $attr{$var} = $val; + } + } + return ($var, $val, %attr); } # Get information embedded in source files from a subdirectory. @@ -141,14 +150,16 @@ sub get_subdir_module_info { ); while (<SRC>) { - next unless (m|^/\*\*\* MODULEINFO| .. m|^ ?\*\*\*/|); + next unless (m|^/\*\*\* MODULEINFO| .. m|^ *[*]+/|); next unless (m|^[A-Z]| || m|^\s*<|); # At this point we can assume we're in the module # info section. chomp; - my ($var, $val) = extract_xml_key($_); - + my ($var, $val, %attr) = extract_xml_key($_); + foreach (keys %attr) { + push @{$data{$_}},($attr{$_}); + } if ($var =~ /^(Depend|Use)$/i) { # use uppercase for dependency names; $val = uc($val); |