From: David Reiss Date: Mon, 27 Jul 2009 17:02:42 +0000 (+0000) Subject: THRIFT-413. Suppport for annotations on base types X-Git-Tag: 0.2.0~60 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=c8e300533cc9d12ecb2325ec89b581647cb7707e;p=common%2Fthrift.git THRIFT-413. Suppport for annotations on base types git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@798219 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy index bf5408e3..026e5c3a 100644 --- a/compiler/cpp/src/thrifty.yy +++ b/compiler/cpp/src/thrifty.yy @@ -154,6 +154,7 @@ int g_arglist = 0; */ %type BaseType +%type SimpleBaseType %type ContainerType %type SimpleContainerType %type MapType @@ -976,7 +977,19 @@ FieldType: $$ = $1; } -BaseType: +BaseType: SimpleBaseType TypeAnnotations + { + pdebug("BaseType -> SimpleBaseType TypeAnnotations"); + if ($2 != NULL) { + $$ = new t_base_type(*static_cast($1)); + $$->annotations_ = $2->annotations_; + delete $2; + } else { + $$ = $1; + } + } + +SimpleBaseType: tok_string { pdebug("BaseType -> tok_string"); diff --git a/test/AnnotationTest.thrift b/test/AnnotationTest.thrift index dcc41b0b..ef9ba13a 100644 --- a/test/AnnotationTest.thrift +++ b/test/AnnotationTest.thrift @@ -29,3 +29,6 @@ struct foo { python.type = "DenseFoo", java.final = "", ) + +typedef string ( unicode.encoding = "UTF-16" ) non_latin_string +typedef list< double ( cpp.fixed_point = "16" ) > tiny_float_list