Thrift support for the xsd_nillable attribute
Reviewed By: dave
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664981 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index a53d002..c1d383b 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -70,6 +70,7 @@
%token tok_java_package
%token tok_xsd_all
%token tok_xsd_optional
+%token tok_xsd_nillable
%token tok_xsd_namespace
%token tok_xsd_attrs
@@ -155,6 +156,7 @@
%type<tbool> Async
%type<tbool> XsdAll
%type<tbool> XsdOptional
+%type<tbool> XsdNillable
%type<id> XsdAttributes
%type<id> CppType
@@ -517,6 +519,16 @@
$$ = false;
}
+XsdNillable:
+ tok_xsd_nillable
+ {
+ $$ = true;
+ }
+|
+ {
+ $$ = false;
+ }
+
XsdAttributes:
tok_xsd_attrs tok_identifier
{
@@ -631,7 +643,7 @@
}
Field:
- DocTextOptional FieldIdentifier FieldType tok_identifier FieldValue XsdOptional XsdAttributes CommaOrSemicolonOptional
+ DocTextOptional FieldIdentifier FieldType tok_identifier FieldValue XsdOptional XsdNillable XsdAttributes CommaOrSemicolonOptional
{
pdebug("tok_int_constant : Field -> FieldType tok_identifier");
if ($2 < 0) {
@@ -643,11 +655,12 @@
$$->set_value($5);
}
$$->set_xsd_optional($6);
+ $$->set_xsd_nillable($7);
if ($1 != NULL) {
$$->set_doc($1);
}
- if ($7 != NULL) {
- $$->add_xsd_attr($7);
+ if ($8 != NULL) {
+ $$->add_xsd_attr($8);
}
}