Add PHP namespacing support to Thrift

Summary: "php_namespace Whoa" at the top of your Thrift file, then all your defined class names start with "Whoa_"

Reviewed By: aditya


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664908 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrift.y b/compiler/cpp/src/thrift.y
index 9dee535..8dbe621 100644
--- a/compiler/cpp/src/thrift.y
+++ b/compiler/cpp/src/thrift.y
@@ -64,6 +64,7 @@
 %token tok_cpp_namespace
 %token tok_cpp_include
 %token tok_cpp_type
+%token tok_php_namespace
 %token tok_java_package
 
 /**
@@ -198,6 +199,13 @@
         g_program->add_cpp_include($2);
       }
     }
+| tok_php_namespace tok_identifier
+    {
+      pdebug("Header -> tok_php_namespace tok_identifier");
+      if (g_parse_mode == PROGRAM) {
+        g_program->set_php_namespace($2);
+      }
+    }
 | tok_java_package tok_identifier
     {
       pdebug("Header -> tok_java_package tok_identifier");