- Make the Python generator use program->get_namespace("py")
instead of program->get_py_module()
- Eliminate the explicit "py_module" in t_program.
- Deprecate the py_module token.
- Update example .thrift files and syntax files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665615
13f79535-47bb-0310-9956-
ffa450edef68
std::string type_to_spec_args(t_type* ttype);
static std::string get_real_py_module(const t_program* program) {
- std::string real_module = program->get_py_module();
+ std::string real_module = program->get_namespace("py");
if (real_module.empty()) {
return program->get_name();
}
return ruby_namespace_;
}
- void set_py_module(std::string py_module) {
- py_module_ = py_module;
- }
-
- const std::string& get_py_module() const {
- return py_module_;
- }
-
void set_perl_package(std::string perl_package) {
perl_package_ = perl_package;
}
// Ruby namespace
std::string ruby_namespace_;
- // Python namespace
- std::string py_module_;
-
// Perl namespace
std::string perl_package_;
g_program->set_php_namespace($2);
}
}
+/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
| tok_py_module tok_identifier
{
+ pwarning(1, "'py_module' is deprecated. Use 'namespace py' instead");
pdebug("Header -> tok_py_module tok_identifier");
if (g_parse_mode == PROGRAM) {
- g_program->set_py_module($2);
+ g_program->set_namespace("py", $2);
}
}
| tok_perl_package tok_identifier
-py_module foo.bar.baz
+namespace py foo.bar.baz
struct astruct {
1: i32 how_unoriginal;
(defconst thrift-font-lock-keywords
(list
'("#.*$" . font-lock-comment-face) ;; perl style comments
- '("\\<\\(include\\|struct\\|exception\\|typedef\\|php_namespace\\|ruby_namespace\\|py_module\\|perl_package\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
+ '("\\<\\(include\\|struct\\|exception\\|typedef\\|php_namespace\\|ruby_namespace\\|perl_package\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
'("\\<\\(bool\\|byte\\|i16\\|i32\\|i64\\|double\\|string\\|binary\\|map\\|list\\|set\\)\\>" . font-lock-type-face) ;; built-in types
'("\\<\\([0-9]+\\)\\>" . font-lock-variable-name-face) ;; ordinals
'("\\<\\(\\w+\\)\\s-*(" (1 font-lock-function-name-face)) ;; functions
" Keywords
syn keyword thriftKeyword namespace
-syn keyword thriftKeyword php_namespace ruby_namespace py_module perl_package
+syn keyword thriftKeyword php_namespace ruby_namespace perl_package
syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_namespace xsd_attrs
syn keyword thriftKeyword include cpp_include cpp_type const optional required
syn keyword thriftBasicTypes void bool byte i16 i32 i64 double string binary