Thrift: Allow whole program doctext.

Summary:
Allow docstrings at the top of the program.

Blame Rev: 52687

Reviewed By: mcslee

Test Plan:
../compiler/cpp/thrift -cpp DocTest.thrift
(with dump_docs on)
and looked at the output.
Generated C++ is identical to installed thrift.

Revert Plan: Do 52687 also.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665183 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index 68384be..1ad0c35 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -186,9 +186,12 @@
  */
 
 Program:
-  HeaderList DefinitionList
+  DocTextOptional HeaderList DefinitionList
     {
       pdebug("Program -> Headers DefinitionList");
+      if ($1 != NULL) {
+        g_program->set_doc($1);
+      }
     }
 
 HeaderList: