Thrift compiler frontend support for constants
Summary: The parser now accepts constants and adds them into the parse tree
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664880 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index a3270ad..b0eb60e 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -12,6 +12,7 @@
#include "t_base_type.h"
#include "t_typedef.h"
#include "t_enum.h"
+#include "t_const.h"
#include "t_struct.h"
#include "t_service.h"
#include "t_list.h"
@@ -24,6 +25,7 @@
*
* Typedefs
* Enumerations
+ * Constants
* Structs
* Exceptions
* Services
@@ -58,6 +60,7 @@
// Accessors for program elements
const std::vector<t_typedef*>& get_typedefs() const { return typedefs_; }
const std::vector<t_enum*>& get_enums() const { return enums_; }
+ const std::vector<t_const*>& get_consts() const { return consts_; }
const std::vector<t_struct*>& get_structs() const { return structs_; }
const std::vector<t_struct*>& get_xceptions() const { return xceptions_; }
const std::vector<t_service*>& get_services() const { return services_; }
@@ -65,6 +68,7 @@
// Program elements
void add_typedef (t_typedef* td) { typedefs_.push_back(td); }
void add_enum (t_enum* te) { enums_.push_back(te); }
+ void add_const (t_const* tc) { consts_.push_back(tc); }
void add_struct (t_struct* ts) { structs_.push_back(ts); }
void add_xception (t_struct* tx) { xceptions_.push_back(tx); }
void add_service (t_service* ts) { services_.push_back(ts); }
@@ -139,6 +143,7 @@
// Components to generate code for
std::vector<t_typedef*> typedefs_;
std::vector<t_enum*> enums_;
+ std::vector<t_const*> consts_;
std::vector<t_struct*> structs_;
std::vector<t_struct*> xceptions_;
std::vector<t_service*> services_;