| 
     
      
      
      From: Martin Q. <mqu...@us...> - 2011-10-28 19:53:26
      
     
   | 
Update of /cvsroot/flexml/flexml
In directory vz-cvs-3.sog:/tmp/cvs-serv21618
Modified Files:
	ChangeLog flexml.pl 
Log Message:
Ensure that multiply defined attributes are detected
Index: flexml.pl
===================================================================
RCS file: /cvsroot/flexml/flexml/flexml.pl,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- flexml.pl	9 Nov 2007 13:38:20 -0000	1.64
+++ flexml.pl	28 Oct 2011 19:53:23 -0000	1.65
@@ -239,6 +239,7 @@
   for (keys %atttype) {
     if (m.($Nmtoken)[/]($Nmtoken).xo) {
       my ($tag,$attribute) = ($1,$2);
+      print "short int ${tagprefix}$ctag{$tag}_$catt{$attribute}_isset;\n";
       print "typedef $typeof{$_} AT_${tagprefix}$ctag{$tag}_$catt{$attribute};\n";
       print "#define AU_${tagprefix}$ctag{$tag}_$catt{$attribute} NULL\n"
 	if not $enumtype{$_};
@@ -1411,6 +1412,7 @@
 
 	for my $attribute (@myattributes) {
 	  print "  AX_${tagprefix}${myctag}_$catt{$attribute} = " . $initof{"$tag/$attribute"} . ";\n";
+	  print "  ${tagprefix}${myctag}_$catt{$attribute}_isset = 0;\n";
 	}
 	print "  ENTER(AL_${tagprefix}$myctag); pushbuffer(0);\n";
 	print "  }\n";
@@ -1470,8 +1472,8 @@
 	  else {
 
 	    # - (non-fixed non-literal) attribute: scan string with entity expansion.
-	    print " \"$attribute\"{Eq}\\' ENTER(VALUE1); BUFFERSET(AX_${tagprefix}${myctag}_$catt{$attribute});\n";
-	    print " \"$attribute\"{Eq}\\\" ENTER(VALUE2); BUFFERSET(AX_${tagprefix}${myctag}_$catt{$attribute});\n";
+	    print " \"$attribute\"{Eq}\\' if (${tagprefix}${myctag}_$catt{$attribute}_isset != 0) {FAIL(\"Multiple definition of attribute $attribute in <${tagprefix}${myctag}>\");} ${tagprefix}${myctag}_$catt{$attribute}_isset = 1; ENTER(VALUE1); BUFFERSET(AX_${tagprefix}${myctag}_$catt{$attribute});\n";
+	    print " \"$attribute\"{Eq}\\\" if (${tagprefix}${myctag}_$catt{$attribute}_isset != 0) {FAIL(\"Multiple definition of attribute $attribute in <${tagprefix}${myctag}>\");}  ${tagprefix}${myctag}_$catt{$attribute}_isset = 1; ENTER(VALUE2); BUFFERSET(AX_${tagprefix}${myctag}_$catt{$attribute});\n";
 
 	  }
 	  print "\n";
Index: ChangeLog
===================================================================
RCS file: /cvsroot/flexml/flexml/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ChangeLog	29 Sep 2006 19:02:30 -0000	1.2
+++ ChangeLog	28 Oct 2011 19:53:23 -0000	1.3
@@ -1,3 +1,8 @@
+2011-10-28  Martin Quinson <Mar...@lo...>
+
+	* Ensure that the generated parsers are robust to multiply
+	  defined attributes
+
 2006-09-29  William F. Dowling  <wil...@th...>
 
 	* Makefiles use INSTALL and MAKE variables, that play better with
 |