You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2011/10/13 23:32:53 UTC
svn commit: r1183115 - in /thrift/trunk: compiler/cpp/src/thriftl.ll
test/ThriftTest.thrift
Author: bryanduxbury
Date: Thu Oct 13 21:32:52 2011
New Revision: 1183115
URL: http://svn.apache.org/viewvc?rev=1183115&view=rev
Log:
THRIFT-1130. compiler: Add the ability to specify symbolic default value for optional boolean
Patch: Nevo Hed
Modified:
thrift/trunk/compiler/cpp/src/thriftl.ll
thrift/trunk/test/ThriftTest.thrift
Modified: thrift/trunk/compiler/cpp/src/thriftl.ll
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/thriftl.ll?rev=1183115&r1=1183114&r2=1183115&view=diff
==============================================================================
--- thrift/trunk/compiler/cpp/src/thriftl.ll (original)
+++ thrift/trunk/compiler/cpp/src/thriftl.ll Thu Oct 13 21:32:52 2011
@@ -110,6 +110,9 @@ literal_begin (['\"])
{symbol} { return yytext[0]; }
"*" { return yytext[0]; }
+"false" { yylval.iconst=0; return tok_int_constant; }
+"true" { yylval.iconst=1; return tok_int_constant; }
+
"namespace" { return tok_namespace; }
"cpp_namespace" { return tok_cpp_namespace; }
"cpp_include" { return tok_cpp_include; }
@@ -204,7 +207,6 @@ literal_begin (['\"])
"ensure" { thrift_reserved_keyword(yytext); }
"except" { thrift_reserved_keyword(yytext); }
"exec" { thrift_reserved_keyword(yytext); }
-"false" { thrift_reserved_keyword(yytext); }
"finally" { thrift_reserved_keyword(yytext); }
"float" { thrift_reserved_keyword(yytext); }
"for" { thrift_reserved_keyword(yytext); }
@@ -250,7 +252,6 @@ literal_begin (['\"])
"this" { thrift_reserved_keyword(yytext); }
"throw" { thrift_reserved_keyword(yytext); }
"transient" { thrift_reserved_keyword(yytext); }
-"true" { thrift_reserved_keyword(yytext); }
"try" { thrift_reserved_keyword(yytext); }
"undef" { thrift_reserved_keyword(yytext); }
"union" { thrift_reserved_keyword(yytext); }
Modified: thrift/trunk/test/ThriftTest.thrift
URL: http://svn.apache.org/viewvc/thrift/trunk/test/ThriftTest.thrift?rev=1183115&r1=1183114&r2=1183115&view=diff
==============================================================================
--- thrift/trunk/test/ThriftTest.thrift (original)
+++ thrift/trunk/test/ThriftTest.thrift Thu Oct 13 21:32:52 2011
@@ -226,3 +226,8 @@ struct ListBonks {
struct NestedListsBonk {
1: list<list<list<Bonk>>> bonk
}
+
+struct BoolTest {
+ 1: optional bool b = true;
+ 2: optional string s = "true";
+}