From 66d42272d2c3b040e6118d1a30d3ab45c1432468 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Thu, 8 Dec 2011 19:25:50 +0200 Subject: menuselect: fix support_level and more * Parsing 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). --- menuselect/menuselect | 21 ++++++++++++++++----- 1 file 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: # value --> Var: value sub extract_xml_key($) { + my %attr = (); my $xml_line = shift; if ($xml_line !~ m{^\s*<([a-z_A-Z0-9]+)(\s+([^>]*))?>([^<]*)}) { 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 () { - 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); -- cgit v1.2.3