[svn-commits] tzafrir: trunk r973 - /trunk/contrib/menuselect-dummy

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Dec 8 11:34:47 CST 2011


Author: tzafrir
Date: Thu Dec  8 11:34:43 2011
New Revision: 973

URL: http://svnview.digium.com/svn/menuselect?view=rev&rev=973
Log:
menuselect-dummy: 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.
  (Make sure we don't get the terminating ' ***/' from the DOCUMENTATION
  in app_macro.c).

Modified:
    trunk/contrib/menuselect-dummy

Modified: trunk/contrib/menuselect-dummy
URL: http://svnview.digium.com/svn/menuselect/trunk/contrib/menuselect-dummy?view=diff&rev=973&r1=972&r2=973
==============================================================================
--- trunk/contrib/menuselect-dummy (original)
+++ trunk/contrib/menuselect-dummy Thu Dec  8 11:34:43 2011
@@ -110,14 +110,23 @@
 # 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-zA-Z0-9]*)>([^<]*)</\1>}) {
+	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 @@
 		);
 
 		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); 




More information about the svn-commits mailing list