THRIFT-1130. compiler: Add the ability to specify symbolic default value for optional boolean

Patch: Nevo Hed

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1183115 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index af033d6..ab0976e 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -110,6 +110,9 @@
 {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 @@
 "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 @@
 "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); }
diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift
index 17b0295..51f42b4 100644
--- a/test/ThriftTest.thrift
+++ b/test/ThriftTest.thrift
@@ -226,3 +226,8 @@
 struct NestedListsBonk {
   1: list<list<list<Bonk>>> bonk
 }
+
+struct BoolTest {
+  1: optional bool b = true;
+  2: optional string s = "true";
+}