📄 gcc2.9.txt
字号:
{ end_only_namespace_names (); if (lastiddecl) $5 = lastiddecl; do_namespace_alias ($2, $5); } ;using_decl: USING qualified_id { $$ = $2; } | USING global_scope qualified_id { $$ = $3; } | USING global_scope unqualified_id { $$ = $3; } ;namespace_using_decl: USING namespace_qualifier identifier { $$ = build_parse_node (SCOPE_REF, $2, $3); } | USING global_scope identifier { $$ = build_parse_node (SCOPE_REF, global_namespace, $3); } | USING global_scope namespace_qualifier identifier { $$ = build_parse_node (SCOPE_REF, $3, $4); } ;using_directive: USING NAMESPACE { begin_only_namespace_names (); } any_id ';' { end_only_namespace_names (); /* If no declaration was found, the using-directive is invalid. Since that was not reported, we need the identifier for the error message. */ if (TREE_CODE ($4) == IDENTIFIER_NODE && lastiddecl) $4 = lastiddecl; do_using_directive ($4); } ;namespace_qualifier: NSNAME SCOPE { if (TREE_CODE ($$) == IDENTIFIER_NODE) $$ = lastiddecl; got_scope = $$; } | namespace_qualifier NSNAME SCOPE { $$ = $2; if (TREE_CODE ($$) == IDENTIFIER_NODE) $$ = lastiddecl; got_scope = $$; } ; any_id: unqualified_id | qualified_id | global_scope qualified_id { $$ = $2; } | global_scope unqualified_id { $$ = $2; } ;extern_lang_string: EXTERN_LANG_STRING { push_lang_context ($1); } | extern_lang_string EXTERN_LANG_STRING { if (current_lang_name != $2) cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name); pop_lang_context (); push_lang_context ($2); } ;template_header: TEMPLATE '<' { begin_template_parm_list (); } template_parm_list '>' { $$ = end_template_parm_list ($4); } | TEMPLATE '<' '>' { begin_specialization(); $$ = NULL_TREE; } ;template_parm_list: template_parm { $$ = process_template_parm (NULL_TREE, $1); } | template_parm_list ',' template_parm { $$ = process_template_parm ($1, $3); } ;maybe_identifier: identifier { $$ = $1; } | /* empty */ { $$ = NULL_TREE; } ; template_type_parm: aggr maybe_identifier { $$ = finish_template_type_parm ($1, $2); } | TYPENAME_KEYWORD maybe_identifier { $$ = finish_template_type_parm (class_type_node, $2); } ;template_template_parm: template_header aggr maybe_identifier { $$ = finish_template_template_parm ($2, $3); } ;template_parm: /* The following rules introduce a new reduce/reduce conflict on the ',' and '>' input tokens: they are valid prefixes for a `structsp', which means they could match a nameless parameter. See 14.6, paragraph 3. By putting them before the `parm' rule, we get their match before considering them nameless parameter declarations. */ template_type_parm { $$ = build_tree_list (NULL_TREE, $1); } | template_type_parm '=' type_id { $$ = build_tree_list (groktypename ($3.t), $1); } | parm { $$ = build_tree_list (NULL_TREE, $1.t); } | parm '=' expr_no_commas %prec ARITHCOMPARE { $$ = build_tree_list ($3, $1.t); } | template_template_parm { $$ = build_tree_list (NULL_TREE, $1); } | template_template_parm '=' template_arg { if (TREE_CODE ($3) != TEMPLATE_DECL && TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM && TREE_CODE ($3) != TYPE_DECL) { error ("invalid default template argument"); $3 = error_mark_node; } $$ = build_tree_list ($3, $1); } ;template_def: template_header template_extdef { finish_template_decl ($1); } | template_header error %prec EMPTY { finish_template_decl ($1); } ;template_extdef: fndef eat_saved_input { if (pending_inlines) do_pending_inlines (); } | template_datadef { if (pending_inlines) do_pending_inlines (); } | template_def { if (pending_inlines) do_pending_inlines (); } | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input { if (pending_inlines) do_pending_inlines (); pop_lang_context (); } | extern_lang_string .hush_warning template_datadef .warning_ok { if (pending_inlines) do_pending_inlines (); pop_lang_context (); } | extension template_extdef { pedantic = $<itype>1; } ;template_datadef: nomods_initdecls ';' | declmods notype_initdecls ';' {} | typed_declspecs initdecls ';' { note_list_got_semicolon ($1.t); } | structsp ';' { maybe_process_partial_specialization ($1.t); note_got_semicolon ($1.t); } ;datadef: nomods_initdecls ';' | declmods notype_initdecls ';' {} | typed_declspecs initdecls ';' { note_list_got_semicolon ($1.t); } | declmods ';' { pedwarn ("empty declaration"); } | explicit_instantiation ';' | typed_declspecs ';' { tree t, attrs; split_specs_attrs ($1.t, &t, &attrs); shadow_tag (t); note_list_got_semicolon ($1.t); } | error ';' | error '}' | ';' ;ctor_initializer_opt: nodecls { $$ = 0; } | base_init { $$ = 1; } ;maybe_return_init: /* empty */ | return_init | return_init ';' ;eat_saved_input: /* empty */ | END_OF_SAVED_INPUT ;fndef: fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error { finish_function (lineno, (int)$3, 0); } | fn.def1 maybe_return_init function_try_block { int nested = (hack_decl_function_context (current_function_decl) != NULL_TREE); finish_function (lineno, (int)$3, nested); } | fn.def1 maybe_return_init error { } ;constructor_declarator: nested_name_specifier SELFNAME '(' { $$ = begin_constructor_declarator ($1, $2); } parmlist ')' cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); } | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt { $$ = begin_constructor_declarator ($1, $2); $$ = make_call_declarator ($$, empty_parms (), $4, $5); } | global_scope nested_name_specifier SELFNAME '(' { $$ = begin_constructor_declarator ($2, $3); } parmlist ')' cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); } | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt { $$ = begin_constructor_declarator ($2, $3); $$ = make_call_declarator ($$, empty_parms (), $5, $6); } | nested_name_specifier self_template_type '(' { $$ = begin_constructor_declarator ($1, $2); } parmlist ')' cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); } | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt { $$ = begin_constructor_declarator ($1, $2); $$ = make_call_declarator ($$, empty_parms (), $4, $5); } | global_scope nested_name_specifier self_template_type '(' { $$ = begin_constructor_declarator ($2, $3); } parmlist ')' cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); } | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt { $$ = begin_constructor_declarator ($2, $3); $$ = make_call_declarator ($$, empty_parms (), $5, $6); } ;fn.def1: typed_declspecs declarator { if (!begin_function_definition ($1.t, $2)) YYERROR1; } | declmods notype_declarator { if (!begin_function_definition ($1, $2)) YYERROR1; } | notype_declarator { if (!begin_function_definition (NULL_TREE, $1)) YYERROR1; } | declmods constructor_declarator { if (!begin_function_definition ($1, $2)) YYERROR1; } | constructor_declarator { if (!begin_function_definition (NULL_TREE, $1)) YYERROR1; } ;component_constructor_declarator: SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($1, $3, $5, $6); } | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($1, empty_parms (), $3, $4); } | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($1, $3, $5, $6); } | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt { $$ = make_call_declarator ($1, empty_parms (), $3, $4); } ;/* more C++ complexity. See component_decl for a comment on the reduce/reduce conflict introduced by these rules. */fn.def2: declmods component_constructor_declarator { tree specs, attrs; split_specs_attrs ($1, &specs, &attrs); attrs = build_tree_list (attrs, NULL_TREE); $$ = start_method (specs, $2, attrs); rest_of_mdef: if (! $$) YYERROR1; if (yychar == YYEMPTY) yychar = YYLEX; reinit_parse_for_method (yychar, $$); } | component_constructor_declarator { $$ = start_method (NULL_TREE, $1, NULL_TREE); goto rest_of_mdef; } | typed_declspecs declarator { tree specs, attrs; split_specs_attrs ($1.t, &specs, &attrs); attrs = build_tree_list (attrs, NULL_TREE); $$ = start_method (specs, $2, attrs); goto rest_of_mdef; } | declmods notype_declarator { tree specs, attrs; split_specs_attrs ($1, &specs, &attrs); attrs = build_tree_list (attrs, NULL_TREE); $$ = start_method (specs, $2, attrs); goto rest_of_mdef; } | notype_declarator { $$ = start_method (NULL_TREE, $$, NULL_TREE); goto rest_of_mdef; } | declmods constructor_declarator { tree specs, attrs; split_specs_attrs ($1, &specs, &attrs); attrs = build_tree_list (attrs, NULL_TREE); $$ = start_method (specs, $2, attrs); goto rest_of_mdef; } | constructor_declarator { $$ = start_method (NULL_TREE, $$, NULL_TREE); goto rest_of_mdef; } ;return_id: RETURN_KEYWORD IDENTIFIER { if (! current_function_parms_stored) store_parm_decls (); $$ = $2; } ;return_init: return_id maybe_init { store_return_init ($<ttype>$, $2); } | return_id '(' nonnull_exprlist ')' { store_return_init ($<ttype>$, $3); } | return_id LEFT_RIGHT { store_return_init ($<ttype>$, NULL_TREE); } ;base_init: ':' .set_base_init member_init_list { if ($3 == 0) error ("no base initializers given following ':'"); setup_vtbl_ptr (); /* Always keep the BLOCK node associated with the outermost pair of curley braces of a function. These are needed for correct operation of dwarfout.c. */ keep_next_level (); } ;.set_base_init: /* empty */ { if (! current_function_parms_stored) store_parm_decls (); if (DECL_CONSTRUCTOR_P (current_function_decl)) { /* Make a contour for the initializer list. */ pushlevel (0); clear_last_expr (); expand_start_bindings (0); } else if (current_class_type == NULL_TREE) error ("base initializers not allowed for non-member functions"); else if (! DECL_CONSTRUCTOR_P (current_function_decl)) error ("only constructors take base initializers"); } ;member_init_list: /* empty */ { $$ = 0; } | member_init { $$ = 1; } | member_init_list ',' member_init | member_init_list error ;member_init: '(' nonnull_exprlist ')' { if (current_class_name) pedwarn ("anachronistic old style base class initializer"); expand_member_init (current_class_ref, NULL_TREE, $2); } | LEFT_RIGHT { if (current_class_name) pedwarn ("anachronistic old style base class initializer"); expand_member_init (current_class_ref, NULL_TREE, void_type_node); } | notype_identifier '(' nonnull_exprlist ')' { expand_member_init (current_class_ref, $1, $3); } | notype_identifier LEFT_RIGHT { expand_member_init (current_class_ref, $1, void_type_node); } | nonnested_type '(' nonnull_exprlist ')' { expand_member_init (current_class_ref, $1, $3); } | nonnested_type LEFT_RIGHT { expand_member_init (current_class_ref, $1, void_type_node); } | typename_sub '(' nonnull_exprlist ')' { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1), $3); } | typename_sub LEFT_RIGHT { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1), void_type_node); } ;identifier: IDENTIFIER | TYPENAME | SELFNAME | PTYPENAME | NSNAME ;notype_identifier: IDENTIFIER | PTYPENAME | NSNAME %prec EMPTY
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -