summaryrefslogtreecommitdiff
path: root/CIAO/CCF/CCF/IDL2/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/CCF/CCF/IDL2/Parser.cpp')
-rw-r--r--CIAO/CCF/CCF/IDL2/Parser.cpp1742
1 files changed, 1299 insertions, 443 deletions
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]
;
}
}