Merging Jake Luciani's latest perl code gen fixes
Reviewed By: dreiss
Test Plan: Watch for any weirdness on Thrift code gen, perl specific
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665206 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index e159ef0..38ca516 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -75,6 +75,7 @@
%token tok_cpp_include
%token tok_cpp_type
%token tok_php_namespace
+%token tok_perl_package
%token tok_java_package
%token tok_xsd_all
%token tok_xsd_optional
@@ -107,7 +108,7 @@
/**
* Function modifiers
- */
+ */
%token tok_async
/**
@@ -209,8 +210,7 @@
if (g_parse_mode == PROGRAM) {
$$ = g_doctext;
g_doctext = NULL;
- }
- else {
+ } else {
$$ = NULL;
}
}
@@ -269,6 +269,13 @@
g_program->set_php_namespace($2);
}
}
+| tok_perl_package tok_identifier
+ {
+ pdebug("Header -> tok_perl_namespace tok_identifier");
+ if (g_parse_mode == PROGRAM) {
+ g_program->set_perl_package($2);
+ }
+ }
| tok_ruby_namespace tok_identifier
{
pdebug("Header -> tok_ruby_namespace tok_identifier");
@@ -294,7 +301,7 @@
Include:
tok_include tok_literal
{
- pdebug("Include -> tok_include tok_literal");
+ pdebug("Include -> tok_include tok_literal");
if (g_parse_mode == INCLUDES) {
std::string path = include_file(std::string($2));
if (!path.empty()) {
@@ -379,7 +386,7 @@
}
}
| Xception
- {
+ {
pdebug("TypeDefinition -> Xception");
if (g_parse_mode == PROGRAM) {
g_program->add_xception($1);
@@ -536,7 +543,7 @@
| ConstMap
{
pdebug("ConstValue => ConstMap");
- $$ = $1;
+ $$ = $1;
}
ConstList:
@@ -780,7 +787,7 @@
FieldValue:
'=' ConstValue
{
- if (g_parse_mode == PROGRAM) {
+ if (g_parse_mode == PROGRAM) {
$$ = $2;
} else {
$$ = NULL;