Adding XSD attribute support

Reviewed By: dave


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664974 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index 9c38996..a53d002 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -71,6 +71,7 @@
 %token tok_xsd_all
 %token tok_xsd_optional
 %token tok_xsd_namespace
+%token tok_xsd_attrs
 
 /**
  * Base datatype keywords
@@ -154,6 +155,7 @@
 %type<tbool>     Async
 %type<tbool>     XsdAll
 %type<tbool>     XsdOptional
+%type<id>        XsdAttributes
 %type<id>        CppType
 
 %type<tdoc>      DocTextOptional
@@ -515,6 +517,16 @@
       $$ = false;
     }
 
+XsdAttributes:
+  tok_xsd_attrs tok_identifier
+    {
+      $$ = $2;
+    }
+|
+    {
+      $$ = NULL;
+    }
+
 Xception:
   tok_xception tok_identifier '{' FieldList '}'
     {
@@ -619,11 +631,11 @@
     }
 
 Field:
-  DocTextOptional FieldIdentifier FieldType tok_identifier FieldValue XsdOptional CommaOrSemicolonOptional
+  DocTextOptional FieldIdentifier FieldType tok_identifier FieldValue XsdOptional XsdAttributes CommaOrSemicolonOptional
     {
       pdebug("tok_int_constant : Field -> FieldType tok_identifier");
       if ($2 < 0) {
-        pwarning(2, "No field key specified for %s, resulting protocol may have conflicts or not be backwards compatible!\n", $3);
+        pwarning(2, "No field key specified for %s, resulting protocol may have conflicts or not be backwards compatible!\n", $4);
       }
       $$ = new t_field($3, $4, $2);
       if ($5 != NULL) {
@@ -634,6 +646,9 @@
       if ($1 != NULL) {
         $$->set_doc($1);
       }
+      if ($7 != NULL) {
+        $$->add_xsd_attr($7);
+      }
     }
 
 FieldIdentifier: