diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-10-25 15:07:31 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-10-25 15:07:31 +0000 |
commit | ec3dcf5091a86cbc2f22d833e83a64bc2afe2e98 (patch) | |
tree | ddef3b4290a56a6b8104c9105af36397316d08b7 | |
parent | 979ec917f307b882ce087914a0f1c81a143cb953 (diff) | |
download | ATCD-ec3dcf5091a86cbc2f22d833e83a64bc2afe2e98.tar.gz |
ChangeLogTag: Wed Oct 25 14:54:03 UTC 2006 Boris Kolpackov <boris@codesynthesis.com>
-rw-r--r-- | CIAO/CCF/CCF/CIDL/Parser.cpp | 165 | ||||
-rw-r--r-- | CIAO/CCF/CCF/CIDL/Parser.hpp | 3 | ||||
-rw-r--r-- | CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp | 6 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL2/Parser.cpp | 1742 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL2/Parser.hpp | 6 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp | 37 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp | 4 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL3/Parser.cpp | 1001 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL3/Parser.hpp | 4 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL3/SemanticAction/Component.hpp | 6 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp | 6 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL3/SemanticAction/Home.hpp | 6 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.cpp | 2 | ||||
-rw-r--r-- | CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.cpp | 2 | ||||
-rw-r--r-- | CIAO/ChangeLog | 22 |
15 files changed, 2321 insertions, 691 deletions
diff --git a/CIAO/CCF/CCF/CIDL/Parser.cpp b/CIAO/CCF/CCF/CIDL/Parser.cpp index ae99e2428b0..790410f3921 100644 --- a/CIAO/CCF/CCF/CIDL/Parser.cpp +++ b/CIAO/CCF/CCF/CIDL/Parser.cpp @@ -13,6 +13,9 @@ namespace CCF { namespace CIDL { + using IDL2::Parsing::DiagnosticType; + using IDL2::Parsing::RecoveryMethod; + Parser:: Parser (CompilerElements::Context& context, Diagnostic::Stream& dout, @@ -70,16 +73,61 @@ namespace CCF // Composition // composition_decl = - composition_header - >> LCBRACE[act_composition_open_scope] - >> home_executor_decl - >> RCBRACE[act_composition_close_scope] - >> SEMI[act_composition_end] - ; - - composition_header = COMPOSITION - >> (composition_category >> simple_identifier)[act_composition_begin] + >> guard + ( + ( + assertion ("composition category expected", + DiagnosticType::BEFORE) + ( + composition_category + ) + >> assertion ("composition name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) + )[act_composition_begin] + + >> assertion ("'{' expected", + f.composition (), + &SemanticAction::Composition::end) + ( + LCBRACE[act_composition_open_scope] + ) + + >> assertion ("home executor declaration expected", + f.composition (), + &SemanticAction::Composition::close_scope, + &SemanticAction::Composition::end, + DiagnosticType::BEFORE) + ( + hood (home_executor_decl) + [ + handler (f.composition (), + &SemanticAction::Composition::close_scope, + &SemanticAction::Composition::end) + ] + ) + + >> assertion ("'}' expected", + f.composition (), + &SemanticAction::Composition::close_scope, + &SemanticAction::Composition::end, + DiagnosticType::BEFORE) + ( + RCBRACE[act_composition_close_scope] + ) + + >> assertion ("';' expected", + f.composition (), + &SemanticAction::Composition::end, + RecoveryMethod::NONE) + ( + SEMI[act_composition_end] + ) + + )[error_handler] ; composition_category = @@ -89,34 +137,105 @@ namespace CCF | SESSION ; + // // Home executor // home_executor_decl = - home_executor_header - >> LCBRACE - >> home_executor_home_impl_decl - >> home_executor_executor_decl - >> RCBRACE - >> SEMI[act_home_executor_end] - ; - - home_executor_header = HOME >> EXECUTOR - >> simple_identifier[act_home_executor_begin] + >> guard + ( + assertion ("home executor name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_home_executor_begin] + ) + + >> assertion ("'{' expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end) + ( + LCBRACE + ) + + >> assertion ("implements declaration expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + DiagnosticType::BEFORE) + ( + hood (home_executor_home_impl_decl) + [ + handler (f.home_executor (), + &SemanticAction::HomeExecutor::end) + ] + ) + + >> assertion ("manages declaration expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + DiagnosticType::BEFORE) + ( + hood (home_executor_executor_decl) + [ + handler (f.home_executor (), + &SemanticAction::HomeExecutor::end) + ] + ) + + >> assertion ("'}' expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + DiagnosticType::BEFORE) + ( + RCBRACE + ) + + >> assertion ("';' expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + RecoveryMethod::NONE) + ( + SEMI[act_home_executor_end] + ) + + )[error_handler] ; + home_executor_home_impl_decl = IMPLEMENTS - >> identifier[act_home_executor_implements] - >> SEMI + >> guard + ( + assertion ("home name expected", + DiagnosticType::BEFORE) + ( + identifier[act_home_executor_implements] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; + home_executor_executor_decl = MANAGES - >> simple_identifier[act_home_executor_manages] - >> SEMI + >> guard + ( + assertion ("executor name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_home_executor_manages] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; } } diff --git a/CIAO/CCF/CCF/CIDL/Parser.hpp b/CIAO/CCF/CCF/CIDL/Parser.hpp index 565057a4461..719f97f184d 100644 --- a/CIAO/CCF/CCF/CIDL/Parser.hpp +++ b/CIAO/CCF/CCF/CIDL/Parser.hpp @@ -47,13 +47,10 @@ namespace CCF // Composition Rule composition_decl; - Rule composition_header; Rule composition_category; // Home executor Rule home_executor_decl; - Rule home_executor_header; - Rule home_executor_body; Rule home_executor_home_impl_decl; Rule home_executor_executor_decl; diff --git a/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp b/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp index 71cfc22a108..8c46b83326c 100644 --- a/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp +++ b/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp @@ -29,6 +29,12 @@ namespace CCF begin (SimpleIdentifierPtr const& id, Category::Value category) = 0; virtual void + open_scope () = 0; + + virtual void + close_scope () = 0; + + virtual void end () = 0; }; } diff --git a/CIAO/CCF/CCF/IDL2/Parser.cpp b/CIAO/CCF/CCF/IDL2/Parser.cpp index 50f6a2e6071..c368ad2b5d7 100644 --- a/CIAO/CCF/CCF/IDL2/Parser.cpp +++ b/CIAO/CCF/CCF/IDL2/Parser.cpp @@ -502,14 +502,12 @@ namespace CCF guard ( assertion ("declaration or include directive expected", - RecoveryMethod::STANDARD, DiagnosticType::BEFORE) ( (+import >> *declaration) | +declaration ) >> assertion ("declaration or include directive expected", - RecoveryMethod::STANDARD, DiagnosticType::BEFORE) ( EOS @@ -518,16 +516,6 @@ namespace CCF )[root_error_handler] // Stops bailing out (rethrowing). ; - - /* - language = - guard - ( - +(*import >> (+declaration)) >> EOS - ) - ; - */ - import = include_decl ; @@ -539,10 +527,10 @@ namespace CCF >> SEMI[act_include_end] ; - // There are two classes of types: First class include - // interface and valuetype. Seond class include all other - // types like struct, etc. I wonder how I can represent it - // in the grammar. + // There are two classes of types: The first class includes + // interface and valuetype. The second class includes all + // other types like struct, etc. I wonder how I can represent + // it in the grammar. // declaration = @@ -569,20 +557,54 @@ namespace CCF type_id_decl = TYPEID - >> ( - identifier - >> string_literal - )[act_type_id_begin] - >> SEMI[act_type_id_end] + >> guard + ( + ( + assertion ("type name expected") + ( + identifier + ) + >> assertion ("string literal expected", + DiagnosticType::BEFORE) + ( + string_literal + ) + )[act_type_id_begin] + + >> assertion ("';' expected", + f.type_id (), + &SemanticAction::TypeId::end, + RecoveryMethod::NONE) + ( + SEMI[act_type_id_end] + ) + )[error_handler] ; type_prefix_decl = TYPEPREFIX - >> ( - identifier - >> string_literal - )[act_type_prefix_begin] - >> SEMI[act_type_prefix_end] + >> guard + ( + ( + assertion ("type name expected") + ( + identifier + ) + >> assertion ("string literal expected", + DiagnosticType::BEFORE) + ( + string_literal + ) + )[act_type_prefix_begin] + + >> assertion ("';' expected", + f.type_prefix (), + &SemanticAction::TypePrefix::end, + RecoveryMethod::NONE) + ( + SEMI[act_type_prefix_end] + ) + )[error_handler] ; abstract_type_decl = @@ -591,9 +613,9 @@ namespace CCF ( assertion ("interface or valuetype declaration expected") ( - (INTERFACE >> assertion ()(abstract_interface_decl)) + (INTERFACE >> abstract_interface_decl) | - (VALUETYPE >> assertion ()(abstract_value_type_decl)) + (VALUETYPE >> abstract_value_type_decl) ) )[error_handler] ; @@ -604,7 +626,7 @@ namespace CCF ( assertion ("interface declaration expected") ( - INTERFACE >> assertion ()(local_interface_decl) + INTERFACE >> local_interface_decl ) )[error_handler] ; @@ -617,7 +639,7 @@ namespace CCF ( simple_identifier[act_module_begin] ) - >> assertion ("\'{\' expected", + >> assertion ("'{' expected", f.module (), &SemanticAction::Module::end) ( @@ -627,7 +649,6 @@ namespace CCF f.module (), &SemanticAction::Module::close_scope, &SemanticAction::Module::end, - RecoveryMethod::STANDARD, DiagnosticType::BEFORE) ( hood (+declaration) @@ -637,16 +658,15 @@ namespace CCF &SemanticAction::Module::end) ] ) - >> assertion ("declaration or \'}\' expected", + >> assertion ("declaration or '}' expected", f.module (), &SemanticAction::Module::close_scope, &SemanticAction::Module::end, - RecoveryMethod::STANDARD, DiagnosticType::BEFORE) ( RCBRACE[act_module_close_scope] ) - >> assertion ("\';\' is missing", + >> assertion ("';' expected", f.module (), &SemanticAction::Module::end, RecoveryMethod::NONE) @@ -661,10 +681,33 @@ namespace CCF // const_decl = CONST - >> (identifier >> simple_identifier)[act_const_begin] - >> EQ[act_const_expr_flush] // flush expression stacks - >> const_expr[act_const_expr] - >> SEMI + >> guard + ( + ( + assertion ("type name expected") + ( + identifier + ) + >> assertion ("const name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) + )[act_const_begin] + >> assertion ("'=' expected") + ( + EQ[act_const_expr_flush] // flush expression stacks + ) + >> assertion ("const expression expected") + ( + const_expr[act_const_expr] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; @@ -683,16 +726,26 @@ namespace CCF character_const_expr = character_literal; + string_const_expr = string_literal; + // // - numeric_const_expr = numeric_or_expr; + numeric_const_expr = + guard + ( + numeric_or_expr + )[error_handler] + ; numeric_or_expr = numeric_xor_expr >> *( OR[act_numeric_expression_pre] - >> numeric_xor_expr + >> assertion ("expression expected") + ( + numeric_xor_expr + ) )[act_numeric_expression_or] ; @@ -700,7 +753,10 @@ namespace CCF numeric_and_expr >> *( XOR[act_numeric_expression_pre] - >> numeric_and_expr + >> assertion ("expression expected") + ( + numeric_and_expr + ) )[act_numeric_expression_xor] ; @@ -709,7 +765,10 @@ namespace CCF numeric_shift_expr >> *( AND[act_numeric_expression_pre] - >> numeric_shift_expr + >> assertion ("expression expected") + ( + numeric_shift_expr + ) )[act_numeric_expression_and] ; @@ -718,12 +777,18 @@ namespace CCF >> *( ( RSH[act_numeric_expression_pre] - >> numeric_add_expr + >> assertion ("expression expected") + ( + numeric_add_expr + ) )[act_numeric_expression_rsh] | ( LSH[act_numeric_expression_pre] - >> numeric_add_expr + >> assertion ("expression expected") + ( + numeric_add_expr + ) )[act_numeric_expression_lsh] ) ; @@ -732,12 +797,18 @@ namespace CCF numeric_mul_expr >> *( ( ADD[act_numeric_expression_pre] - >> numeric_mul_expr + >> assertion ("expression expected") + ( + numeric_mul_expr + ) )[act_numeric_expression_add] | ( SUB[act_numeric_expression_pre] - >> numeric_mul_expr + >> assertion ("expression expected") + ( + numeric_mul_expr + ) )[act_numeric_expression_sub] ) ; @@ -746,17 +817,26 @@ namespace CCF numeric_unary_expr >> *( ( MUL[act_numeric_expression_pre] - >> numeric_unary_expr + >> assertion ("expression expected") + ( + numeric_unary_expr + ) )[act_numeric_expression_mul] | ( DIV[act_numeric_expression_pre] - >> numeric_unary_expr + >> assertion ("expression expected") + ( + numeric_unary_expr + ) )[act_numeric_expression_div] | ( REM[act_numeric_expression_pre] - >> numeric_unary_expr + >> assertion ("expression expected") + ( + numeric_unary_expr + ) )[act_numeric_expression_rem] ) ; @@ -765,40 +845,84 @@ namespace CCF numeric_primary_expr | ADD[act_numeric_expression_pre] - >> numeric_primary_expr[act_numeric_expression_pos] + >> assertion ("expression expected") + ( + numeric_primary_expr[act_numeric_expression_pos] + ) | SUB[act_numeric_expression_pre] - >> numeric_primary_expr[act_numeric_expression_neg] + >> assertion ("expression expected") + ( + numeric_primary_expr[act_numeric_expression_neg] + ) | COM[act_numeric_expression_pre] - >> numeric_primary_expr[act_numeric_expression_com] + >> assertion ("expression expected") + ( + numeric_primary_expr[act_numeric_expression_com] + ) ; numeric_primary_expr = identifier[act_numeric_expression_const] | integer_literal[act_numeric_expression_integer_literal] - | LPAREN >> numeric_const_expr >> RPAREN + | LPAREN + >> assertion ("expression expected") + ( + numeric_const_expr + ) + >> assertion ("')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) ; - // - // - string_const_expr = string_literal; - - // enum // // enum_decl = ENUM - >> simple_identifier[act_enum_begin] - >> LCBRACE - >> enumerator_decl >> *(COMMA >> enumerator_decl) - >> RCBRACE - >> SEMI[act_enum_end] + >> guard + ( + assertion ("enum name expected") + ( + simple_identifier[act_enum_begin] + ) + >> hood + ( + assertion ("'{' expected") + ( + LCBRACE + ) + >> enumerator_decl >> *(COMMA >> enumerator_decl) + >> assertion ("',' or '}' expected", + DiagnosticType::BEFORE) + ( + RCBRACE + ) + ) + [ + handler (f.enum_ (), + &SemanticAction::Enum::end) + ] + >> assertion ("';' expected", + f.enum_ (), + &SemanticAction::Enum::end, + RecoveryMethod::NONE) + ( + SEMI[act_enum_end] + ) + )[error_handler] ; - enumerator_decl = identifier[act_enum_enumerator]; + enumerator_decl = + assertion ("enumerator name expected") + ( + simple_identifier[act_enum_enumerator] + ) + ; // interface @@ -807,84 +931,231 @@ namespace CCF abstract_interface_decl = guard ( - ( - simple_identifier - >> SEMI - )[act_interface_begin_abstract_fwd][act_interface_end] - | - ( - ( + assertion ("abstract interface declaration expected", + DiagnosticType::BEFORE) + ( + ( simple_identifier - >> COLON - )[act_interface_begin_abstract_def] + >> SEMI + )[act_interface_begin_abstract_fwd][act_interface_end] + | + ( + ( + simple_identifier + >> COLON + )[act_interface_begin_abstract_def] - >> interface_inheritance_spec - >> LCBRACE[act_interface_open_scope] - >> interface_def_trailer - ) - | - ( - ( - simple_identifier - >> LCBRACE - )[act_interface_begin_abstract_def][act_interface_open_scope] + >> hood + ( + interface_inheritance_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_interface_open_scope] + ) + >> hood (interface_body) + [ + handler (f.interface (), + &SemanticAction::Interface::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.interface (), + &SemanticAction::Interface::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_interface_close_scope] + ) + ) + [ + handler (f.interface (), + &SemanticAction::Interface::end) + ] + + >> assertion ("';' expected", + f.interface (), + &SemanticAction::Interface::end, + RecoveryMethod::NONE) + ( + SEMI[act_interface_end] + ) + ) + | + ( + ( + simple_identifier + >> LCBRACE + )[act_interface_begin_abstract_def][act_interface_open_scope] - >> interface_def_trailer - ) + >> hood + ( + hood (interface_body) + [ + handler (f.interface (), + &SemanticAction::Interface::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.interface (), + &SemanticAction::Interface::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_interface_close_scope] + ) + ) + [ + handler (f.interface (), + &SemanticAction::Interface::end) + ] + + >> assertion ("';' expected", + f.interface (), + &SemanticAction::Interface::end, + RecoveryMethod::NONE) + ( + SEMI[act_interface_end] + ) + ) + ) )[error_handler] ; - local_interface_decl = guard ( - ( - simple_identifier - >> SEMI - )[act_interface_begin_local_fwd][act_interface_end] - | - ( - ( + assertion ("local interface declaration expected", + DiagnosticType::BEFORE) + ( + ( simple_identifier - >> COLON - )[act_interface_begin_local_def] + >> SEMI + )[act_interface_begin_local_fwd][act_interface_end] + | + ( + ( + simple_identifier + >> COLON + )[act_interface_begin_local_def] - >> interface_inheritance_spec - >> LCBRACE[act_interface_open_scope] - >> interface_def_trailer - ) - | - ( - ( - simple_identifier - >> LCBRACE - )[act_interface_begin_local_def][act_interface_open_scope] + >> hood + ( + interface_inheritance_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_interface_open_scope] + ) + >> hood (interface_body) + [ + handler (f.interface (), + &SemanticAction::Interface::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.interface (), + &SemanticAction::Interface::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_interface_close_scope] + ) + ) + [ + handler (f.interface (), + &SemanticAction::Interface::end) + ] + + >> assertion ("';' expected", + f.interface (), + &SemanticAction::Interface::end, + RecoveryMethod::NONE) + ( + SEMI[act_interface_end] + ) + ) + | + ( + ( + simple_identifier + >> LCBRACE + )[act_interface_begin_local_def][act_interface_open_scope] - >> interface_def_trailer - ) + >> hood + ( + hood (interface_body) + [ + handler (f.interface (), + &SemanticAction::Interface::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.interface (), + &SemanticAction::Interface::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_interface_close_scope] + ) + ) + [ + handler (f.interface (), + &SemanticAction::Interface::end) + ] + + >> assertion ("';' expected", + f.interface (), + &SemanticAction::Interface::end, + RecoveryMethod::NONE) + ( + SEMI[act_interface_end] + ) + ) + ) )[error_handler] ; - unconstrained_interface_decl = - guard - ( - INTERFACE - >> ( + INTERFACE + >> guard + ( + assertion ("interface declaration expected", + DiagnosticType::BEFORE) + ( ( - simple_identifier - >> SEMI + simple_identifier + >> SEMI )[act_interface_begin_unconstrained_fwd][act_interface_end] | ( ( - simple_identifier - >> COLON + simple_identifier + >> COLON )[act_interface_begin_unconstrained_def] - >> interface_inheritance_spec - >> LCBRACE[act_interface_open_scope] - >> interface_def_trailer + >> hood + ( + interface_inheritance_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_interface_open_scope] + ) + >> hood (interface_body) + [ + handler (f.interface (), + &SemanticAction::Interface::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.interface (), + &SemanticAction::Interface::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_interface_close_scope] + ) + ) + [ + handler (f.interface (), + &SemanticAction::Interface::end) + ] + + >> assertion ("';' expected", + f.interface (), + &SemanticAction::Interface::end, + RecoveryMethod::NONE) + ( + SEMI[act_interface_end] + ) ) | ( @@ -893,83 +1164,54 @@ namespace CCF >> LCBRACE )[act_interface_begin_unconstrained_def][act_interface_open_scope] - >> interface_def_trailer + >> hood + ( + hood (interface_body) + [ + handler (f.interface (), + &SemanticAction::Interface::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.interface (), + &SemanticAction::Interface::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_interface_close_scope] + ) + ) + [ + handler (f.interface (), + &SemanticAction::Interface::end) + ] + + >> assertion ("';' expected", + f.interface (), + &SemanticAction::Interface::end, + RecoveryMethod::NONE) + ( + SEMI[act_interface_end] + ) ) ) - )[error_handler] + )[error_handler] ; interface_inheritance_spec = - assertion ("interface name expected", - f.interface (), - &SemanticAction::Interface::end) - ( - identifier[act_interface_inherits] - ) - >> *( - COMMA - >> assertion ("interface name expected", - f.interface (), - &SemanticAction::Interface::end) - ( - identifier[act_interface_inherits] - ) - ) - ; - - interface_def_trailer = - interface_body - >> assertion ("declaration or \'}\' expected", - f.interface (), - &SemanticAction::Interface::close_scope, - &SemanticAction::Interface::end, - RecoveryMethod::STANDARD, - DiagnosticType::BEFORE) - ( - RCBRACE[act_interface_close_scope] - ) - >> assertion ("\';\' is missing", - f.interface (), - &SemanticAction::Interface::end, - RecoveryMethod::NONE) - ( - SEMI[act_interface_end] - ) - ; - - /* - - interface_decl_trailer = - assertion ("\';\', \'{\' or inheritance specification expected", - f.interface (), - &SemanticAction::Interface::end) + guard ( - SEMI[act_interface_end] - | - ( - !(COLON >> interface_inheritance_spec) - >> LCBRACE[act_interface_open_scope] - >> interface_body - >> assertion ("declaration or \'}\' expected", - f.interface (), - &SemanticAction::Interface::close_scope, - &SemanticAction::Interface::end, - RecoveryMethod::STANDARD, - DiagnosticType::BEFORE) - ( - RCBRACE[act_interface_close_scope] - ) - >> assertion ("\';\' is missing", - f.interface (), - &SemanticAction::Interface::end, - RecoveryMethod::NONE) - ( - SEMI[act_interface_end] - ) - ) - ) + assertion ("base interface name expected") + ( + identifier[act_interface_inherits] + ) + >> *( + COMMA + >> assertion ("base eventtype name expected") + ( + identifier[act_interface_inherits] + ) + ) + )[error_handler] ; - */ interface_body = *( @@ -988,58 +1230,154 @@ namespace CCF // // attribute_decl = - ( - (READONLY >> ATTRIBUTE)[act_attribute_begin_ro] - >> attribute_ro_decl_trailer - ) - | - ( - ATTRIBUTE[act_attribute_begin_rw] - >> attribute_rw_decl_trailer - ) + guard + ( + ( + ( + READONLY + >> assertion ("'attribute' expected") + ( + ATTRIBUTE + ) + )[act_attribute_begin_ro] + + >> hood (attribute_ro_decl_trailer) + [ + handler (f.attribute (), + &SemanticAction::Attribute::end) + ] + >> assertion ("';' expected", + f.attribute (), + &SemanticAction::Attribute::end, + RecoveryMethod::NONE) + ( + SEMI[act_attribute_end] + ) + ) + | + ( + ATTRIBUTE[act_attribute_begin_rw] + >> hood (attribute_rw_decl_trailer) + [ + handler (f.attribute (), + &SemanticAction::Attribute::end) + ] + >> assertion ("';' expected", + f.attribute (), + &SemanticAction::Attribute::end, + RecoveryMethod::NONE) + ( + SEMI[act_attribute_end] + ) + ) + )[error_handler] ; attribute_ro_decl_trailer = - identifier[act_attribute_type] - >> simple_identifier[act_attribute_name] + assertion ("attribute type name expected") + ( + identifier[act_attribute_type] + ) + >> assertion ("attribute name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_attribute_name] + ) >> !( - (RAISES >> LPAREN >> attribute_get_raises_list >> RPAREN) + attribute_ro_raises_spec | - +(COMMA >> simple_identifier[act_attribute_name]) + +( + COMMA + >> assertion ("attribute name expected") + ( + simple_identifier[act_attribute_name] + ) + ) ) - >> SEMI[act_attribute_end] ; attribute_rw_decl_trailer = - identifier[act_attribute_type] - >> simple_identifier[act_attribute_name] + assertion ("attribute type name expected") + ( + identifier[act_attribute_type] + ) + >> assertion ("attribute name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_attribute_name] + ) >> !( attribute_rw_raises_spec | - +(COMMA >> simple_identifier[act_attribute_name]) + +( + COMMA + >> assertion ("attribute name expected") + ( + simple_identifier[act_attribute_name] + ) + ) ) - >> SEMI[act_attribute_end] ; + attribute_ro_raises_spec = + RAISES + >> attribute_get_raises_list; + + attribute_rw_raises_spec = ( - (GETRAISES >> LPAREN >> attribute_get_raises_list >> RPAREN) - >> !(SETRAISES >> LPAREN >> attribute_set_raises_list >> RPAREN) + (GETRAISES >> attribute_get_raises_list) + >> !(SETRAISES >> attribute_set_raises_list) ) | - (SETRAISES >> LPAREN >> attribute_set_raises_list >> RPAREN) + (SETRAISES >> attribute_set_raises_list) ; attribute_get_raises_list = - identifier[act_attribute_get_raises] - >> *(COMMA >> identifier[act_attribute_get_raises]) + assertion ("'(' expected") + ( + LPAREN + ) + >> assertion ("exception name expected") + ( + identifier[act_attribute_get_raises] + ) + >> *( + COMMA + >> assertion ("exception name expected") + ( + identifier[act_attribute_get_raises] + ) + ) + >> assertion ("',' or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) ; - attribute_set_raises_list = - identifier[act_attribute_set_raises] - >> *(COMMA >> identifier[act_attribute_set_raises]) + assertion ("'(' expected") + ( + LPAREN + ) + >> assertion ("exception name expected") + ( + identifier[act_attribute_set_raises] + ) + >> *( + COMMA + >> assertion ("exception name expected") + ( + identifier[act_attribute_set_raises] + ) + ) + >> assertion ("',' or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) ; @@ -1048,11 +1386,43 @@ namespace CCF // exception_decl = EXCEPTION - >> simple_identifier[act_exception_begin] - >> LCBRACE[act_exception_open_scope] - >> exception_body - >> RCBRACE[act_exception_close_scope] - >> SEMI[act_exception_end] + >> guard + ( + assertion ("exception name expected") + ( + simple_identifier[act_exception_begin] + ) + >> hood + ( + assertion ("'{' expected") + ( + LCBRACE[act_exception_open_scope] + ) + >> hood (exception_body) + [ + handler (f.exception (), + &SemanticAction::Exception::close_scope) + ] + >> assertion ("member declaration or '}' expected", + f.exception (), + &SemanticAction::Exception::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_exception_close_scope] + ) + ) + [ + handler (f.exception (), + &SemanticAction::Exception::end) + ] + >> assertion ("';' expected", + f.exception (), + &SemanticAction::Exception::end, + RecoveryMethod::NONE) + ( + SEMI[act_exception_end] + ) + )[error_handler] ; exception_body = @@ -1075,9 +1445,34 @@ namespace CCF // member_decl = identifier[act_member_type] - >> simple_identifier[act_member_name] - >> *(COMMA >> simple_identifier[act_member_name]) - >> SEMI[act_member_end] + >> guard + ( + hood + ( + assertion ("member name expected") + ( + simple_identifier[act_member_name] + ) + >> *( + COMMA + >> assertion ("member name expected") + ( + simple_identifier[act_member_name] + ) + ) + ) + [ + handler (f.member (), + &SemanticAction::Member::end) + ] + >> assertion ("';' expected", + f.member (), + &SemanticAction::Member::end, + RecoveryMethod::NONE) + ( + SEMI[act_member_end] + ) + )[error_handler] ; // native @@ -1085,8 +1480,20 @@ namespace CCF // native_decl = NATIVE - >> simple_identifier[act_native_name] - >> SEMI[act_native_end] + >> guard + ( + assertion ("native name expected") + ( + simple_identifier[act_native_name] + ) + >> assertion ("';' expected", + f.native (), + &SemanticAction::Native::end, + RecoveryMethod::NONE) + ( + SEMI[act_native_end] + ) + )[error_handler] ; @@ -1094,47 +1501,102 @@ namespace CCF // // operation_decl = - ( - ( - ONEWAY[act_operation_one_way] - >> identifier[act_operation_type] - ) - | - ( - identifier[act_operation_two_way][act_operation_type] - ) - ) - >> operation_decl_trailer + guard + ( + ( + ( + ONEWAY[act_operation_one_way] + >> assertion ("operation return type name expected") + ( + identifier[act_operation_type] + ) + ) + | + ( + identifier[act_operation_two_way][act_operation_type] + ) + ) + >> operation_decl_trailer + )[error_handler] ; operation_decl_trailer = - simple_identifier[act_operation_name] - >> LPAREN + assertion ("operation name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_operation_name] + ) + >> assertion ("'(' expected") + ( + LPAREN + ) >> operation_parameter_list - >> RPAREN - >> !(RAISES >> LPAREN >> operation_raises_list >> RPAREN) - >> SEMI + >> assertion ("parameter declaration or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + >> !( + RAISES + >> assertion ("'(' expected") + ( + LPAREN + ) + >> operation_raises_list + >> assertion ("',' or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) ; operation_parameter_list = *( operation_parameter - >> *(COMMA >> operation_parameter) + >> *( + COMMA + >> assertion ("parameter declaration expected") + ( + operation_parameter + ) + ) ) ; operation_parameter = ( direction_specifier - >> identifier - >> simple_identifier + >> assertion ("parameter type name expected") + ( + identifier + ) + >> assertion ("parameter name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) )[act_operation_parameter] ; operation_raises_list = - identifier[act_operation_raises] - >> *(COMMA >> identifier[act_operation_raises]) + assertion ("exception name expected") + ( + identifier[act_operation_raises] + ) + >> *( + COMMA + >> assertion ("exception name expected") + ( + identifier[act_operation_raises] + ) + ) ; @@ -1142,59 +1604,60 @@ namespace CCF // // struct_decl = - guard - ( - STRUCT - >> ( + STRUCT + >> guard + ( + assertion ("struct declaration expected", + DiagnosticType::BEFORE) + ( ( simple_identifier >> SEMI )[act_struct_begin_fwd][act_struct_end] | ( - ( - simple_identifier - >> LCBRACE - )[act_struct_begin_def][act_struct_open_scope] - >> struct_def_trailer + ( + simple_identifier + >> LCBRACE + )[act_struct_begin_def][act_struct_open_scope] + >> hood + ( + hood + ( + assertion ("member declaration expected", + DiagnosticType::BEFORE) + ( + struct_body + ) + ) + [ + handler (f.struct_ (), + &SemanticAction::Struct::close_scope) + ] + >> assertion ("member declaration or '}' expected", + f.struct_ (), + &SemanticAction::Struct::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_struct_close_scope] + ) + ) + [ + handler (f.struct_ (), + &SemanticAction::Struct::end) + ] + >> assertion ("';' expected", + f.struct_ (), + &SemanticAction::Struct::end, + RecoveryMethod::NONE) + ( + SEMI[act_struct_end] + ) ) ) - )[error_handler] - ; - - /* - struct_decl = - STRUCT - >> simple_identifier - >> LCBRACE - >> struct_body - >> RCBRACE - >> SEMI - ; - */ - - - struct_def_trailer = - struct_body - >> assertion ("member or \'}\' expected", - f.struct_ (), - &SemanticAction::Struct::close_scope, - &SemanticAction::Struct::end, - RecoveryMethod::STANDARD, - DiagnosticType::BEFORE) - ( - RCBRACE[act_struct_close_scope] - ) - >> assertion ("\';\' is missing", - f.struct_ (), - &SemanticAction::Struct::end, - RecoveryMethod::NONE) - ( - SEMI[act_struct_end] - ) + )[error_handler] ; - struct_body = +member_decl ; @@ -1206,21 +1669,59 @@ namespace CCF typedef_decl = TYPEDEF[act_typedef_pre] - >> typedef_type_spec - >> typedef_declarator - >> *(COMMA >> typedef_declarator) - >> SEMI[act_typedef_end] + >> guard + ( + assertion ("type name expected") + ( + typedef_type_spec + ) + >> typedef_declarator + >> *(COMMA >> typedef_declarator) + >> assertion ("';' expected", + f.typedef_ (), + &SemanticAction::Typedef::end, + RecoveryMethod::NONE) + ( + SEMI[act_typedef_end] + ) + )[error_handler] ; typedef_declarator = - ( simple_identifier + ( + assertion ("typedef name expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + simple_identifier + ) >> !( LSBRACE[act_typedef_begin_array][act_const_expr_flush] - >> numeric_const_expr[act_typedef_bound] - >> RSBRACE + >> assertion ("const expression expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + numeric_const_expr[act_typedef_bound] + ) + >> assertion ("']' expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + RSBRACE + ) ) >> *( LSBRACE[act_const_expr_flush] - >> numeric_const_expr[act_typedef_bound] - >> RSBRACE + >> assertion ("const expression expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + numeric_const_expr[act_typedef_bound] + ) + >> assertion ("']' expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + RSBRACE + ) ) )[act_typedef_declarator] ; @@ -1230,43 +1731,88 @@ namespace CCF | ( SEQUENCE - >> LT - >> + >> assertion ("'<' expected") ( + LT + ) + >> ( (identifier >> GT)[act_typedef_begin_unbounded_seq] | ( - identifier[act_typedef_begin_bounded_seq] - >> COMMA[act_const_expr_flush] // flush expression stacks - >> numeric_const_expr[act_typedef_bound] - >> GT + assertion ("sequence type name expected") + ( + identifier[act_typedef_begin_bounded_seq] + ) + >> assertion ("'>' or ',' expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + COMMA[act_const_expr_flush] // flush expression stacks + ) + >> assertion ("const expression expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + numeric_const_expr[act_typedef_bound] + ) + >> assertion ("'>' expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + GT + ) ) ) ) | ( STRING - >> LT[act_const_expr_flush] // flush expression stacks - >> numeric_const_expr[act_typedef_begin_bounded_string] - >> GT + >> assertion ("'<' expected") + ( + LT[act_const_expr_flush] // flush expression stacks + ) + >> assertion ("const expression expected") + ( + numeric_const_expr[act_typedef_begin_bounded_string] + ) + >> assertion ("'>' expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + GT + ) ) | ( WSTRING - >> LT[act_const_expr_flush] // flush expression stacks - >> numeric_const_expr[act_typedef_begin_bounded_wstring] - >> GT + >> assertion ("'<' expected") + ( + LT[act_const_expr_flush] // flush expression stacks + ) + >> assertion ("const expression expected") + ( + numeric_const_expr[act_typedef_begin_bounded_wstring] + ) + >> assertion ("'>' expected", + f.typedef_ (), + &SemanticAction::Typedef::end) + ( + GT + ) ) ; // union // // + union_decl = - guard - ( - UNION - >> ( + UNION + >> guard + ( + assertion ("union declaration expected", + DiagnosticType::BEFORE) + ( ( simple_identifier >> SEMI @@ -1277,167 +1823,403 @@ namespace CCF simple_identifier >> SWITCH )[act_union_begin_def] - >> union_def_trailer + + >> hood (union_def_trailer) + [ + handler (f.union_ (), + &SemanticAction::Union::end) + ] + >> assertion ("';' expected", + f.union_ (), + &SemanticAction::Union::end, + RecoveryMethod::NONE) + ( + SEMI[act_union_end] + ) ) ) - )[error_handler] + )[error_handler] ; union_def_trailer = - LPAREN - >> identifier[act_union_type] - >> RPAREN - >> LCBRACE[act_union_open_scope] - >> union_body - >> assertion ("member or \'}\' expected", - f.union_ (), - &SemanticAction::Union::close_scope, - &SemanticAction::Union::end, - RecoveryMethod::STANDARD, + assertion ("'(' expected") + ( + LPAREN + ) + >> assertion ("discriminator type name expected") + ( + identifier[act_union_type] + ) + >> assertion ("')' expected", DiagnosticType::BEFORE) ( - RCBRACE[act_union_close_scope] + RPAREN + ) + >> assertion ("'{' expected") + ( + LCBRACE[act_union_open_scope] ) - >> assertion ("\';\' is missing", + >> hood + ( + assertion ("case statement expected") + ( + union_body + ) + ) + [ + handler (f.union_ (), + &SemanticAction::Union::close_scope) + ] + >> assertion ("case statement or \'}\' expected", f.union_ (), - &SemanticAction::Union::end, - RecoveryMethod::NONE) + &SemanticAction::Union::close_scope, + DiagnosticType::BEFORE) ( - SEMI[act_union_end] + RCBRACE[act_union_close_scope] ) ; union_body = - +( + +guard + ( +union_case_label - >> identifier[act_union_member_type] - >> simple_identifier[act_union_member_name] - >> SEMI - ) + >> assertion ("type name expected", + DiagnosticType::BEFORE) + ( + identifier[act_union_member_type] + ) + >> assertion ("member name expected") + ( + simple_identifier[act_union_member_name] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; union_case_label = ( CASE[act_const_expr_flush] // flush expression stacks - >> const_expr - >> COLON + >> assertion ("const expression expected") + ( + const_expr + ) + >> assertion ("':' expected") + ( + COLON + ) ) | - (DEFAULT >> COLON) + ( DEFAULT + >> assertion ("':' expected") + ( + COLON + ) + ) ; + // valuetype // // abstract_value_type_decl = guard ( - ( - simple_identifier - >> SEMI - )[act_value_type_begin_abstract_fwd][act_value_type_end] - | - ( - ( + assertion ("abstract valuetype declaration expected", + DiagnosticType::BEFORE) + ( + ( simple_identifier - >> COLON - )[act_value_type_begin_abstract_def] + >> SEMI + )[act_value_type_begin_abstract_fwd][act_value_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_value_type_begin_abstract_def] - >> value_type_inheritance_spec - >> !(SUPPORTS >> value_type_supports_spec) - >> LCBRACE[act_value_type_open_scope] - >> value_type_def_trailer - ) - | - ( - ( - simple_identifier - >> SUPPORTS - )[act_value_type_begin_abstract_def] + >> hood + ( + value_type_inheritance_spec + >> !(SUPPORTS >> value_type_supports_spec) + >> assertion ("'{' expected") + ( + LCBRACE[act_value_type_open_scope] + ) + >> hood (value_type_body) + [ + handler (f.value_type (), + &SemanticAction::ValueType::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.value_type (), + &SemanticAction::ValueType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_value_type_close_scope] + ) + ) + [ + handler (f.value_type (), + &SemanticAction::ValueType::end) + ] + + >> assertion ("';' expected", + f.value_type (), + &SemanticAction::ValueType::end, + RecoveryMethod::NONE) + ( + SEMI[act_value_type_end] + ) + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_value_type_begin_abstract_def] - >> value_type_supports_spec - >> LCBRACE[act_value_type_open_scope] - >> value_type_def_trailer - ) - | - ( - ( - simple_identifier - >> LCBRACE - )[act_value_type_begin_abstract_def][act_value_type_open_scope] + >> hood + ( + value_type_supports_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_value_type_open_scope] + ) + >> hood (value_type_body) + [ + handler (f.value_type (), + &SemanticAction::ValueType::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.value_type (), + &SemanticAction::ValueType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_value_type_close_scope] + ) + ) + [ + handler (f.value_type (), + &SemanticAction::ValueType::end) + ] + + >> assertion ("';' expected", + f.value_type (), + &SemanticAction::ValueType::end, + RecoveryMethod::NONE) + ( + SEMI[act_value_type_end] + ) + ) + | + ( + ( + simple_identifier + >> LCBRACE + )[act_value_type_begin_abstract_def][act_value_type_open_scope] - >> value_type_def_trailer - ) + >> hood + ( + hood (value_type_body) + [ + handler (f.value_type (), + &SemanticAction::ValueType::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.value_type (), + &SemanticAction::ValueType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_value_type_close_scope] + ) + ) + [ + handler (f.value_type (), + &SemanticAction::ValueType::end) + ] + + >> assertion ("';' expected", + f.value_type (), + &SemanticAction::ValueType::end, + RecoveryMethod::NONE) + ( + SEMI[act_value_type_end] + ) + ) + ) )[error_handler] ; - concrete_value_type_decl = - guard - ( - VALUETYPE - >> ( - ( - simple_identifier - >> SEMI - )[act_value_type_begin_concrete_fwd][act_value_type_end] - | - ( - ( - simple_identifier - >> COLON - )[act_value_type_begin_concrete_def] - >> value_type_inheritance_spec - >> !(SUPPORTS >> value_type_supports_spec) - >> LCBRACE[act_value_type_open_scope] - >> value_type_def_trailer - ) - | - ( - ( - simple_identifier - >> SUPPORTS - )[act_value_type_begin_concrete_def] - - >> value_type_supports_spec - >> LCBRACE[act_value_type_open_scope] - >> value_type_def_trailer - ) - | - ( - ( - simple_identifier - >> LCBRACE - )[act_value_type_begin_concrete_def][act_value_type_open_scope] - - >> value_type_def_trailer - ) - ) - )[error_handler] + concrete_value_type_decl = + VALUETYPE + >> guard + ( + assertion ("valuetype declaration expected", + DiagnosticType::BEFORE) + ( + ( + simple_identifier + >> SEMI + )[act_value_type_begin_concrete_fwd][act_value_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_value_type_begin_concrete_def] + + >> hood + ( + value_type_inheritance_spec + >> !(SUPPORTS >> value_type_supports_spec) + >> assertion ("'{' expected") + ( + LCBRACE[act_value_type_open_scope] + ) + >> hood (value_type_body) + [ + handler (f.value_type (), + &SemanticAction::ValueType::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.value_type (), + &SemanticAction::ValueType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_value_type_close_scope] + ) + ) + [ + handler (f.value_type (), + &SemanticAction::ValueType::end) + ] + + >> assertion ("';' expected", + f.value_type (), + &SemanticAction::ValueType::end, + RecoveryMethod::NONE) + ( + SEMI[act_value_type_end] + ) + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_value_type_begin_concrete_def] + + >> hood + ( + value_type_supports_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_value_type_open_scope] + ) + >> hood (value_type_body) + [ + handler (f.value_type (), + &SemanticAction::ValueType::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.value_type (), + &SemanticAction::ValueType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_value_type_close_scope] + ) + ) + [ + handler (f.value_type (), + &SemanticAction::ValueType::end) + ] + + >> assertion ("';' expected", + f.value_type (), + &SemanticAction::ValueType::end, + RecoveryMethod::NONE) + ( + SEMI[act_value_type_end] + ) + ) + | + ( + ( + simple_identifier + >> LCBRACE + )[act_value_type_begin_concrete_def][act_value_type_open_scope] + + >> hood + ( + hood (value_type_body) + [ + handler (f.value_type (), + &SemanticAction::ValueType::close_scope) + ] + >> assertion ("declaration or '}' expected", + f.value_type (), + &SemanticAction::ValueType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_value_type_close_scope] + ) + ) + [ + handler (f.value_type (), + &SemanticAction::ValueType::end) + ] + + >> assertion ("';' expected", + f.value_type (), + &SemanticAction::ValueType::end, + RecoveryMethod::NONE) + ( + SEMI[act_value_type_end] + ) + ) + ) + )[error_handler] ; - value_type_inheritance_spec = - identifier[act_value_type_inherits] - >> *( - COMMA - >> identifier[act_value_type_inherits] - ) + guard + ( + assertion ("base valuetype name expected") + ( + identifier[act_value_type_inherits] + ) + >> *( + COMMA + >> assertion ("base valuetype name expected") + ( + identifier[act_value_type_inherits] + ) + ) + )[error_handler] ; value_type_supports_spec = - identifier[act_value_type_supports] - >> *( - COMMA - >> identifier[act_value_type_supports] - ) - ; - - value_type_def_trailer = - value_type_body - >> RCBRACE[act_value_type_close_scope] - >> SEMI[act_value_type_end] + guard + ( + assertion ("supported interface name expected") + ( + identifier[act_value_type_supports] + ) + >> *( + COMMA + >> assertion ("supported interface name expected") + ( + identifier[act_value_type_supports] + ) + ) + )[error_handler] ; value_type_body = @@ -1460,12 +2242,41 @@ namespace CCF // value_type_factory_decl = FACTORY - >> simple_identifier[act_value_type_factory_name] - >> LPAREN - >> value_type_factory_parameter_list - >> RPAREN - >> !(RAISES >> LPAREN >> value_type_factory_raises_list >> RPAREN) - >> SEMI + >> guard + ( + assertion ("factory name expected") + ( + simple_identifier[act_value_type_factory_name] + ) + >> assertion ("'(' expected") + ( + LPAREN + ) + >> value_type_factory_parameter_list + >> assertion ("parameter declaration or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + >> !( + RAISES + >> assertion ("'(' expected") + ( + LPAREN + ) + >> value_type_factory_raises_list + >> assertion ("',' or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; value_type_factory_parameter_list = @@ -1477,12 +2288,37 @@ namespace CCF value_type_factory_parameter = IN - >> (identifier >> simple_identifier)[act_value_type_factory_parameter] + >> guard + ( + ( + assertion ("type name expected") + ( + identifier + ) + >> assertion ("parameter name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) + )[act_value_type_factory_parameter] + )[error_handler] ; value_type_factory_raises_list = - identifier[act_value_type_factory_raises] - >> *(COMMA >> identifier[act_value_type_factory_raises]) + guard + ( + assertion ("exception name expected") + ( + identifier[act_value_type_factory_raises] + ) + >> *( + COMMA + >> assertion ("exception name expected") + ( + identifier[act_value_type_factory_raises] + ) + ) + )[error_handler] ; @@ -1494,10 +2330,30 @@ namespace CCF PUBLIC[act_value_type_member_begin_public] | PRIVATE[act_value_type_member_begin_private] ) - >> identifier[act_value_type_member_type] - >> simple_identifier[act_value_type_member_name] - >> *(COMMA >> simple_identifier[act_value_type_member_name]) - >> SEMI[act_value_type_member_end] + >> guard + ( + assertion ("type name expected") + ( + identifier[act_value_type_member_type] + ) + >> assertion ("member name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_value_type_member_name] + ) + >> *( + COMMA + >> assertion ("member name expected") + ( + simple_identifier[act_value_type_member_name] + ) + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; } } diff --git a/CIAO/CCF/CCF/IDL2/Parser.hpp b/CIAO/CCF/CCF/IDL2/Parser.hpp index f614c2e998b..2a6e6b92b01 100644 --- a/CIAO/CCF/CCF/IDL2/Parser.hpp +++ b/CIAO/CCF/CCF/IDL2/Parser.hpp @@ -287,10 +287,12 @@ namespace CCF RecoveryStatus operator() (Parsing::Scanner const&, Parsing::Error e) const { + /* assert ( e.descriptor->diagnostic_ == Parsing::DiagnosticType::NONE && e.descriptor->recovery_ == Parsing::RecoveryMethod::BAIL_OUT ); + */ if (action_one_.get ()) action_one_->execute (); if (action_two_.get ()) action_two_->execute (); @@ -435,12 +437,12 @@ namespace CCF Rule local_interface_decl; Rule unconstrained_interface_decl; Rule interface_inheritance_spec; - Rule interface_def_trailer; Rule interface_body; Rule attribute_decl; Rule attribute_ro_decl_trailer; Rule attribute_rw_decl_trailer; + Rule attribute_ro_raises_spec; Rule attribute_rw_raises_spec; Rule attribute_get_raises_list; Rule attribute_set_raises_list; @@ -461,7 +463,6 @@ namespace CCF Rule operation_raises_list; Rule struct_decl; - Rule struct_def_trailer; Rule struct_body; Rule typedef_decl; @@ -480,7 +481,6 @@ namespace CCF Rule concrete_value_type_decl; Rule value_type_inheritance_spec; Rule value_type_supports_spec; - Rule value_type_def_trailer; Rule value_type_body; Rule value_type_factory_decl; diff --git a/CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp b/CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp index f9024f77f72..d8b3739b335 100644 --- a/CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp +++ b/CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp @@ -213,6 +213,16 @@ namespace CCF new RecoveryDescriptor (d, recovery, diagnostic))); } + AssertionImpl + operator () (std::string d, + DiagnosticType::Value diagnostic) + { + return AssertionImpl ( + RecoveryDescriptorPtr ( + new RecoveryDescriptor ( + d, RecoveryMethod::STANDARD, diagnostic))); + } + template<typename Object> AssertionImpl operator () (std::string d, @@ -229,6 +239,19 @@ namespace CCF template<typename Object> AssertionImpl + operator () (std::string d, + Object& obj, + void (Object::*action_one)(), + DiagnosticType::Value diagnostic) + { + return AssertionImpl ( + RecoveryDescriptorPtr ( + new RecoveryDescriptor ( + d, RecoveryMethod::STANDARD, diagnostic, obj, action_one))); + } + + template<typename Object> + AssertionImpl operator () (Object& obj, void (Object::*action_one)(), RecoveryMethod::Value recovery = RecoveryMethod::BAIL_OUT) @@ -254,6 +277,20 @@ namespace CCF d, recovery, diagnostic, obj, action_one, action_two))); } + template<typename Object> + AssertionImpl + operator () (std::string d, + Object& obj, + void (Object::*action_one)(), + void (Object::*action_two)(), + DiagnosticType::Value diagnostic) + { + return AssertionImpl ( + RecoveryDescriptorPtr ( + new RecoveryDescriptor ( + d, RecoveryMethod::STANDARD, diagnostic, obj, action_one, action_two))); + } + template<typename Object> AssertionImpl diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp index 385702af462..9685d0874ee 100644 --- a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp +++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp @@ -81,13 +81,13 @@ namespace CCF catch (NotFound const&) { cerr << ctx.file () << ":" << type_id->line () << ": error: " - << "no type with name \'" << name + << "no type with name \'" << type_name << "\' visible from scope \'" << from << "\'" << endl; } catch (WrongType const&) { cerr << ctx.file () << ":" << type_id->line () << ": error: " - << "declaration with name \'" << name + << "declaration with name \'" << type_name << "\' visible from scope \'" << from << "\' is not a type declaration" << endl; diff --git a/CIAO/CCF/CCF/IDL3/Parser.cpp b/CIAO/CCF/CCF/IDL3/Parser.cpp index 38eeeb087df..acb791f92c4 100644 --- a/CIAO/CCF/CCF/IDL3/Parser.cpp +++ b/CIAO/CCF/CCF/IDL3/Parser.cpp @@ -13,6 +13,9 @@ namespace CCF { namespace IDL3 { + using IDL2::Parsing::DiagnosticType; + using IDL2::Parsing::RecoveryMethod; + Parser:: Parser (CompilerElements::Context& context, Diagnostic::Stream& dout, @@ -48,10 +51,10 @@ namespace CCF f.component (), &SemanticAction::Component::supports), act_component_open_scope ( - f.component (), &SemanticAction::Component::open_scope), + f.component (), &SemanticAction::Scope::open_scope), act_component_close_scope ( - f.component (), &SemanticAction::Component::close_scope), + f.component (), &SemanticAction::Scope::close_scope), act_component_end ( f.component (), &SemanticAction::Component::end), @@ -112,10 +115,10 @@ namespace CCF f.event_type (), &SemanticAction::EventType::supports), act_event_type_open_scope ( - f.event_type (), &SemanticAction::EventType::open_scope), + f.event_type (), &SemanticAction::Scope::open_scope), act_event_type_close_scope ( - f.event_type (), &SemanticAction::EventType::close_scope), + f.event_type (), &SemanticAction::Scope::close_scope), act_event_type_end ( f.event_type (), &SemanticAction::EventType::end), @@ -147,10 +150,10 @@ namespace CCF f.home (), &SemanticAction::Home::manages), act_home_open_scope ( - f.home (), &SemanticAction::Home::open_scope), + f.home (), &SemanticAction::Scope::open_scope), act_home_close_scope ( - f.home (), &SemanticAction::Home::close_scope), + f.home (), &SemanticAction::Scope::close_scope), act_home_end ( f.home (), &SemanticAction::Home::end), @@ -193,11 +196,11 @@ namespace CCF ( assertion ("interface, valuetype or eventtype declaration expected") ( - (INTERFACE >> assertion ()(abstract_interface_decl)) + (INTERFACE >> abstract_interface_decl) | - (VALUETYPE >> assertion ()(abstract_value_type_decl)) + (VALUETYPE >> abstract_value_type_decl) | - (EVENTTYPE >> assertion ()(abstract_event_type_decl)) + (EVENTTYPE >> abstract_event_type_decl) ) )[error_handler] ; @@ -208,65 +211,169 @@ namespace CCF component_decl = COMPONENT - >> ( - ( - simple_identifier - >> SEMI - )[act_component_begin_fwd][act_component_end] - | - ( - ( - simple_identifier - >> COLON - )[act_component_begin_def] - >> component_inheritance_spec - >> !(SUPPORTS >> component_support_spec) - >> LCBRACE[act_component_open_scope] - >> component_def_trailer - ) - | - ( - ( - simple_identifier - >> SUPPORTS - )[act_component_begin_def] - >> component_support_spec - >> LCBRACE[act_component_open_scope] - >> component_def_trailer - ) - | - ( - ( - simple_identifier - >> LCBRACE - )[act_component_begin_def][act_component_open_scope] - >> component_def_trailer - ) + >> guard + ( + assertion ("component declaration expected", + DiagnosticType::BEFORE) + ( + ( + simple_identifier + >> SEMI + )[act_component_begin_fwd][act_component_end] + | + ( + ( + simple_identifier + >> COLON + )[act_component_begin_def] - ) - ; + >> hood + ( + component_inheritance_spec + >> !(SUPPORTS >> component_support_spec) + >> assertion ("'{' expected") + ( + LCBRACE[act_component_open_scope] + ) + >> hood (component_body) + [ + handler (f.component (), + &SemanticAction::Component::close_scope) + ] + >> assertion ("'}' expected", + f.component (), + &SemanticAction::Component::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_component_close_scope] + ) + ) + [ + handler (f.component (), + &SemanticAction::Component::end) + ] + + >> assertion ("';' expected", + f.component (), + &SemanticAction::Component::end, + RecoveryMethod::NONE) + ( + SEMI[act_component_end] + ) + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_component_begin_def] + + >> hood + ( + component_support_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_component_open_scope] + ) + >> hood (component_body) + [ + handler (f.component (), + &SemanticAction::Component::close_scope) + ] + >> assertion ("'}' expected", + f.component (), + &SemanticAction::Component::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_component_close_scope] + ) + ) + [ + handler (f.component (), + &SemanticAction::Component::end) + ] + + >> assertion ("';' expected", + f.component (), + &SemanticAction::Component::end, + RecoveryMethod::NONE) + ( + SEMI[act_component_end] + ) + ) + | + ( + ( + simple_identifier + >> LCBRACE + )[act_component_begin_def][act_component_open_scope] - component_def_trailer = - component_body - >> RCBRACE[act_component_close_scope] - >> SEMI[act_component_end] + >> hood + ( + hood (component_body) + [ + handler (f.component (), + &SemanticAction::Component::close_scope) + ] + >> assertion ("'}' expected", + f.component (), + &SemanticAction::Component::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_component_close_scope] + ) + ) + [ + handler (f.component (), + &SemanticAction::Component::end) + ] + + >> assertion ("';' expected", + f.component (), + &SemanticAction::Component::end, + RecoveryMethod::NONE) + ( + SEMI[act_component_end] + ) + ) + ) + )[error_handler] ; - component_inheritance_spec = identifier[act_component_inherits] + component_inheritance_spec = + guard + ( + assertion ("base component name expected") + ( + identifier[act_component_inherits] + ) + )[error_handler] ; component_support_spec = - identifier[act_component_supports] - >> *(COMMA >> identifier[act_component_supports]) + guard + ( + assertion ("supported interface name expected") + ( + identifier[act_component_supports] + ) + >> *( + COMMA + >> assertion ("supported interface name expected") + ( + identifier[act_component_supports] + ) + ) + )[error_handler] ; component_body = - *( provides_decl - | uses_decl - | emits_decl - | publishes_decl - | consumes_decl - | attribute_decl + *( provides_decl + | uses_decl + | emits_decl + | publishes_decl + | consumes_decl + | attribute_decl ) ; @@ -275,38 +382,108 @@ namespace CCF // provides_decl = PROVIDES - >> identifier[act_provides_type] - >> simple_identifier[act_provides_name] - >> SEMI + >> guard + ( + assertion ("interface name expected") + ( + identifier[act_provides_type] + ) + >> assertion ("provides name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_provides_name] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; uses_decl = USES - >> !(MULTIPLE[act_uses_multiple]) - >> identifier[act_uses_type] - >> simple_identifier[act_uses_name] - >> SEMI + >> guard + ( + !(MULTIPLE[act_uses_multiple]) + >> assertion ("interface name expected") + ( + identifier[act_uses_type] + ) + >> assertion ("uses name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_uses_name] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; emits_decl = EMITS - >> identifier[act_emits_type] - >> simple_identifier[act_emits_name] - >> SEMI + >> guard + ( + assertion ("eventtype name expected") + ( + identifier[act_emits_type] + ) + >> assertion ("emits name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_emits_name] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; publishes_decl = PUBLISHES - >> identifier[act_publishes_type] - >> simple_identifier[act_publishes_name] - >> SEMI + >> guard + ( + assertion ("eventtype name expected") + ( + identifier[act_publishes_type] + ) + >> assertion ("publishes name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_publishes_name] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; consumes_decl = CONSUMES - >> identifier[act_consumes_type] - >> simple_identifier[act_consumes_name] - >> SEMI + >> guard + ( + assertion ("eventtype name expected") + ( + identifier[act_consumes_type] + ) + >> assertion ("consumes name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_consumes_name] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; @@ -316,111 +493,297 @@ namespace CCF abstract_event_type_decl = guard ( - ( - simple_identifier - >> SEMI - )[act_event_type_begin_abstract_fwd][act_event_type_end] - | - ( - ( + assertion ("abstract eventtype declaration expected", + DiagnosticType::BEFORE) + ( + ( simple_identifier - >> COLON - )[act_event_type_begin_abstract_def] - - >> event_type_inheritance_spec - >> !(SUPPORTS >> event_type_supports_spec) - >> LCBRACE[act_event_type_open_scope] - >> event_type_def_trailer - ) - | - ( - ( - simple_identifier - >> SUPPORTS - )[act_event_type_begin_abstract_def] + >> SEMI + )[act_event_type_begin_abstract_fwd][act_event_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_event_type_begin_abstract_def] + + >> hood + ( + event_type_inheritance_spec + >> !(SUPPORTS >> event_type_supports_spec) + >> assertion ("'{' expected") + ( + LCBRACE[act_event_type_open_scope] + ) + >> hood (event_type_body) + [ + handler (f.event_type (), + &SemanticAction::EventType::close_scope) + ] + >> assertion ("'}' expected", + f.event_type (), + &SemanticAction::EventType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_event_type_close_scope] + ) + ) + [ + handler (f.event_type (), + &SemanticAction::EventType::end) + ] + + >> assertion ("';' expected", + f.event_type (), + &SemanticAction::EventType::end, + RecoveryMethod::NONE) + ( + SEMI[act_event_type_end] + ) + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_event_type_begin_abstract_def] + + >> hood + ( + event_type_supports_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_event_type_open_scope] + ) + >> hood (event_type_body) + [ + handler (f.event_type (), + &SemanticAction::EventType::close_scope) + ] + >> assertion ("'}' expected", + f.event_type (), + &SemanticAction::EventType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_event_type_close_scope] + ) + ) + [ + handler (f.event_type (), + &SemanticAction::EventType::end) + ] + + >> assertion ("';' expected", + f.event_type (), + &SemanticAction::EventType::end, + RecoveryMethod::NONE) + ( + SEMI[act_event_type_end] + ) + ) + | + ( + ( + simple_identifier + >> LCBRACE + )[act_event_type_begin_abstract_def][act_event_type_open_scope] + + >> hood + ( + hood (event_type_body) + [ + handler (f.event_type (), + &SemanticAction::EventType::close_scope) + ] + >> assertion ("'}' expected", + f.event_type (), + &SemanticAction::EventType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_event_type_close_scope] + ) + ) + [ + handler (f.event_type (), + &SemanticAction::EventType::end) + ] + + >> assertion ("';' expected", + f.event_type (), + &SemanticAction::EventType::end, + RecoveryMethod::NONE) + ( + SEMI[act_event_type_end] + ) + ) + ) + )[error_handler] + ; - >> event_type_supports_spec - >> LCBRACE[act_event_type_open_scope] - >> event_type_def_trailer - ) - | - ( - ( - simple_identifier - >> LCBRACE - )[act_event_type_begin_abstract_def][act_event_type_open_scope] - >> event_type_def_trailer + concrete_event_type_decl = + EVENTTYPE + >> guard + ( + assertion ("eventtype declaration expected", + DiagnosticType::BEFORE) + ( + ( + simple_identifier + >> SEMI + )[act_event_type_begin_concrete_fwd][act_event_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_event_type_begin_concrete_def] + + >> hood + ( + event_type_inheritance_spec + >> !(SUPPORTS >> event_type_supports_spec) + >> assertion ("'{' expected") + ( + LCBRACE[act_event_type_open_scope] + ) + >> hood (event_type_body) + [ + handler (f.event_type (), + &SemanticAction::EventType::close_scope) + ] + >> assertion ("'}' expected", + f.event_type (), + &SemanticAction::EventType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_event_type_close_scope] + ) + ) + [ + handler (f.event_type (), + &SemanticAction::EventType::end) + ] + + >> assertion ("';' expected", + f.event_type (), + &SemanticAction::EventType::end, + RecoveryMethod::NONE) + ( + SEMI[act_event_type_end] + ) + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_event_type_begin_concrete_def] + + >> hood + ( + event_type_supports_spec + >> assertion ("'{' expected") + ( + LCBRACE[act_event_type_open_scope] + ) + >> hood (event_type_body) + [ + handler (f.event_type (), + &SemanticAction::EventType::close_scope) + ] + >> assertion ("'}' expected", + f.event_type (), + &SemanticAction::EventType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_event_type_close_scope] + ) + ) + [ + handler (f.event_type (), + &SemanticAction::EventType::end) + ] + + >> assertion ("';' expected", + f.event_type (), + &SemanticAction::EventType::end, + RecoveryMethod::NONE) + ( + SEMI[act_event_type_end] + ) + ) + | + ( + ( + simple_identifier + >> LCBRACE + )[act_event_type_begin_concrete_def][act_event_type_open_scope] + + >> hood + ( + hood (event_type_body) + [ + handler (f.event_type (), + &SemanticAction::EventType::close_scope) + ] + >> assertion ("'}' expected", + f.event_type (), + &SemanticAction::EventType::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_event_type_close_scope] + ) + ) + [ + handler (f.event_type (), + &SemanticAction::EventType::end) + ] + + >> assertion ("';' expected", + f.event_type (), + &SemanticAction::EventType::end, + RecoveryMethod::NONE) + ( + SEMI[act_event_type_end] + ) + ) ) - )[error_handler] + )[error_handler] ; - concrete_event_type_decl = + event_type_inheritance_spec = guard ( - EVENTTYPE - >> ( - ( - simple_identifier - >> SEMI - )[act_event_type_begin_concrete_fwd][act_event_type_end] - | - ( - ( - simple_identifier - >> COLON - )[act_event_type_begin_concrete_def] - - >> event_type_inheritance_spec - >> !(SUPPORTS >> event_type_supports_spec) - >> LCBRACE[act_event_type_open_scope] - >> event_type_def_trailer - ) - | - ( - ( - simple_identifier - >> SUPPORTS - )[act_event_type_begin_concrete_def] - - >> event_type_supports_spec - >> LCBRACE[act_event_type_open_scope] - >> event_type_def_trailer - ) - | - ( - ( - simple_identifier - >> LCBRACE - )[act_event_type_begin_concrete_def][act_event_type_open_scope] - - >> event_type_def_trailer - ) - ) + assertion ("base eventtype name expected") + ( + identifier[act_event_type_inherits] + ) + >> *( + COMMA + >> assertion ("base eventtype name expected") + ( + identifier[act_event_type_inherits] + ) + ) )[error_handler] ; - - event_type_inheritance_spec = - identifier[act_event_type_inherits] - >> *( - COMMA - >> identifier[act_event_type_inherits] - ) - ; - event_type_supports_spec = - identifier[act_event_type_supports] - >> *( - COMMA - >> identifier[act_event_type_supports] - ) - ; - - event_type_def_trailer = - event_type_body - >> RCBRACE[act_event_type_close_scope] - >> SEMI[act_event_type_end] + guard + ( + assertion ("supported interface name expected") + ( + identifier[act_event_type_supports] + ) + >> *( + COMMA + >> assertion ("supported interface name expected") + ( + identifier[act_event_type_supports] + ) + ) + )[error_handler] ; event_type_body = @@ -443,12 +806,41 @@ namespace CCF // event_type_factory_decl = FACTORY - >> simple_identifier[act_event_type_factory_name] - >> LPAREN - >> event_type_factory_parameter_list - >> RPAREN - >> !(RAISES >> LPAREN >> event_type_factory_raises_list >> RPAREN) - >> SEMI + >> guard + ( + assertion ("factory name expected") + ( + simple_identifier[act_event_type_factory_name] + ) + >> assertion ("'(' expected") + ( + LPAREN + ) + >> event_type_factory_parameter_list + >> assertion ("parameter declaration or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + >> !( + RAISES + >> assertion ("'(' expected") + ( + LPAREN + ) + >> event_type_factory_raises_list + >> assertion ("',' or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; event_type_factory_parameter_list = @@ -460,40 +852,119 @@ namespace CCF event_type_factory_parameter = IN - >> (identifier >> simple_identifier)[act_event_type_factory_parameter] + >> guard + ( + ( + assertion ("type name expected") + ( + identifier + ) + >> assertion ("parameter name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) + )[act_event_type_factory_parameter] + )[error_handler] ; event_type_factory_raises_list = - identifier[act_event_type_factory_raises] - >> *(COMMA >> identifier[act_event_type_factory_raises]) + guard + ( + assertion ("exception name expected") + ( + identifier[act_event_type_factory_raises] + ) + >> *( + COMMA + >> assertion ("exception name expected") + ( + identifier[act_event_type_factory_raises] + ) + ) + )[error_handler] ; // // home // home_decl = - home_header - >> !(COLON >> home_inheritance_spec) - >> !(SUPPORTS >> home_support_spec) - >> MANAGES >> home_manage_spec - >> LCBRACE[act_home_open_scope] - >> home_body - >> RCBRACE[act_home_close_scope] - >> SEMI[act_home_end] - ; - - home_header = HOME >> simple_identifier[act_home_begin] + HOME + >> guard + ( + assertion ("home name expected") + ( + simple_identifier[act_home_begin] + ) + >> hood + ( + !(COLON >> home_inheritance_spec) + >> !(SUPPORTS >> home_support_spec) + >> assertion ("'manages' expected", + DiagnosticType::BEFORE) + ( + MANAGES + ) + >> assertion ("executor name expected") + ( + identifier[act_home_manages] + ) + >> assertion ("'{' expected") + ( + LCBRACE[act_home_open_scope] + ) + >> hood (home_body) + [ + handler (f.home (), + &SemanticAction::Home::close_scope) + ] + >> assertion ("'}' expected", + f.home (), + &SemanticAction::Home::close_scope, + DiagnosticType::BEFORE) + ( + RCBRACE[act_home_close_scope] + ) + ) + [ + handler (f.home (), + &SemanticAction::Home::end) + ] + >> assertion ("';' expected", + f.home (), + &SemanticAction::Home::end, + RecoveryMethod::NONE) + ( + SEMI[act_home_end] + ) + )[error_handler] ; - home_inheritance_spec = identifier[act_home_inherits] + home_inheritance_spec = + guard + ( + assertion ("base home name expected") + ( + identifier[act_home_inherits] + ) + )[error_handler] ; home_support_spec = - identifier[act_home_supports] - >> *(COMMA >> identifier[act_home_supports]) - ; - - home_manage_spec = identifier[act_home_manages] + guard + ( + assertion ("supported interface name expected") + ( + identifier[act_home_supports] + ) + >> *( + COMMA + >> assertion ("supported interface name expected") + ( + identifier[act_home_supports] + ) + ) + )[error_handler] ; home_body = @@ -515,12 +986,41 @@ namespace CCF // home_factory_decl = FACTORY - >> simple_identifier[act_home_factory_name] - >> LPAREN - >> home_factory_parameter_list - >> RPAREN - >> !(RAISES >> LPAREN >> home_factory_raises_list >> RPAREN) - >> SEMI + >> guard + ( + assertion ("factory name expected") + ( + simple_identifier[act_home_factory_name] + ) + >> assertion ("'(' expected") + ( + LPAREN + ) + >> home_factory_parameter_list + >> assertion ("parameter declaration or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + >> !( + RAISES + >> assertion ("'(' expected") + ( + LPAREN + ) + >> home_factory_raises_list + >> assertion ("',' or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; home_factory_parameter_list = @@ -532,12 +1032,37 @@ namespace CCF home_factory_parameter = IN - >> (identifier >> simple_identifier)[act_home_factory_parameter] + >> guard + ( + ( + assertion ("type name expected") + ( + identifier + ) + >> assertion ("parameter name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) + )[act_home_factory_parameter] + )[error_handler] ; home_factory_raises_list = - identifier[act_home_factory_raises] - >> *(COMMA >> identifier[act_home_factory_raises]) + guard + ( + assertion ("exception name expected") + ( + identifier[act_home_factory_raises] + ) + >> *( + COMMA + >> assertion ("exception name expected") + ( + identifier[act_home_factory_raises] + ) + ) + )[error_handler] ; @@ -546,12 +1071,41 @@ namespace CCF // home_finder_decl = FINDER - >> simple_identifier[act_home_finder_name] - >> LPAREN - >> home_finder_parameter_list - >> RPAREN - >> !(RAISES >> LPAREN >> home_finder_raises_list >> RPAREN) - >> SEMI + >> guard + ( + assertion ("finder name expected") + ( + simple_identifier[act_home_finder_name] + ) + >> assertion ("'(' expected") + ( + LPAREN + ) + >> home_finder_parameter_list + >> assertion ("parameter declaration or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + >> !( + RAISES + >> assertion ("'(' expected") + ( + LPAREN + ) + >> home_finder_raises_list + >> assertion ("',' or ')' expected", + DiagnosticType::BEFORE) + ( + RPAREN + ) + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] ; home_finder_parameter_list = @@ -563,12 +1117,37 @@ namespace CCF home_finder_parameter = IN - >> (identifier >> simple_identifier)[act_home_finder_parameter] + >> guard + ( + ( + assertion ("type name expected") + ( + identifier + ) + >> assertion ("parameter name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) + )[act_home_finder_parameter] + )[error_handler] ; home_finder_raises_list = - identifier[act_home_finder_raises] - >> *(COMMA >> identifier[act_home_finder_raises]) + guard + ( + assertion ("exception name expected") + ( + identifier[act_home_finder_raises] + ) + >> *( + COMMA + >> assertion ("exception name expected") + ( + identifier[act_home_finder_raises] + ) + ) + )[error_handler] ; } } diff --git a/CIAO/CCF/CCF/IDL3/Parser.hpp b/CIAO/CCF/CCF/IDL3/Parser.hpp index 39a11f022ca..715045f2466 100644 --- a/CIAO/CCF/CCF/IDL3/Parser.hpp +++ b/CIAO/CCF/CCF/IDL3/Parser.hpp @@ -48,7 +48,6 @@ namespace CCF // component // Rule component_decl; - Rule component_def_trailer; Rule component_inheritance_spec; Rule component_support_spec; Rule component_body; @@ -65,7 +64,6 @@ namespace CCF Rule concrete_event_type_decl; Rule event_type_inheritance_spec; Rule event_type_supports_spec; - Rule event_type_def_trailer; Rule event_type_body; Rule event_type_factory_decl; @@ -76,10 +74,8 @@ namespace CCF // home // Rule home_decl; - Rule home_header; Rule home_inheritance_spec; Rule home_support_spec; - Rule home_manage_spec; Rule home_body; Rule home_factory_decl; diff --git a/CIAO/CCF/CCF/IDL3/SemanticAction/Component.hpp b/CIAO/CCF/CCF/IDL3/SemanticAction/Component.hpp index 77b8cdbe5e5..9a8eeb645c8 100644 --- a/CIAO/CCF/CCF/IDL3/SemanticAction/Component.hpp +++ b/CIAO/CCF/CCF/IDL3/SemanticAction/Component.hpp @@ -28,6 +28,12 @@ namespace CCF supports (IdentifierPtr const& id) = 0; virtual void + open_scope () = 0; + + virtual void + close_scope () = 0; + + virtual void end () = 0; }; } diff --git a/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp b/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp index e4b15430921..f6891d6ee24 100644 --- a/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp +++ b/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp @@ -34,6 +34,12 @@ namespace CCF supports (IdentifierPtr const& id) = 0; virtual void + open_scope () = 0; + + virtual void + close_scope () = 0; + + virtual void end () = 0; }; } diff --git a/CIAO/CCF/CCF/IDL3/SemanticAction/Home.hpp b/CIAO/CCF/CCF/IDL3/SemanticAction/Home.hpp index b0b219370a1..9dac172d39e 100644 --- a/CIAO/CCF/CCF/IDL3/SemanticAction/Home.hpp +++ b/CIAO/CCF/CCF/IDL3/SemanticAction/Home.hpp @@ -28,6 +28,12 @@ namespace CCF manages (IdentifierPtr const& id) = 0; virtual void + open_scope () = 0; + + virtual void + close_scope () = 0; + + virtual void end () = 0; }; } diff --git a/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.cpp b/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.cpp index 52c89b1fe81..4bfc9818c65 100644 --- a/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.cpp +++ b/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.cpp @@ -60,7 +60,7 @@ namespace CCF cerr << ctx.file () << ":" << id->line () << ": error: " << "declaration with name \'" << name << "\' visible from scope \'" << from - << "\' is not an eventtype declaration" << endl; + << "\' is not an interface declaration" << endl; cerr << ctx.file () << ":" << id->line () << ": error: " << "using non-interface type in provides declaration is " diff --git a/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.cpp b/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.cpp index 1ad850502b0..ce32f39dea0 100644 --- a/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.cpp +++ b/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.cpp @@ -67,7 +67,7 @@ namespace CCF cerr << ctx.file () << ":" << id->line () << ": error: " << "declaration with name \'" << name << "\' visible from scope \'" << from - << "\' is not an eventtype declaration" << endl; + << "\' is not an interface declaration" << endl; cerr << ctx.file () << ":" << id->line () << ": error: " << "using non-interface type in uses declaration is " diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index ebea2cb2457..356dfc673ca 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,25 @@ +Wed Oct 25 14:54:03 UTC 2006 Boris Kolpackov <boris@codesynthesis.com> + + * CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp: + * CCF/CCF/CIDL/SemanticAction/Composition.hpp: + * CCF/CCF/IDL3/SemanticAction/Impl/Uses.cpp: + * CCF/CCF/IDL3/SemanticAction/Impl/Provides.cpp: + * CCF/CCF/IDL3/SemanticAction/Component.hpp: + * CCF/CCF/IDL3/SemanticAction/EventType.hpp: + * CCF/CCF/IDL3/SemanticAction/Home.hpp: + + Minor fixes and cleanups. + + * CCF/CCF/IDL2/Parsing/Recovery.hpp: + * CCF/CCF/IDL2/Parser.hpp: + * CCF/CCF/IDL2/Parser.cpp: + * CCF/CCF/CIDL/Parser.hpp: + * CCF/CCF/CIDL/Parser.cpp: + * CCF/CCF/IDL3/Parser.hpp: + * CCF/CCF/IDL3/Parser.cpp: + + Added syntax errors to every grammar rule. + Wed Oct 25 11:02:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> * examples/Null_Component/StaticDAnCEApp.mpc: |