Update thrift compiler for new syntax, generate new form of C++ code
Reviewed By: wayne, he loves less warnings
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664840 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/globals.h b/compiler/cpp/src/globals.h
index 7385565..51502c7 100644
--- a/compiler/cpp/src/globals.h
+++ b/compiler/cpp/src/globals.h
@@ -1,7 +1,39 @@
#ifndef T_GLOBALS_H
#define T_GLOBALS_H
+#include <set>
+#include <queue>
+#include <stack>
+#include <vector>
+#include <string>
+
+/**
+ * This module contains all the global variables (slap on the wrist) that are
+ * shared throughout the program. The reason for this is to facilitate simple
+ * interaction between the parser and the rest of the program. Before calling
+ * yyparse(), the main.cc program will make necessary adjustments to these
+ * global variables such that the parser does the right thing and puts entries
+ * into the right containers, etc.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+
+/**
+ * Hooray for forward declaration of types!
+ */
+
class t_program;
+class t_scope;
+class t_type;
+
+/**
+ * Parsing mode, two passes up in this gin rummy!
+ */
+
+enum PARSE_MODE {
+ INCLUDES = 1,
+ PROGRAM = 2
+};
/**
* The master program parse tree. This is accessed from within the parser code
@@ -10,9 +42,37 @@
extern t_program* g_program;
/**
- * Global debug state
+ * Global types for the parser to be able to reference
*/
-extern int g_debug;
+
+extern t_type* g_type_void;
+extern t_type* g_type_string;
+extern t_type* g_type_bool;
+extern t_type* g_type_byte;
+extern t_type* g_type_i16;
+extern t_type* g_type_i32;
+extern t_type* g_type_i64;
+extern t_type* g_type_double;
+
+/**
+ * The scope that we are currently parsing into
+ */
+extern t_scope* g_scope;
+
+/**
+ * The parent scope to also load symbols into
+ */
+extern t_scope* g_parent_scope;
+
+/**
+ * The prefix for the parent scope entries
+ */
+extern std::string g_parent_prefix;
+
+/**
+ * The parsing pass that we are on. We do different things on each pass.
+ */
+extern PARSE_MODE g_parse_mode;
/**
* Global time string, used in formatting error messages etc.