summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-24 20:56:59 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-24 20:56:59 +0000
commitee967902987e53ac432ef774a52079fd7af392af (patch)
tree2b81ab4dc1a5f194a3f157e9e9397fa96713254f
parent431610b726411f4a54eeeb5fe235a61651111c82 (diff)
downloadATCD-ee967902987e53ac432ef774a52079fd7af392af.tar.gz
ChangeLogTag: Tue Nov 24 20:54:20 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--modules/TAO/ChangeLog14
-rw-r--r--modules/TAO/TAO_IDL/fe/idl.yy60
-rw-r--r--modules/TAO/TAO_IDL/fe/y.tab.cpp5
-rw-r--r--modules/TAO/TAO_IDL/include/idl_global.h9
-rw-r--r--modules/TAO/TAO_IDL/include/utl_err.h5
-rw-r--r--modules/TAO/TAO_IDL/util/utl_err.cpp30
-rw-r--r--modules/TAO/TAO_IDL/util/utl_global.cpp33
7 files changed, 120 insertions, 36 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog
index f54094bdb9a..5e0093c6a9a 100644
--- a/modules/TAO/ChangeLog
+++ b/modules/TAO/ChangeLog
@@ -1,3 +1,17 @@
+Tue Nov 24 20:54:20 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/include/idl_global.h:
+ * TAO_IDL/include/utl_err.h:
+ * TAO_IDL/fe/y.tab.cpp:
+ * TAO_IDL/fe/idl.yy:
+ * TAO_IDL/util/utl_err.cpp:
+ * TAO_IDL/util/utl_global.cpp:
+
+ - Added check for mismatched 'sequence<xxx>' template param
+ - Updated parse state values
+ - Updated semantic action that creates a fixed module
+ - Added semantic action to create a template module
+
Tue Nov 24 18:32:54 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/ast/ast_param_holder.cpp:
diff --git a/modules/TAO/TAO_IDL/fe/idl.yy b/modules/TAO/TAO_IDL/fe/idl.yy
index 237fa414460..f5068f501cf 100644
--- a/modules/TAO/TAO_IDL/fe/idl.yy
+++ b/modules/TAO/TAO_IDL/fe/idl.yy
@@ -287,7 +287,8 @@ AST_Decl *tao_enum_constant_decl = 0;
%type <dcval> param_type_spec type_dcl type_declarator
%type <idlist> scoped_name interface_type component_inheritance_spec
-%type <idlist> home_inheritance_spec primary_key_spec
+%type <idlist> home_inheritance_spec primary_key_spec module_header
+%type <idlist> template_module_header
%type <slval> opt_context at_least_one_string_literal
%type <slval> string_literals formal_parameter_names
@@ -524,16 +525,23 @@ fixed_definition
module_header
: IDL_MODULE
{
-// module : IDL_MODULE
+// module_header : IDL_MODULE
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen);
}
scoped_name
{
-// UTL_ScopedName n ($3, 0);
- AST_Module *m = 0;
- UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ $<idlist>$ = $3;
+ }
+ ;
+fixed_module
+ : module_header
+ {
+// fixed_module : module_header
idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen);
+ // Check that scoped name contains no delimitor.
+ AST_Module *m = 0;
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
/*
* Make a new module and add it to the enclosing scope
@@ -541,7 +549,7 @@ module_header
if (s != 0)
{
m = idl_global->gen ()->create_module (s,
- $3);
+ $1);
(void) s->fe_add_module (m);
}
@@ -550,14 +558,6 @@ module_header
*/
idl_global->scopes ().push (m);
}
- ;
-
-fixed_module
- : module_header
- {
-// fixed_module : module_header
- // Check that scoped name contains no delimitor.
- }
'{'
{
// '{'
@@ -581,6 +581,9 @@ fixed_module
template_module_header
: module_header '<'
+ {
+ idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleIDSeen);
+ }
;
template_module
@@ -595,17 +598,37 @@ template_module
'>'
{
// '>'
-// idl_global->set_parse_state (IDL_GlobalData::PS_TmplInterfaceQsSeen);
-// $<plval>$ = $4;
+ idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleParamsSeen);
+
+ AST_Template_Module *tm =
+ idl_global->gen ()->create_template_module ($1,
+ $3);
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ $1);
+ (void) s->fe_add_module (tm);
+
+ /*
+ * Push it on the stack
+ */
+ idl_global->scopes ().push (tm);
}
'{'
{
+ idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleSqSeen);
}
at_least_one_tpl_definition
{
+ idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleBodySeen);
}
'}'
{
+ idl_global->set_parse_state (IDL_GlobalData::PS_TmplModuleQsSeen);
+
+ /*
+ * Finished with this module - pop it from the scope stack.
+ */
+ idl_global->scopes ().pop ();
}
;
@@ -5999,9 +6022,8 @@ formal_parameters
delete $1;
$1 = 0;
- // TODO - create a specific utl_err msg.
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("bad param\n")));
+ idl_global->err ()->mismatch_seq_of_param (
+ $4->name_.c_str ());
}
delete $4;
diff --git a/modules/TAO/TAO_IDL/fe/y.tab.cpp b/modules/TAO/TAO_IDL/fe/y.tab.cpp
index 8a6f8f0370a..db685305acf 100644
--- a/modules/TAO/TAO_IDL/fe/y.tab.cpp
+++ b/modules/TAO/TAO_IDL/fe/y.tab.cpp
@@ -8865,9 +8865,8 @@ tao_yyreduce:
delete (tao_yyvsp[(1) - (4)].plval);
(tao_yyvsp[(1) - (4)].plval) = 0;
- // TODO - create a specific utl_err msg.
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("bad param\n")));
+ idl_global->err ()->mismatch_seq_of_param (
+ (tao_yyvsp[(4) - (4)].pival)->name_.c_str ());
}
delete (tao_yyvsp[(4) - (4)].pival);
diff --git a/modules/TAO/TAO_IDL/include/idl_global.h b/modules/TAO/TAO_IDL/include/idl_global.h
index 7fd398473aa..2b9f04599c3 100644
--- a/modules/TAO/TAO_IDL/include/idl_global.h
+++ b/modules/TAO/TAO_IDL/include/idl_global.h
@@ -106,7 +106,6 @@ public:
, PS_ConstDeclSeen // Seen complete const declaration
, PS_ExceptDeclSeen // Seen complete exception declaration
, PS_InterfaceDeclSeen // Seen complete interface declaration
- , PS_TmplInterfaceDeclSeen // Seen complete template interface declaration
, PS_ModuleDeclSeen // Seen complete module declaration
, PS_ValueTypeDeclSeen // Seen complete valuetype declaration
, PS_ComponentDeclSeen // Seen complete component declaration
@@ -144,9 +143,11 @@ public:
, PS_InterfaceSqSeen // '{' seen for interface
, PS_InterfaceQsSeen // '}' seen for interface
, PS_InterfaceBodySeen // Seen an interface body
- , PS_TmplInterfaceSqSeen // '{' seen for template interface
- , PS_TmplInterfaceQsSeen // '}' seen for template interface
- , PS_TmplInterfaceBodySeen // Seen a template interface body
+ , PS_TmplModuleIDSeen // Seen the template module ID
+ , PS_TmplModuleParamsSeen // Seen template module params
+ , PS_TmplModuleSqSeen // '{' seen for template module
+ , PS_TmplModuleQsSeen // '}' seen for template module
+ , PS_TmplModuleBodySeen // Seen a template module body
, PS_ValueTypeSeen // Seen a VALUETYPE keyword
, PS_ValueTypeForwardSeen // Forward valuetype decl seen
, PS_ValueTypeIDSeen // Seen the valuetype ID
diff --git a/modules/TAO/TAO_IDL/include/utl_err.h b/modules/TAO/TAO_IDL/include/utl_err.h
index 0bf7d2b121e..c7f9df5d415 100644
--- a/modules/TAO/TAO_IDL/include/utl_err.h
+++ b/modules/TAO/TAO_IDL/include/utl_err.h
@@ -147,6 +147,7 @@ public:
EIDL_MISMATCHED_T_PARAM, // Between defined & referenced template interfaces
EIDL_DUPLICATE_T_PARAM, // A template interface's param ids must be unique
EIDL_T_ARG_LENGTH, // Wrong # of template args
+ EIDL_MISMATCHED_SEQ_PARAM, // 'sequence<T> must match a previous param
EIDL_OK // No error
};
@@ -352,6 +353,10 @@ public:
// Referenced template parameter not matched in param list.
void mismatched_template_param (UTL_ScopedName *n);
+
+ // Given a template param of the form 'sequence<T>', the
+ // 'T' must match a previous param in the list.
+ void mismatch_seq_of_param (const char *param_id);
};
#endif // _UTL_ERR_UTL_ERR_HH
diff --git a/modules/TAO/TAO_IDL/util/utl_err.cpp b/modules/TAO/TAO_IDL/util/utl_err.cpp
index 539da979ef1..1dc2dcf20c2 100644
--- a/modules/TAO/TAO_IDL/util/utl_err.cpp
+++ b/modules/TAO/TAO_IDL/util/utl_err.cpp
@@ -229,6 +229,8 @@ error_string (UTL_Error::ErrorCode c)
return "duplicate template parameter id";
case UTL_Error::EIDL_T_ARG_LENGTH:
return "wrong # of template args";
+ case UTL_Error::EIDL_MISMATCHED_SEQ_PARAM:
+ return "no match for identifier";
}
return 0;
@@ -312,8 +314,6 @@ parse_state_to_error_message (IDL_GlobalData::ParseState ps)
return "Malformed exception declaration";
case IDL_GlobalData::PS_InterfaceDeclSeen:
return "Malformed interface declaration";
- case IDL_GlobalData::PS_TmplInterfaceDeclSeen:
- return "Malformed template interface declaration";
case IDL_GlobalData::PS_ValueTypeDeclSeen:
return "Malformed value type declaration";
case IDL_GlobalData::PS_ComponentDeclSeen:
@@ -388,12 +388,16 @@ parse_state_to_error_message (IDL_GlobalData::ParseState ps)
return "Illegal syntax following interface '}' closer";
case IDL_GlobalData::PS_InterfaceBodySeen:
return "Illegal syntax following interface body statement(s)";
- case IDL_GlobalData::PS_TmplInterfaceSqSeen:
- return "Illegal syntax or missing type following '<' in template interface";
- case IDL_GlobalData::PS_TmplInterfaceQsSeen:
- return "Illegal syntax or missing type following '>' in template interface";
- case IDL_GlobalData::PS_TmplInterfaceBodySeen:
- return "Illegal syntax following template interface body statement(s)";
+ case IDL_GlobalData::PS_TmplModuleIDSeen:
+ return "Illegal syntax following '<' in template module";
+ case IDL_GlobalData::PS_TmplModuleParamsSeen:
+ return "Illegal syntax following '>' in template module";
+ case IDL_GlobalData::PS_TmplModuleSqSeen:
+ return "Illegal syntax or missing type following '{' in template module";
+ case IDL_GlobalData::PS_TmplModuleQsSeen:
+ return "Illegal syntax or missing type following '}' in template module";
+ case IDL_GlobalData::PS_TmplModuleBodySeen:
+ return "Illegal syntax following template module body statement(s)";
case IDL_GlobalData::PS_ValueTypeSeen:
return "Missing interface identifier following VALUETYPE keyword";
case IDL_GlobalData::PS_ValueTypeForwardSeen:
@@ -1490,3 +1494,13 @@ UTL_Error::mismatched_template_param (UTL_ScopedName *n)
idl_global->set_err_count (idl_global->err_count () + 1);
}
+void
+UTL_Error::mismatch_seq_of_param (const char *param_id)
+{
+ idl_error_header (EIDL_MISMATCHED_SEQ_PARAM,
+ idl_global->lineno (),
+ idl_global->filename ()->get_string ());
+ ACE_ERROR ((LM_ERROR, " - %s", param_id));
+ ACE_ERROR ((LM_ERROR, "\n"));
+ idl_global->set_err_count (idl_global->err_count () + 1);
+} \ No newline at end of file
diff --git a/modules/TAO/TAO_IDL/util/utl_global.cpp b/modules/TAO/TAO_IDL/util/utl_global.cpp
index 63effc9899d..45583d32f2c 100644
--- a/modules/TAO/TAO_IDL/util/utl_global.cpp
+++ b/modules/TAO/TAO_IDL/util/utl_global.cpp
@@ -1799,8 +1799,37 @@ bool
IDL_GlobalData::check_for_seq_of_param (FE_Utils::T_PARAMLIST_INFO *list,
FE_Utils::T_Param_Info *param)
{
- // TODO
- return true;
+ ACE_CString id;
+ const char *pattern = "sequence<";
+ size_t len = ACE_OS::strlen (pattern);
+
+ if (param->name_.find (pattern) == 0)
+ {
+ // Get the substring of what's between the brackets.
+ // It will have to match a previous param in the list.
+ id = param->name_.substr (len,
+ param->name_.length () - (len + 1));
+ }
+ else
+ {
+ // No check to make.
+ return true;
+ }
+
+ for (FE_Utils::T_PARAMLIST_INFO::CONST_ITERATOR i (*list);
+ !i.done ();
+ i.advance ())
+ {
+ FE_Utils::T_Param_Info *info = 0;
+ i.next (info);
+
+ if (info->name_ == id)
+ {
+ return true;
+ }
+ }
+
+ return false;
}
void