]> gcc.gnu.org Git - gcc.git/blob - gcc/cp/parse.y
cp-tre.h (finish_function): Change prototype.
[gcc.git] / gcc / cp / parse.y
1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
4 Hacked by Michael Tiemann (tiemann@cygnus.com)
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23
24 /* This grammar is based on the GNU CC grammar. */
25
26 /* Note: Bison automatically applies a default action of "$$ = $1" for
27 all derivations; this is applied before the explicit action, if one
28 is given. Keep this in mind when reading the actions. */
29
30 %{
31 /* Cause the `yydebug' variable to be defined. */
32 #define YYDEBUG 1
33
34 #include "config.h"
35
36 #include "system.h"
37
38 #include "tree.h"
39 #include "input.h"
40 #include "flags.h"
41 #include "lex.h"
42 #include "cp-tree.h"
43 #include "output.h"
44 #include "except.h"
45 #include "toplev.h"
46 #include "ggc.h"
47
48 /* Since parsers are distinct for each language, put the language string
49 definition here. (fnf) */
50 const char * const language_string = "GNU C++";
51
52 extern struct obstack permanent_obstack;
53
54 extern int end_of_file;
55
56 /* Like YYERROR but do call yyerror. */
57 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
58
59 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
60 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
61
62 /* Contains the statement keyword (if/while/do) to include in an
63 error message if the user supplies an empty conditional expression. */
64 static const char *cond_stmt_keyword;
65
66 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
67 int have_extern_spec;
68 int used_extern_spec;
69
70 /* List of types and structure classes of the current declaration. */
71 static tree current_declspecs;
72
73 /* List of prefix attributes in effect.
74 Prefix attributes are parsed by the reserved_declspecs and declmods
75 rules. They create a list that contains *both* declspecs and attrs. */
76 /* ??? It is not clear yet that all cases where an attribute can now appear in
77 a declspec list have been updated. */
78 static tree prefix_attributes;
79
80 /* When defining an aggregate, this is the kind of the most recent one
81 being defined. (For example, this might be class_type_node.) */
82 static tree current_aggr;
83
84 /* When defining an enumeration, this is the type of the enumeration. */
85 static tree current_enum_type;
86
87 static tree empty_parms PARAMS ((void));
88 static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int));
89 static tree parse_decl PARAMS ((tree, tree, int));
90 static void parse_end_decl PARAMS ((tree, tree, tree));
91 static tree parse_field0 PARAMS ((tree, tree, tree, tree, tree, tree));
92 static tree parse_field PARAMS ((tree, tree, tree, tree));
93 static tree parse_bitfield0 PARAMS ((tree, tree, tree, tree, tree));
94 static tree parse_bitfield PARAMS ((tree, tree, tree));
95 static tree parse_method PARAMS ((tree, tree, tree));
96 static void frob_specs PARAMS ((tree, tree));
97
98 /* Cons up an empty parameter list. */
99 static inline tree
100 empty_parms ()
101 {
102 tree parms;
103
104 if (strict_prototype
105 || current_class_type != NULL)
106 parms = void_list_node;
107 else
108 parms = NULL_TREE;
109 return parms;
110 }
111
112 /* Record the decl-specifiers, attributes and type lookups from the
113 decl-specifier-seq in a declaration. */
114
115 static void
116 frob_specs (specs_attrs, lookups)
117 tree specs_attrs, lookups;
118 {
119 save_type_access_control (lookups);
120 split_specs_attrs (specs_attrs, &current_declspecs, &prefix_attributes);
121 if (current_declspecs
122 && TREE_CODE (current_declspecs) != TREE_LIST)
123 current_declspecs = build_decl_list (NULL_TREE, current_declspecs);
124 if (have_extern_spec && !used_extern_spec)
125 {
126 current_declspecs = decl_tree_cons (NULL_TREE,
127 get_identifier ("extern"),
128 current_declspecs);
129 used_extern_spec = 1;
130 }
131 }
132
133 static tree
134 parse_decl (declarator, attributes, initialized)
135 tree declarator, attributes;
136 int initialized;
137 {
138 return start_decl (declarator, current_declspecs, initialized,
139 attributes, prefix_attributes);
140 }
141
142 static tree
143 parse_decl0 (declarator, specs_attrs, lookups, attributes, initialized)
144 tree declarator, specs_attrs, lookups, attributes;
145 int initialized;
146 {
147 frob_specs (specs_attrs, lookups);
148 return parse_decl (declarator, attributes, initialized);
149 }
150
151 static void
152 parse_end_decl (decl, init, asmspec)
153 tree decl, init, asmspec;
154 {
155 /* If decl is NULL_TREE, then this was a variable declaration using
156 () syntax for the initializer, so we handled it in grokdeclarator. */
157 if (decl)
158 decl_type_access_control (decl);
159 cp_finish_decl (decl, init, asmspec, init ? LOOKUP_ONLYCONVERTING : 0);
160 }
161
162 static tree
163 parse_field (declarator, attributes, asmspec, init)
164 tree declarator, attributes, asmspec, init;
165 {
166 tree d = grokfield (declarator, current_declspecs, init, asmspec,
167 build_tree_list (attributes, prefix_attributes));
168 decl_type_access_control (d);
169 return d;
170 }
171
172 static tree
173 parse_field0 (declarator, specs_attrs, lookups, attributes, asmspec, init)
174 tree declarator, specs_attrs, lookups, attributes, asmspec, init;
175 {
176 frob_specs (specs_attrs, lookups);
177 return parse_field (declarator, attributes, asmspec, init);
178 }
179
180 static tree
181 parse_bitfield (declarator, attributes, width)
182 tree declarator, attributes, width;
183 {
184 tree d = grokbitfield (declarator, current_declspecs, width);
185 cplus_decl_attributes (d, attributes, prefix_attributes);
186 decl_type_access_control (d);
187 return d;
188 }
189
190 static tree
191 parse_bitfield0 (declarator, specs_attrs, lookups, attributes, width)
192 tree declarator, specs_attrs, lookups, attributes, width;
193 {
194 frob_specs (specs_attrs, lookups);
195 return parse_bitfield (declarator, attributes, width);
196 }
197
198 static tree
199 parse_method (declarator, specs_attrs, lookups)
200 tree declarator, specs_attrs, lookups;
201 {
202 tree d;
203 frob_specs (specs_attrs, lookups);
204 d = start_method (current_declspecs, declarator, prefix_attributes);
205 decl_type_access_control (d);
206 return d;
207 }
208
209 void
210 cp_parse_init ()
211 {
212 ggc_add_tree_root (&current_declspecs, 1);
213 ggc_add_tree_root (&prefix_attributes, 1);
214 ggc_add_tree_root (&current_aggr, 1);
215 ggc_add_tree_root (&current_enum_type, 1);
216 }
217 %}
218
219 %start program
220
221 %union {
222 long itype;
223 tree ttype;
224 char *strtype;
225 enum tree_code code;
226 flagged_type_tree ftype;
227 struct pending_inline *pi;
228 }
229
230 /* All identifiers that are not reserved words
231 and are not declared typedefs in the current block */
232 %token IDENTIFIER
233
234 /* All identifiers that are declared typedefs in the current block.
235 In some contexts, they are treated just like IDENTIFIER,
236 but they can also serve as typespecs in declarations. */
237 %token TYPENAME
238 %token SELFNAME
239
240 /* A template function. */
241 %token PFUNCNAME
242
243 /* Reserved words that specify storage class.
244 yylval contains an IDENTIFIER_NODE which indicates which one. */
245 %token SCSPEC
246
247 /* Reserved words that specify type.
248 yylval contains an IDENTIFIER_NODE which indicates which one. */
249 %token TYPESPEC
250
251 /* Reserved words that qualify type: "const" or "volatile".
252 yylval contains an IDENTIFIER_NODE which indicates which one. */
253 %token CV_QUALIFIER
254
255 /* Character or numeric constants.
256 yylval is the node for the constant. */
257 %token CONSTANT
258
259 /* String constants in raw form.
260 yylval is a STRING_CST node. */
261 %token STRING
262
263 /* "...", used for functions with variable arglists. */
264 %token ELLIPSIS
265
266 /* the reserved words */
267 /* SCO include files test "ASM", so use something else. */
268 %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
269 %token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
270 %token SIGOF
271 %token ATTRIBUTE EXTENSION LABEL
272 %token REALPART IMAGPART VA_ARG
273
274 /* the reserved words... C++ extensions */
275 %token <ttype> AGGR
276 %token <ttype> VISSPEC
277 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
278 %token NAMESPACE TYPENAME_KEYWORD USING
279 %token LEFT_RIGHT TEMPLATE
280 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
281 %token <itype> SCOPE
282
283 /* Define the operator tokens and their precedences.
284 The value is an integer because, if used, it is the tree code
285 to use in the expression made from the operator. */
286
287 %left EMPTY /* used to resolve s/r with epsilon */
288
289 %left error
290
291 /* Add precedence rules to solve dangling else s/r conflict */
292 %nonassoc IF
293 %nonassoc ELSE
294
295 %left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
296
297 %left '{' ',' ';'
298
299 %nonassoc THROW
300 %right <code> ':'
301 %right <code> ASSIGN '='
302 %right <code> '?'
303 %left <code> OROR
304 %left <code> ANDAND
305 %left <code> '|'
306 %left <code> '^'
307 %left <code> '&'
308 %left <code> MIN_MAX
309 %left <code> EQCOMPARE
310 %left <code> ARITHCOMPARE '<' '>'
311 %left <code> LSHIFT RSHIFT
312 %left <code> '+' '-'
313 %left <code> '*' '/' '%'
314 %left <code> POINTSAT_STAR DOT_STAR
315 %right <code> UNARY PLUSPLUS MINUSMINUS '~'
316 %left HYPERUNARY
317 %left <ttype> LEFT_RIGHT
318 %left <code> POINTSAT '.' '(' '['
319
320 %right SCOPE /* C++ extension */
321 %nonassoc NEW DELETE TRY CATCH
322
323 %type <code> unop
324
325 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
326 %type <ttype> PFUNCNAME maybe_identifier
327 %type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
328 %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
329 %type <ttype> reserved_declspecs boolean.literal
330 %type <ttype> reserved_typespecquals
331 %type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
332 %type <ttype> init initlist maybeasm maybe_init defarg defarg1
333 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
334 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
335 %type <ttype> any_word
336
337 %type <ttype> compstmt implicitly_scoped_stmt
338
339 %type <ttype> declarator notype_declarator after_type_declarator
340 %type <ttype> notype_declarator_intern absdcl_intern
341 %type <ttype> after_type_declarator_intern
342 %type <ttype> direct_notype_declarator direct_after_type_declarator
343 %type <itype> components notype_components
344 %type <ttype> component_decl component_decl_1
345 %type <ttype> component_declarator component_declarator0
346 %type <ttype> notype_component_declarator notype_component_declarator0
347 %type <ttype> after_type_component_declarator after_type_component_declarator0
348 %type <ttype> absdcl cv_qualifiers
349 %type <ttype> direct_abstract_declarator conversion_declarator
350 %type <ttype> new_declarator direct_new_declarator
351 %type <ttype> xexpr parmlist parms bad_parm
352 %type <ttype> identifiers_or_typenames
353 %type <ttype> fcast_or_absdcl regcast_or_absdcl
354 %type <ttype> expr_or_declarator expr_or_declarator_intern
355 %type <ttype> complex_notype_declarator
356 %type <ttype> notype_unqualified_id unqualified_id qualified_id
357 %type <ttype> template_id do_id object_template_id notype_template_declarator
358 %type <ttype> overqualified_id notype_qualified_id any_id
359 %type <ttype> complex_direct_notype_declarator functional_cast
360 %type <ttype> complex_parmlist parms_comma
361 %type <ttype> namespace_qualifier namespace_using_decl
362
363 %type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
364 %type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
365 %type <ftype> structsp typespecqual_reserved parm named_parm full_parm
366 %type <ftype> declmods
367
368 %type <itype> extension
369
370 /* C++ extensions */
371 %token <ttype> PTYPENAME
372 %token <ttype> EXTERN_LANG_STRING ALL
373 %token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
374 %token <pi> PRE_PARSED_FUNCTION_DECL
375 %type <ttype> component_constructor_declarator
376 %type <ttype> fn.def2 return_id constructor_declarator
377 %type <pi> fn.defpen
378 %type <itype> ctor_initializer_opt function_try_block
379 %type <ttype> named_class_head_sans_basetype
380 %type <ftype> class_head named_class_head
381 %type <ftype> named_complex_class_head_sans_basetype
382 %type <ttype> unnamed_class_head
383 %type <ttype> base_class_list
384 %type <ttype> base_class_access_list
385 %type <ttype> base_class maybe_base_class_list base_class.1
386 %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
387 %type <ttype> operator_name
388 %type <ttype> object aggr
389 %type <itype> new delete
390 /* %type <ttype> primary_no_id */
391 %type <ttype> maybe_parmlist
392 %type <itype> member_init_list
393 %type <ttype> template_header template_parm_list template_parm
394 %type <ttype> template_type_parm template_template_parm
395 %type <code> template_close_bracket
396 %type <ttype> apparent_template_type
397 %type <ttype> template_type template_arg_list template_arg_list_opt
398 %type <ttype> template_arg
399 %type <ttype> condition xcond paren_cond_or_null
400 %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
401 %type <ttype> complete_type_name notype_identifier nonnested_type
402 %type <ttype> complex_type_name nested_name_specifier_1
403 %type <ttype> new_initializer new_placement
404 %type <ttype> using_decl
405 %type <ttype> typename_sub typename_sub0 typename_sub1 typename_sub2
406 %type <ttype> explicit_template_type
407 /* in order to recognize aggr tags as defining and thus shadowing. */
408 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
409 %type <ttype> named_class_head_sans_basetype_defn
410 %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
411 %type <ttype> handler_args
412 %type <ttype> self_template_type .finish_template_type
413
414 %token NSNAME
415 %type <ttype> NSNAME
416
417 /* Used in lex.c for parsing pragmas. */
418 %token END_OF_LINE
419
420 /* lex.c and pt.c depend on this being the last token. Define
421 any new tokens before this one! */
422 %token END_OF_SAVED_INPUT
423 \f
424 %{
425 /* Tell yyparse how to print a token's value, if yydebug is set. */
426 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
427 extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
428 %}
429 \f
430 %%
431 program:
432 /* empty */
433 | extdefs
434 { finish_translation_unit (); }
435 ;
436
437 /* the reason for the strange actions in this rule
438 is so that notype_initdecls when reached via datadef
439 can find a valid list of type and sc specs in $0. */
440
441 extdefs:
442 { $<ttype>$ = NULL_TREE; }
443 lang_extdef
444 { $<ttype>$ = NULL_TREE; ggc_collect (); }
445 | extdefs lang_extdef
446 { $<ttype>$ = NULL_TREE; ggc_collect (); }
447 ;
448
449 extdefs_opt:
450 extdefs
451 | /* empty */
452 ;
453
454 .hush_warning:
455 { have_extern_spec = 1;
456 used_extern_spec = 0;
457 $<ttype>$ = NULL_TREE; }
458 ;
459 .warning_ok:
460 { have_extern_spec = 0; }
461 ;
462
463 extension:
464 EXTENSION
465 { $$ = pedantic;
466 pedantic = 0; }
467 ;
468
469 asm_keyword:
470 ASM_KEYWORD
471 ;
472
473 lang_extdef:
474 { if (pending_lang_change) do_pending_lang_change();
475 type_lookups = NULL_TREE; }
476 extdef
477 { if (! toplevel_bindings_p ())
478 pop_everything (); }
479 ;
480
481 extdef:
482 fndef eat_saved_input
483 { if (pending_inlines) do_pending_inlines (); }
484 | datadef
485 { if (pending_inlines) do_pending_inlines (); }
486 | template_def
487 { if (pending_inlines) do_pending_inlines (); }
488 | asm_keyword '(' string ')' ';'
489 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
490 assemble_asm ($3); }
491 | extern_lang_string '{' extdefs_opt '}'
492 { pop_lang_context (); }
493 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
494 { if (pending_inlines) do_pending_inlines ();
495 pop_lang_context (); }
496 | extern_lang_string .hush_warning datadef .warning_ok
497 { if (pending_inlines) do_pending_inlines ();
498 pop_lang_context (); }
499 | NAMESPACE identifier '{'
500 { push_namespace ($2); }
501 extdefs_opt '}'
502 { pop_namespace (); }
503 | NAMESPACE '{'
504 { push_namespace (NULL_TREE); }
505 extdefs_opt '}'
506 { pop_namespace (); }
507 | namespace_alias
508 | using_decl ';'
509 { do_toplevel_using_decl ($1); }
510 | using_directive
511 | extension extdef
512 { pedantic = $1; }
513 ;
514
515 namespace_alias:
516 NAMESPACE identifier '='
517 { begin_only_namespace_names (); }
518 any_id ';'
519 {
520 end_only_namespace_names ();
521 if (lastiddecl)
522 $5 = lastiddecl;
523 do_namespace_alias ($2, $5);
524 }
525 ;
526
527 using_decl:
528 USING qualified_id
529 { $$ = $2; }
530 | USING global_scope qualified_id
531 { $$ = $3; }
532 | USING global_scope unqualified_id
533 { $$ = $3; }
534 ;
535
536 namespace_using_decl:
537 USING namespace_qualifier identifier
538 { $$ = build_parse_node (SCOPE_REF, $2, $3); }
539 | USING global_scope identifier
540 { $$ = build_parse_node (SCOPE_REF, global_namespace, $3); }
541 | USING global_scope namespace_qualifier identifier
542 { $$ = build_parse_node (SCOPE_REF, $3, $4); }
543 ;
544
545 using_directive:
546 USING NAMESPACE
547 { begin_only_namespace_names (); }
548 any_id ';'
549 {
550 end_only_namespace_names ();
551 /* If no declaration was found, the using-directive is
552 invalid. Since that was not reported, we need the
553 identifier for the error message. */
554 if (TREE_CODE ($4) == IDENTIFIER_NODE && lastiddecl)
555 $4 = lastiddecl;
556 do_using_directive ($4);
557 }
558 ;
559
560 namespace_qualifier:
561 NSNAME SCOPE
562 {
563 if (TREE_CODE ($$) == IDENTIFIER_NODE)
564 $$ = lastiddecl;
565 got_scope = $$;
566 }
567 | namespace_qualifier NSNAME SCOPE
568 {
569 $$ = $2;
570 if (TREE_CODE ($$) == IDENTIFIER_NODE)
571 $$ = lastiddecl;
572 got_scope = $$;
573 }
574
575 any_id:
576 unqualified_id
577 | qualified_id
578 | global_scope qualified_id
579 { $$ = $2; }
580 | global_scope unqualified_id
581 { $$ = $2; }
582 ;
583
584 extern_lang_string:
585 EXTERN_LANG_STRING
586 { push_lang_context ($1); }
587 | extern_lang_string EXTERN_LANG_STRING
588 { if (current_lang_name != $2)
589 cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
590 pop_lang_context (); push_lang_context ($2); }
591 ;
592
593 template_header:
594 TEMPLATE '<'
595 { begin_template_parm_list (); }
596 template_parm_list '>'
597 { $$ = end_template_parm_list ($4); }
598 | TEMPLATE '<' '>'
599 { begin_specialization();
600 $$ = NULL_TREE; }
601 ;
602
603 template_parm_list:
604 template_parm
605 { $$ = process_template_parm (NULL_TREE, $1); }
606 | template_parm_list ',' template_parm
607 { $$ = process_template_parm ($1, $3); }
608 ;
609
610 maybe_identifier:
611 identifier
612 { $$ = $1; }
613 | /* empty */
614 { $$ = NULL_TREE; }
615
616 template_type_parm:
617 aggr maybe_identifier
618 { $$ = finish_template_type_parm ($1, $2); }
619 | TYPENAME_KEYWORD maybe_identifier
620 { $$ = finish_template_type_parm (class_type_node, $2); }
621 ;
622
623 template_template_parm:
624 template_header aggr maybe_identifier
625 { $$ = finish_template_template_parm ($2, $3); }
626 ;
627
628 template_parm:
629 /* The following rules introduce a new reduce/reduce
630 conflict on the ',' and '>' input tokens: they are valid
631 prefixes for a `structsp', which means they could match a
632 nameless parameter. See 14.6, paragraph 3.
633 By putting them before the `parm' rule, we get
634 their match before considering them nameless parameter
635 declarations. */
636 template_type_parm
637 { $$ = build_tree_list (NULL_TREE, $1); }
638 | template_type_parm '=' type_id
639 { $$ = build_tree_list (groktypename ($3.t), $1); }
640 | parm
641 { $$ = build_tree_list (NULL_TREE, $1.t); }
642 | parm '=' expr_no_commas %prec ARITHCOMPARE
643 { $$ = build_tree_list ($3, $1.t); }
644 | template_template_parm
645 { $$ = build_tree_list (NULL_TREE, $1); }
646 | template_template_parm '=' template_arg
647 {
648 if (TREE_CODE ($3) != TEMPLATE_DECL
649 && TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM
650 && TREE_CODE ($3) != TYPE_DECL)
651 {
652 error ("invalid default template argument");
653 $3 = error_mark_node;
654 }
655 $$ = build_tree_list ($3, $1);
656 }
657 ;
658
659 template_def:
660 template_header template_extdef
661 { finish_template_decl ($1); }
662 | template_header error %prec EMPTY
663 { finish_template_decl ($1); }
664 ;
665
666 template_extdef:
667 fndef eat_saved_input
668 { if (pending_inlines) do_pending_inlines (); }
669 | template_datadef
670 { if (pending_inlines) do_pending_inlines (); }
671 | template_def
672 { if (pending_inlines) do_pending_inlines (); }
673 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
674 { if (pending_inlines) do_pending_inlines ();
675 pop_lang_context (); }
676 | extern_lang_string .hush_warning template_datadef .warning_ok
677 { if (pending_inlines) do_pending_inlines ();
678 pop_lang_context (); }
679 | extension template_extdef
680 { pedantic = $1; }
681 ;
682
683 template_datadef:
684 nomods_initdecls ';'
685 | declmods notype_initdecls ';'
686 {}
687 | typed_declspecs initdecls ';'
688 { note_list_got_semicolon ($1.t); }
689 | structsp ';'
690 { maybe_process_partial_specialization ($1.t);
691 note_got_semicolon ($1.t); }
692 ;
693
694 datadef:
695 nomods_initdecls ';'
696 | declmods notype_initdecls ';'
697 {}
698 | typed_declspecs initdecls ';'
699 { note_list_got_semicolon ($1.t); }
700 | declmods ';'
701 { pedwarn ("empty declaration"); }
702 | explicit_instantiation ';'
703 | typed_declspecs ';'
704 {
705 tree t, attrs;
706 split_specs_attrs ($1.t, &t, &attrs);
707 shadow_tag (t);
708 note_list_got_semicolon ($1.t);
709 }
710 | error ';'
711 | error '}'
712 | ';'
713 ;
714
715 ctor_initializer_opt:
716 nodecls
717 { $$ = 0; }
718 | base_init
719 { $$ = 1; }
720 ;
721
722 maybe_return_init:
723 /* empty */
724 | return_init
725 | return_init ';'
726 ;
727
728 eat_saved_input:
729 /* empty */
730 | END_OF_SAVED_INPUT
731 ;
732
733 fndef:
734 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
735 { expand_body (finish_function ((int)$3)); }
736 | fn.def1 maybe_return_init function_try_block
737 { expand_body (finish_function ((int)$3)); }
738 | fn.def1 maybe_return_init error
739 { }
740 ;
741
742 constructor_declarator:
743 nested_name_specifier SELFNAME '('
744 { $$ = begin_constructor_declarator ($1, $2); }
745 parmlist ')' cv_qualifiers exception_specification_opt
746 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
747 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
748 { $$ = begin_constructor_declarator ($1, $2);
749 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
750 }
751 | global_scope nested_name_specifier SELFNAME '('
752 { $$ = begin_constructor_declarator ($2, $3); }
753 parmlist ')' cv_qualifiers exception_specification_opt
754 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
755 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
756 { $$ = begin_constructor_declarator ($2, $3);
757 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
758 }
759 | nested_name_specifier self_template_type '('
760 { $$ = begin_constructor_declarator ($1, $2); }
761 parmlist ')' cv_qualifiers exception_specification_opt
762 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
763 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
764 { $$ = begin_constructor_declarator ($1, $2);
765 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
766 }
767 | global_scope nested_name_specifier self_template_type '('
768 { $$ = begin_constructor_declarator ($2, $3); }
769 parmlist ')' cv_qualifiers exception_specification_opt
770 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
771 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
772 { $$ = begin_constructor_declarator ($2, $3);
773 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
774 }
775 ;
776
777 fn.def1:
778 typed_declspecs declarator
779 { check_for_new_type ("return type", $1);
780 if (!begin_function_definition ($1.t, $2))
781 YYERROR1; }
782 | declmods notype_declarator
783 { if (!begin_function_definition ($1.t, $2))
784 YYERROR1; }
785 | notype_declarator
786 { if (!begin_function_definition (NULL_TREE, $1))
787 YYERROR1; }
788 | declmods constructor_declarator
789 { if (!begin_function_definition ($1.t, $2))
790 YYERROR1; }
791 | constructor_declarator
792 { if (!begin_function_definition (NULL_TREE, $1))
793 YYERROR1; }
794 ;
795
796 component_constructor_declarator:
797 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
798 { $$ = make_call_declarator ($1, $3, $5, $6); }
799 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
800 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
801 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
802 { $$ = make_call_declarator ($1, $3, $5, $6); }
803 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
804 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
805 ;
806
807 /* more C++ complexity. See component_decl for a comment on the
808 reduce/reduce conflict introduced by these rules. */
809 fn.def2:
810 declmods component_constructor_declarator
811 { $$ = parse_method ($2, $1.t, $1.lookups);
812 rest_of_mdef:
813 if (! $$)
814 YYERROR1;
815 if (yychar == YYEMPTY)
816 yychar = YYLEX;
817 reinit_parse_for_method (yychar, $$); }
818 | component_constructor_declarator
819 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
820 goto rest_of_mdef; }
821 | typed_declspecs declarator
822 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
823 | declmods notype_declarator
824 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
825 | notype_declarator
826 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
827 goto rest_of_mdef; }
828 | declmods constructor_declarator
829 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
830 | constructor_declarator
831 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
832 goto rest_of_mdef; }
833 ;
834
835 return_id:
836 RETURN_KEYWORD IDENTIFIER
837 {
838 if (! current_function_parms_stored)
839 store_parm_decls ();
840 $$ = $2;
841 }
842 ;
843
844 return_init:
845 return_id maybe_init
846 { finish_named_return_value ($<ttype>$, $2); }
847 | return_id '(' nonnull_exprlist ')'
848 { finish_named_return_value ($<ttype>$, $3); }
849 | return_id LEFT_RIGHT
850 { finish_named_return_value ($<ttype>$, NULL_TREE); }
851 ;
852
853 base_init:
854 ':' .set_base_init member_init_list
855 {
856 if ($3 == 0)
857 error ("no base initializers given following ':'");
858 setup_vtbl_ptr ();
859 }
860 ;
861
862 .set_base_init:
863 /* empty */
864 {
865 if (! current_function_parms_stored)
866 store_parm_decls ();
867
868 if (DECL_CONSTRUCTOR_P (current_function_decl))
869 /* Make a contour for the initializer list. */
870 do_pushlevel ();
871 else if (current_class_type == NULL_TREE)
872 error ("base initializers not allowed for non-member functions");
873 else if (! DECL_CONSTRUCTOR_P (current_function_decl))
874 error ("only constructors take base initializers");
875 }
876 ;
877
878 member_init_list:
879 /* empty */
880 { $$ = 0; }
881 | member_init
882 { $$ = 1; }
883 | member_init_list ',' member_init
884 | member_init_list error
885 ;
886
887 member_init:
888 '(' nonnull_exprlist ')'
889 {
890 if (current_class_name)
891 pedwarn ("anachronistic old style base class initializer");
892 expand_member_init (current_class_ref, NULL_TREE, $2);
893 }
894 | LEFT_RIGHT
895 {
896 if (current_class_name)
897 pedwarn ("anachronistic old style base class initializer");
898 expand_member_init (current_class_ref, NULL_TREE, void_type_node);
899 }
900 | notype_identifier '(' nonnull_exprlist ')'
901 { expand_member_init (current_class_ref, $1, $3); }
902 | notype_identifier LEFT_RIGHT
903 { expand_member_init (current_class_ref, $1, void_type_node); }
904 | nonnested_type '(' nonnull_exprlist ')'
905 { expand_member_init (current_class_ref, $1, $3); }
906 | nonnested_type LEFT_RIGHT
907 { expand_member_init (current_class_ref, $1, void_type_node); }
908 | typename_sub '(' nonnull_exprlist ')'
909 { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1),
910 $3); }
911 | typename_sub LEFT_RIGHT
912 { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1),
913 void_type_node); }
914 | error
915 ;
916
917 identifier:
918 IDENTIFIER
919 | TYPENAME
920 | SELFNAME
921 | PTYPENAME
922 | NSNAME
923 ;
924
925 notype_identifier:
926 IDENTIFIER
927 | PTYPENAME
928 | NSNAME %prec EMPTY
929 ;
930
931 identifier_defn:
932 IDENTIFIER_DEFN
933 | TYPENAME_DEFN
934 | PTYPENAME_DEFN
935 ;
936
937 explicit_instantiation:
938 TEMPLATE begin_explicit_instantiation typespec ';'
939 { do_type_instantiation ($3.t, NULL_TREE);
940 yyungetc (';', 1); }
941 end_explicit_instantiation
942 | TEMPLATE begin_explicit_instantiation typed_declspecs declarator
943 { tree specs = strip_attrs ($3.t);
944 do_decl_instantiation (specs, $4, NULL_TREE); }
945 end_explicit_instantiation
946 | TEMPLATE begin_explicit_instantiation notype_declarator
947 { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); }
948 end_explicit_instantiation
949 | TEMPLATE begin_explicit_instantiation constructor_declarator
950 { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); }
951 end_explicit_instantiation
952 | SCSPEC TEMPLATE begin_explicit_instantiation typespec ';'
953 { do_type_instantiation ($4.t, $1);
954 yyungetc (';', 1); }
955 end_explicit_instantiation
956 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
957 declarator
958 { tree specs = strip_attrs ($4.t);
959 do_decl_instantiation (specs, $5, $1); }
960 end_explicit_instantiation
961 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
962 { do_decl_instantiation (NULL_TREE, $4, $1); }
963 end_explicit_instantiation
964 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
965 { do_decl_instantiation (NULL_TREE, $4, $1); }
966 end_explicit_instantiation
967 ;
968
969 begin_explicit_instantiation:
970 { begin_explicit_instantiation(); }
971
972 end_explicit_instantiation:
973 { end_explicit_instantiation(); }
974
975 /* The TYPENAME expansions are to deal with use of a template class name as
976 a template within the class itself, where the template decl is hidden by
977 a type decl. Got all that? */
978
979 template_type:
980 PTYPENAME '<' template_arg_list_opt template_close_bracket
981 .finish_template_type
982 { $$ = $5; }
983 | TYPENAME '<' template_arg_list_opt template_close_bracket
984 .finish_template_type
985 { $$ = $5; }
986 | self_template_type
987 ;
988
989 apparent_template_type:
990 template_type
991 | identifier '<' template_arg_list_opt '>'
992 .finish_template_type
993 { $$ = $5; }
994
995 self_template_type:
996 SELFNAME '<' template_arg_list_opt template_close_bracket
997 .finish_template_type
998 { $$ = $5; }
999 ;
1000
1001 .finish_template_type:
1002 {
1003 if (yychar == YYEMPTY)
1004 yychar = YYLEX;
1005
1006 $$ = finish_template_type ($<ttype>-3, $<ttype>-1,
1007 yychar == SCOPE);
1008 }
1009
1010 template_close_bracket:
1011 '>'
1012 | RSHIFT
1013 {
1014 /* Handle `Class<Class<Type>>' without space in the `>>' */
1015 pedwarn ("`>>' should be `> >' in template class name");
1016 yyungetc ('>', 1);
1017 }
1018 ;
1019
1020 template_arg_list_opt:
1021 /* empty */
1022 { $$ = NULL_TREE; }
1023 | template_arg_list
1024 ;
1025
1026 template_arg_list:
1027 template_arg
1028 { $$ = build_tree_list (NULL_TREE, $$); }
1029 | template_arg_list ',' template_arg
1030 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
1031 ;
1032
1033 template_arg:
1034 type_id
1035 { $$ = groktypename ($1.t); }
1036 | PTYPENAME
1037 { $$ = lastiddecl; }
1038 | expr_no_commas %prec ARITHCOMPARE
1039 ;
1040
1041 unop:
1042 '-'
1043 { $$ = NEGATE_EXPR; }
1044 | '+'
1045 { $$ = CONVERT_EXPR; }
1046 | PLUSPLUS
1047 { $$ = PREINCREMENT_EXPR; }
1048 | MINUSMINUS
1049 { $$ = PREDECREMENT_EXPR; }
1050 | '!'
1051 { $$ = TRUTH_NOT_EXPR; }
1052 ;
1053
1054 expr:
1055 nontrivial_exprlist
1056 { $$ = build_x_compound_expr ($$); }
1057 | expr_no_commas
1058 ;
1059
1060 paren_expr_or_null:
1061 LEFT_RIGHT
1062 { error ("ISO C++ forbids an empty condition for `%s'",
1063 cond_stmt_keyword);
1064 $$ = integer_zero_node; }
1065 | '(' expr ')'
1066 { $$ = $2; }
1067 ;
1068
1069 paren_cond_or_null:
1070 LEFT_RIGHT
1071 { error ("ISO C++ forbids an empty condition for `%s'",
1072 cond_stmt_keyword);
1073 $$ = integer_zero_node; }
1074 | '(' condition ')'
1075 { $$ = $2; }
1076 ;
1077
1078 xcond:
1079 /* empty */
1080 { $$ = NULL_TREE; }
1081 | condition
1082 | error
1083 { $$ = NULL_TREE; }
1084 ;
1085
1086 condition:
1087 type_specifier_seq declarator maybeasm maybe_attribute '='
1088 { {
1089 tree d;
1090 for (d = getdecls (); d; d = TREE_CHAIN (d))
1091 if (TREE_CODE (d) == TYPE_DECL) {
1092 tree s = TREE_TYPE (d);
1093 if (TREE_CODE (s) == RECORD_TYPE)
1094 cp_error ("definition of class `%T' in condition", s);
1095 else if (TREE_CODE (s) == ENUMERAL_TYPE)
1096 cp_error ("definition of enum `%T' in condition", s);
1097 }
1098 }
1099 current_declspecs = $1.t;
1100 $<ttype>$ = parse_decl ($<ttype>2, $4, 1);
1101 }
1102 init
1103 {
1104 parse_end_decl ($<ttype>6, $7, $4);
1105 $$ = convert_from_reference ($<ttype>6);
1106 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
1107 cp_error ("definition of array `%#D' in condition", $$);
1108 }
1109 | expr
1110 ;
1111
1112 compstmtend:
1113 '}'
1114 | maybe_label_decls stmts '}'
1115 | maybe_label_decls stmts error '}'
1116 | maybe_label_decls error '}'
1117 ;
1118
1119 already_scoped_stmt:
1120 '{'
1121 { $<ttype>$ = begin_compound_stmt (1); }
1122 compstmtend
1123 { finish_compound_stmt (1, $<ttype>2); }
1124 | simple_stmt
1125 ;
1126
1127
1128 nontrivial_exprlist:
1129 expr_no_commas ',' expr_no_commas
1130 { $$ = tree_cons (NULL_TREE, $$,
1131 build_tree_list (NULL_TREE, $3)); }
1132 | expr_no_commas ',' error
1133 { $$ = tree_cons (NULL_TREE, $$,
1134 build_tree_list (NULL_TREE, error_mark_node)); }
1135 | nontrivial_exprlist ',' expr_no_commas
1136 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1137 | nontrivial_exprlist ',' error
1138 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1139 ;
1140
1141 nonnull_exprlist:
1142 expr_no_commas
1143 { $$ = build_tree_list (NULL_TREE, $$); }
1144 | nontrivial_exprlist
1145 ;
1146
1147 unary_expr:
1148 primary %prec UNARY
1149 { $$ = $1; }
1150 /* __extension__ turns off -pedantic for following primary. */
1151 | extension cast_expr %prec UNARY
1152 { $$ = $2;
1153 pedantic = $1; }
1154 | '*' cast_expr %prec UNARY
1155 { $$ = build_x_indirect_ref ($2, "unary *"); }
1156 | '&' cast_expr %prec UNARY
1157 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1158 | '~' cast_expr
1159 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1160 | unop cast_expr %prec UNARY
1161 { $$ = finish_unary_op_expr ($1, $2); }
1162 /* Refer to the address of a label as a pointer. */
1163 | ANDAND identifier
1164 { if (pedantic)
1165 pedwarn ("ISO C++ forbids `&&'");
1166 $$ = finish_label_address_expr ($2); }
1167 | SIZEOF unary_expr %prec UNARY
1168 { $$ = expr_sizeof ($2); }
1169 | SIZEOF '(' type_id ')' %prec HYPERUNARY
1170 { $$ = c_sizeof (groktypename ($3.t));
1171 check_for_new_type ("sizeof", $3); }
1172 | ALIGNOF unary_expr %prec UNARY
1173 { $$ = grok_alignof ($2); }
1174 | ALIGNOF '(' type_id ')' %prec HYPERUNARY
1175 { $$ = c_alignof (groktypename ($3.t));
1176 check_for_new_type ("alignof", $3); }
1177
1178 /* The %prec EMPTY's here are required by the = init initializer
1179 syntax extension; see below. */
1180 | new new_type_id %prec EMPTY
1181 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1182 check_for_new_type ("new", $2); }
1183 | new new_type_id new_initializer
1184 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1185 check_for_new_type ("new", $2); }
1186 | new new_placement new_type_id %prec EMPTY
1187 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1188 check_for_new_type ("new", $3); }
1189 | new new_placement new_type_id new_initializer
1190 { $$ = build_new ($2, $3.t, $4, $1);
1191 check_for_new_type ("new", $3); }
1192 | new '(' type_id ')'
1193 %prec EMPTY
1194 { $$ = build_new (NULL_TREE, groktypename($3.t),
1195 NULL_TREE, $1);
1196 check_for_new_type ("new", $3); }
1197 | new '(' type_id ')' new_initializer
1198 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1199 check_for_new_type ("new", $3); }
1200 | new new_placement '(' type_id ')' %prec EMPTY
1201 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1202 check_for_new_type ("new", $4); }
1203 | new new_placement '(' type_id ')' new_initializer
1204 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1205 check_for_new_type ("new", $4); }
1206
1207 | delete cast_expr %prec UNARY
1208 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1209 | delete '[' ']' cast_expr %prec UNARY
1210 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1211 if (yychar == YYEMPTY)
1212 yychar = YYLEX; }
1213 | delete '[' expr ']' cast_expr %prec UNARY
1214 { $$ = delete_sanity ($5, $3, 2, $1);
1215 if (yychar == YYEMPTY)
1216 yychar = YYLEX; }
1217 | REALPART cast_expr %prec UNARY
1218 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1219 | IMAGPART cast_expr %prec UNARY
1220 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1221 | VA_ARG '(' expr_no_commas ',' type_id ')'
1222 { $$ = build_x_va_arg ($3, groktypename ($5.t));
1223 check_for_new_type ("__builtin_va_arg", $5); }
1224 ;
1225
1226 new_placement:
1227 '(' nonnull_exprlist ')'
1228 { $$ = $2; }
1229 | '{' nonnull_exprlist '}'
1230 { cp_pedwarn ("old style placement syntax, use () instead");
1231 $$ = $2; }
1232 ;
1233
1234 new_initializer:
1235 '(' nonnull_exprlist ')'
1236 { $$ = $2; }
1237 | LEFT_RIGHT
1238 { $$ = NULL_TREE; }
1239 | '(' typespec ')'
1240 {
1241 cp_error ("`%T' is not a valid expression", $2.t);
1242 $$ = error_mark_node;
1243 }
1244 /* GNU extension so people can use initializer lists. Note that
1245 this alters the meaning of `new int = 1', which was previously
1246 syntactically valid but semantically invalid. */
1247 | '=' init
1248 {
1249 if (pedantic)
1250 pedwarn ("ISO C++ forbids initialization of new expression with `='");
1251 if (TREE_CODE ($2) != TREE_LIST
1252 && TREE_CODE ($2) != CONSTRUCTOR)
1253 $$ = build_tree_list (NULL_TREE, $2);
1254 else
1255 $$ = $2;
1256 }
1257 ;
1258
1259 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1260 regcast_or_absdcl:
1261 '(' type_id ')' %prec EMPTY
1262 { $2.t = finish_parmlist (build_tree_list (NULL_TREE, $2.t), 0);
1263 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1264 check_for_new_type ("cast", $2); }
1265 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1266 { $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0);
1267 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1268 check_for_new_type ("cast", $3); }
1269 ;
1270
1271 cast_expr:
1272 unary_expr
1273 | regcast_or_absdcl unary_expr %prec UNARY
1274 { $$ = reparse_absdcl_as_casts ($$, $2); }
1275 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1276 {
1277 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1278 nreverse ($3));
1279 if (pedantic)
1280 pedwarn ("ISO C++ forbids constructor-expressions");
1281 /* Indicate that this was a GNU C constructor expression. */
1282 TREE_HAS_CONSTRUCTOR (init) = 1;
1283
1284 $$ = reparse_absdcl_as_casts ($$, init);
1285 }
1286 ;
1287
1288 expr_no_commas:
1289 cast_expr
1290 /* Handle general members. */
1291 | expr_no_commas POINTSAT_STAR expr_no_commas
1292 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1293 | expr_no_commas DOT_STAR expr_no_commas
1294 { $$ = build_m_component_ref ($$, $3); }
1295 | expr_no_commas '+' expr_no_commas
1296 { $$ = build_x_binary_op ($2, $$, $3); }
1297 | expr_no_commas '-' expr_no_commas
1298 { $$ = build_x_binary_op ($2, $$, $3); }
1299 | expr_no_commas '*' expr_no_commas
1300 { $$ = build_x_binary_op ($2, $$, $3); }
1301 | expr_no_commas '/' expr_no_commas
1302 { $$ = build_x_binary_op ($2, $$, $3); }
1303 | expr_no_commas '%' expr_no_commas
1304 { $$ = build_x_binary_op ($2, $$, $3); }
1305 | expr_no_commas LSHIFT expr_no_commas
1306 { $$ = build_x_binary_op ($2, $$, $3); }
1307 | expr_no_commas RSHIFT expr_no_commas
1308 { $$ = build_x_binary_op ($2, $$, $3); }
1309 | expr_no_commas ARITHCOMPARE expr_no_commas
1310 { $$ = build_x_binary_op ($2, $$, $3); }
1311 | expr_no_commas '<' expr_no_commas
1312 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1313 | expr_no_commas '>' expr_no_commas
1314 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1315 | expr_no_commas EQCOMPARE expr_no_commas
1316 { $$ = build_x_binary_op ($2, $$, $3); }
1317 | expr_no_commas MIN_MAX expr_no_commas
1318 { $$ = build_x_binary_op ($2, $$, $3); }
1319 | expr_no_commas '&' expr_no_commas
1320 { $$ = build_x_binary_op ($2, $$, $3); }
1321 | expr_no_commas '|' expr_no_commas
1322 { $$ = build_x_binary_op ($2, $$, $3); }
1323 | expr_no_commas '^' expr_no_commas
1324 { $$ = build_x_binary_op ($2, $$, $3); }
1325 | expr_no_commas ANDAND expr_no_commas
1326 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1327 | expr_no_commas OROR expr_no_commas
1328 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1329 | expr_no_commas '?' xexpr ':' expr_no_commas
1330 { $$ = build_x_conditional_expr ($$, $3, $5); }
1331 | expr_no_commas '=' expr_no_commas
1332 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1333 if ($$ != error_mark_node)
1334 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1335 | expr_no_commas ASSIGN expr_no_commas
1336 { $$ = build_x_modify_expr ($$, $2, $3); }
1337 | THROW
1338 { $$ = build_throw (NULL_TREE); }
1339 | THROW expr_no_commas
1340 { $$ = build_throw ($2); }
1341 /* These extensions are not defined. The second arg to build_m_component_ref
1342 is old, build_m_component_ref now does an implicit
1343 build_indirect_ref (x, NULL_PTR) on the second argument.
1344 | object '&' expr_no_commas %prec UNARY
1345 { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
1346 | object unop expr_no_commas %prec UNARY
1347 { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
1348 | object '(' type_id ')' expr_no_commas %prec UNARY
1349 { tree type = groktypename ($3.t);
1350 $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
1351 | object primary_no_id %prec UNARY
1352 { $$ = build_m_component_ref ($$, $2); }
1353 */
1354 ;
1355
1356 notype_unqualified_id:
1357 '~' see_typename identifier
1358 { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
1359 | '~' see_typename template_type
1360 { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
1361 | template_id
1362 | operator_name
1363 | IDENTIFIER
1364 | PTYPENAME
1365 | NSNAME %prec EMPTY
1366 ;
1367
1368 do_id:
1369 {
1370 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1371 means that we're in an expression like S::f<int>, so
1372 don't do_identifier; we only do that for unqualified
1373 identifiers. */
1374 if (lastiddecl && TREE_CODE (lastiddecl) != TREE_LIST)
1375 $$ = do_identifier ($<ttype>-1, 1, NULL_TREE);
1376 else
1377 $$ = $<ttype>-1;
1378 }
1379
1380 template_id:
1381 PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket
1382 { $$ = lookup_template_function ($3, $4); }
1383 | operator_name '<' do_id template_arg_list_opt template_close_bracket
1384 { $$ = lookup_template_function ($3, $4); }
1385 ;
1386
1387 object_template_id:
1388 TEMPLATE identifier '<' template_arg_list_opt template_close_bracket
1389 { $$ = lookup_template_function ($2, $4); }
1390 | TEMPLATE PFUNCNAME '<' template_arg_list_opt template_close_bracket
1391 { $$ = lookup_template_function ($2, $4); }
1392 | TEMPLATE operator_name '<' template_arg_list_opt
1393 template_close_bracket
1394 { $$ = lookup_template_function ($2, $4); }
1395 ;
1396
1397 unqualified_id:
1398 notype_unqualified_id
1399 | TYPENAME
1400 | SELFNAME
1401 ;
1402
1403 expr_or_declarator_intern:
1404 expr_or_declarator
1405 | attributes expr_or_declarator
1406 {
1407 /* Provide support for '(' attributes '*' declarator ')'
1408 etc */
1409 $$ = decl_tree_cons ($1, $2, NULL_TREE);
1410 }
1411 ;
1412
1413 expr_or_declarator:
1414 notype_unqualified_id
1415 | '*' expr_or_declarator_intern %prec UNARY
1416 { $$ = build_parse_node (INDIRECT_REF, $2); }
1417 | '&' expr_or_declarator_intern %prec UNARY
1418 { $$ = build_parse_node (ADDR_EXPR, $2); }
1419 | '(' expr_or_declarator_intern ')'
1420 { $$ = $2; }
1421 ;
1422
1423 notype_template_declarator:
1424 IDENTIFIER '<' template_arg_list_opt template_close_bracket
1425 { $$ = lookup_template_function ($1, $3); }
1426 | NSNAME '<' template_arg_list template_close_bracket
1427 { $$ = lookup_template_function ($1, $3); }
1428 ;
1429
1430 direct_notype_declarator:
1431 complex_direct_notype_declarator
1432 /* This precedence declaration is to prefer this reduce
1433 to the Koenig lookup shift in primary, below. I hate yacc. */
1434 | notype_unqualified_id %prec '('
1435 | notype_template_declarator
1436 | '(' expr_or_declarator_intern ')'
1437 { $$ = finish_decl_parsing ($2); }
1438 ;
1439
1440 primary:
1441 notype_unqualified_id
1442 {
1443 if (TREE_CODE ($1) == BIT_NOT_EXPR)
1444 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($1, 0));
1445 else
1446 $$ = finish_id_expr ($1);
1447 }
1448 | CONSTANT
1449 | boolean.literal
1450 | string
1451 {
1452 $$ = combine_strings ($$);
1453 /* combine_strings doesn't set up TYPE_MAIN_VARIANT of
1454 a const array the way we want, so fix it. */
1455 if (flag_const_strings)
1456 TREE_TYPE ($$) = build_cplus_array_type
1457 (TREE_TYPE (TREE_TYPE ($$)),
1458 TYPE_DOMAIN (TREE_TYPE ($$)));
1459 }
1460 | '(' expr ')'
1461 { $$ = finish_parenthesized_expr ($2); }
1462 | '(' expr_or_declarator_intern ')'
1463 { $2 = reparse_decl_as_expr (NULL_TREE, $2);
1464 $$ = finish_parenthesized_expr ($2); }
1465 | '(' error ')'
1466 { $$ = error_mark_node; }
1467 | '('
1468 { tree scope = current_scope ();
1469 if (!scope || TREE_CODE (scope) != FUNCTION_DECL)
1470 {
1471 error ("braced-group within expression allowed only inside a function");
1472 YYERROR;
1473 }
1474 if (pedantic)
1475 pedwarn ("ISO C++ forbids braced-groups within expressions");
1476 $<ttype>$ = begin_stmt_expr ();
1477 }
1478 compstmt ')'
1479 { $$ = finish_stmt_expr ($<ttype>2); }
1480 /* Koenig lookup support
1481 We could store lastiddecl in $1 to avoid another lookup,
1482 but that would result in many additional reduce/reduce conflicts. */
1483 | notype_unqualified_id '(' nonnull_exprlist ')'
1484 { $$ = finish_call_expr ($1, $3, 1); }
1485 | notype_unqualified_id LEFT_RIGHT
1486 { $$ = finish_call_expr ($1, NULL_TREE, 1); }
1487 | primary '(' nonnull_exprlist ')'
1488 { $$ = finish_call_expr ($1, $3, 0); }
1489 | primary LEFT_RIGHT
1490 { $$ = finish_call_expr ($1, NULL_TREE, 0); }
1491 | primary '[' expr ']'
1492 { $$ = grok_array_decl ($$, $3); }
1493 | primary PLUSPLUS
1494 { $$ = finish_increment_expr ($1, POSTINCREMENT_EXPR); }
1495 | primary MINUSMINUS
1496 { $$ = finish_increment_expr ($1, POSTDECREMENT_EXPR); }
1497 /* C++ extensions */
1498 | THIS
1499 { $$ = finish_this_expr (); }
1500 | CV_QUALIFIER '(' nonnull_exprlist ')'
1501 {
1502 /* This is a C cast in C++'s `functional' notation
1503 using the "implicit int" extension so that:
1504 `const (3)' is equivalent to `const int (3)'. */
1505 tree type;
1506
1507 type = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1508 type = groktypename (build_decl_list (type, NULL_TREE));
1509 $$ = build_functional_cast (type, $3);
1510 }
1511 | functional_cast
1512 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1513 { tree type = groktypename ($3.t);
1514 check_for_new_type ("dynamic_cast", $3);
1515 $$ = build_dynamic_cast (type, $6); }
1516 | STATIC_CAST '<' type_id '>' '(' expr ')'
1517 { tree type = groktypename ($3.t);
1518 check_for_new_type ("static_cast", $3);
1519 $$ = build_static_cast (type, $6); }
1520 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1521 { tree type = groktypename ($3.t);
1522 check_for_new_type ("reinterpret_cast", $3);
1523 $$ = build_reinterpret_cast (type, $6); }
1524 | CONST_CAST '<' type_id '>' '(' expr ')'
1525 { tree type = groktypename ($3.t);
1526 check_for_new_type ("const_cast", $3);
1527 $$ = build_const_cast (type, $6); }
1528 | TYPEID '(' expr ')'
1529 { $$ = build_typeid ($3); }
1530 | TYPEID '(' type_id ')'
1531 { tree type = groktypename ($3.t);
1532 check_for_new_type ("typeid", $3);
1533 $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
1534 | global_scope IDENTIFIER
1535 { $$ = do_scoped_id ($2, 1); }
1536 | global_scope template_id
1537 { $$ = $2; }
1538 | global_scope operator_name
1539 {
1540 got_scope = NULL_TREE;
1541 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1542 $$ = do_scoped_id ($2, 1);
1543 else
1544 $$ = $2;
1545 }
1546 | overqualified_id %prec HYPERUNARY
1547 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1548 | overqualified_id '(' nonnull_exprlist ')'
1549 { $$ = finish_qualified_call_expr ($1, $3); }
1550 | overqualified_id LEFT_RIGHT
1551 { $$ = finish_qualified_call_expr ($1, NULL_TREE); }
1552 | object object_template_id %prec UNARY
1553 {
1554 $$ = build_x_component_ref ($$, $2, NULL_TREE, 1);
1555 }
1556 | object object_template_id '(' nonnull_exprlist ')'
1557 { $$ = finish_object_call_expr ($2, $1, $4); }
1558 | object object_template_id LEFT_RIGHT
1559 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1560 | object unqualified_id %prec UNARY
1561 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1562 | object overqualified_id %prec UNARY
1563 { if (processing_template_decl)
1564 $$ = build_min_nt (COMPONENT_REF, $1, $2);
1565 else
1566 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1567 | object unqualified_id '(' nonnull_exprlist ')'
1568 { $$ = finish_object_call_expr ($2, $1, $4); }
1569 | object unqualified_id LEFT_RIGHT
1570 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1571 | object overqualified_id '(' nonnull_exprlist ')'
1572 { $$ = finish_qualified_object_call_expr ($2, $1, $4); }
1573 | object overqualified_id LEFT_RIGHT
1574 { $$ = finish_qualified_object_call_expr ($2, $1, NULL_TREE); }
1575 /* p->int::~int() is valid -- 12.4 */
1576 | object '~' TYPESPEC LEFT_RIGHT
1577 { $$ = finish_pseudo_destructor_call_expr ($1, NULL_TREE, $3); }
1578 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1579 { $$ = finish_pseudo_destructor_call_expr ($1, $2, $5); }
1580 | object error
1581 {
1582 $$ = error_mark_node;
1583 }
1584 ;
1585
1586 /* Not needed for now.
1587
1588 primary_no_id:
1589 '(' expr ')'
1590 { $$ = $2; }
1591 | '(' error ')'
1592 { $$ = error_mark_node; }
1593 | '('
1594 { if (current_function_decl == 0)
1595 {
1596 error ("braced-group within expression allowed only inside a function");
1597 YYERROR;
1598 }
1599 $<ttype>$ = expand_start_stmt_expr (); }
1600 compstmt ')'
1601 { if (pedantic)
1602 pedwarn ("ISO C++ forbids braced-groups within expressions");
1603 $$ = expand_end_stmt_expr ($<ttype>2); }
1604 | primary_no_id '(' nonnull_exprlist ')'
1605 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1606 | primary_no_id LEFT_RIGHT
1607 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1608 | primary_no_id '[' expr ']'
1609 { goto do_array; }
1610 | primary_no_id PLUSPLUS
1611 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1612 | primary_no_id MINUSMINUS
1613 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1614 | SCOPE IDENTIFIER
1615 { goto do_scoped_id; }
1616 | SCOPE operator_name
1617 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1618 goto do_scoped_id;
1619 goto do_scoped_operator;
1620 }
1621 ;
1622 */
1623
1624 new:
1625 NEW
1626 { $$ = 0; }
1627 | global_scope NEW
1628 { got_scope = NULL_TREE; $$ = 1; }
1629 ;
1630
1631 delete:
1632 DELETE
1633 { $$ = 0; }
1634 | global_scope delete
1635 { got_scope = NULL_TREE; $$ = 1; }
1636 ;
1637
1638 boolean.literal:
1639 CXX_TRUE
1640 { $$ = boolean_true_node; }
1641 | CXX_FALSE
1642 { $$ = boolean_false_node; }
1643 ;
1644
1645 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1646 string:
1647 STRING
1648 | string STRING
1649 { $$ = chainon ($$, $2); }
1650 ;
1651
1652 nodecls:
1653 /* empty */
1654 {
1655 if (! current_function_parms_stored)
1656 store_parm_decls ();
1657 setup_vtbl_ptr ();
1658 }
1659 ;
1660
1661 object:
1662 primary '.'
1663 { got_object = TREE_TYPE ($$); }
1664 | primary POINTSAT
1665 {
1666 $$ = build_x_arrow ($$);
1667 got_object = TREE_TYPE ($$);
1668 }
1669 ;
1670
1671 decl:
1672 typespec initdecls ';'
1673 {
1674 if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1675 note_got_semicolon ($1.t);
1676 }
1677 | typed_declspecs initdecls ';'
1678 {
1679 note_list_got_semicolon ($1.t);
1680 }
1681 | declmods notype_initdecls ';'
1682 {}
1683 | typed_declspecs ';'
1684 {
1685 shadow_tag ($1.t);
1686 note_list_got_semicolon ($1.t);
1687 }
1688 | declmods ';'
1689 { warning ("empty declaration"); }
1690 | extension decl
1691 { pedantic = $1; }
1692 ;
1693
1694 /* Any kind of declarator (thus, all declarators allowed
1695 after an explicit typespec). */
1696
1697 declarator:
1698 after_type_declarator %prec EMPTY
1699 | notype_declarator %prec EMPTY
1700 ;
1701
1702 /* This is necessary to postpone reduction of `int()()()()'. */
1703 fcast_or_absdcl:
1704 LEFT_RIGHT %prec EMPTY
1705 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1706 NULL_TREE, NULL_TREE); }
1707 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1708 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1709 NULL_TREE); }
1710 ;
1711
1712 /* ISO type-id (8.1) */
1713 type_id:
1714 typed_typespecs absdcl
1715 { $$.t = build_decl_list ($1.t, $2);
1716 $$.new_type_flag = $1.new_type_flag; }
1717 | nonempty_cv_qualifiers absdcl
1718 { $$.t = build_decl_list ($1.t, $2);
1719 $$.new_type_flag = $1.new_type_flag; }
1720 | typespec absdcl
1721 { $$.t = build_decl_list (build_decl_list (NULL_TREE, $1.t),
1722 $2);
1723 $$.new_type_flag = $1.new_type_flag; }
1724 | typed_typespecs %prec EMPTY
1725 { $$.t = build_decl_list ($1.t, NULL_TREE);
1726 $$.new_type_flag = $1.new_type_flag; }
1727 | nonempty_cv_qualifiers %prec EMPTY
1728 { $$.t = build_decl_list ($1.t, NULL_TREE);
1729 $$.new_type_flag = $1.new_type_flag; }
1730 ;
1731
1732 /* Declspecs which contain at least one type specifier or typedef name.
1733 (Just `const' or `volatile' is not enough.)
1734 A typedef'd name following these is taken as a name to be declared.
1735 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1736
1737 typed_declspecs:
1738 typed_typespecs %prec EMPTY
1739 { $$.lookups = type_lookups; }
1740 | typed_declspecs1
1741 { $$.lookups = type_lookups; }
1742 ;
1743
1744 typed_declspecs1:
1745 declmods typespec
1746 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
1747 $$.new_type_flag = $2.new_type_flag; }
1748 | typespec reserved_declspecs %prec HYPERUNARY
1749 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1750 $$.new_type_flag = $1.new_type_flag; }
1751 | typespec reserved_typespecquals reserved_declspecs
1752 { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1753 $$.new_type_flag = $1.new_type_flag; }
1754 | declmods typespec reserved_declspecs
1755 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1756 $$.new_type_flag = $2.new_type_flag; }
1757 | declmods typespec reserved_typespecquals
1758 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1759 $$.new_type_flag = $2.new_type_flag; }
1760 | declmods typespec reserved_typespecquals reserved_declspecs
1761 { $$.t = decl_tree_cons (NULL_TREE, $2.t,
1762 chainon ($3, chainon ($4, $1.t)));
1763 $$.new_type_flag = $2.new_type_flag; }
1764 ;
1765
1766 reserved_declspecs:
1767 SCSPEC
1768 { if (extra_warnings)
1769 warning ("`%s' is not at beginning of declaration",
1770 IDENTIFIER_POINTER ($$));
1771 $$ = build_decl_list (NULL_TREE, $$); }
1772 | reserved_declspecs typespecqual_reserved
1773 { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
1774 | reserved_declspecs SCSPEC
1775 { if (extra_warnings)
1776 warning ("`%s' is not at beginning of declaration",
1777 IDENTIFIER_POINTER ($2));
1778 $$ = decl_tree_cons (NULL_TREE, $2, $$); }
1779 | reserved_declspecs attributes
1780 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1781 | attributes
1782 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1783 ;
1784
1785 /* List of just storage classes and type modifiers.
1786 A declaration can start with just this, but then it cannot be used
1787 to redeclare a typedef-name.
1788 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1789
1790 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1791 up on a persistent obstack. Otherwise, they could appear at the
1792 beginning of something like
1793
1794 static const struct { int foo () { } } b;
1795
1796 and would be discarded after we finish compiling foo. We don't need to
1797 worry once we see a type. */
1798
1799 declmods:
1800 nonempty_cv_qualifiers %prec EMPTY
1801 { $$.lookups = NULL_TREE; TREE_STATIC ($$.t) = 1; }
1802 | SCSPEC
1803 {
1804 $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1805 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1806 }
1807 | declmods CV_QUALIFIER
1808 {
1809 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1810 TREE_STATIC ($$.t) = 1;
1811 }
1812 | declmods SCSPEC
1813 {
1814 if (extra_warnings && TREE_STATIC ($$.t))
1815 warning ("`%s' is not at beginning of declaration",
1816 IDENTIFIER_POINTER ($2));
1817 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1818 TREE_STATIC ($$.t) = TREE_STATIC ($1.t);
1819 }
1820 | declmods attributes
1821 { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t); }
1822 | attributes %prec EMPTY
1823 {
1824 $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE);
1825 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1826 }
1827 ;
1828
1829 /* Used instead of declspecs where storage classes are not allowed
1830 (that is, for typenames and structure components).
1831
1832 C++ can takes storage classes for structure components.
1833 Don't accept a typedef-name if anything but a modifier precedes it. */
1834
1835 typed_typespecs:
1836 typespec %prec EMPTY
1837 { $$.t = build_decl_list (NULL_TREE, $1.t);
1838 $$.new_type_flag = $1.new_type_flag; }
1839 | nonempty_cv_qualifiers typespec
1840 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
1841 $$.new_type_flag = $2.new_type_flag; }
1842 | typespec reserved_typespecquals
1843 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1844 $$.new_type_flag = $1.new_type_flag; }
1845 | nonempty_cv_qualifiers typespec reserved_typespecquals
1846 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1847 $$.new_type_flag = $2.new_type_flag; }
1848 ;
1849
1850 reserved_typespecquals:
1851 typespecqual_reserved
1852 { $$ = build_decl_list (NULL_TREE, $1.t); }
1853 | reserved_typespecquals typespecqual_reserved
1854 { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
1855 ;
1856
1857 /* A typespec (but not a type qualifier).
1858 Once we have seen one of these in a declaration,
1859 if a typedef name appears then it is being redeclared. */
1860
1861 typespec:
1862 structsp
1863 { $$.lookups = NULL_TREE; }
1864 | TYPESPEC %prec EMPTY
1865 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1866 | complete_type_name
1867 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1868 | TYPEOF '(' expr ')'
1869 { $$.t = finish_typeof ($3);
1870 $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1871 | TYPEOF '(' type_id ')'
1872 { $$.t = groktypename ($3.t);
1873 $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1874 | SIGOF '(' expr ')'
1875 { tree type = TREE_TYPE ($3);
1876
1877 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1878 if (IS_AGGR_TYPE (type))
1879 {
1880 sorry ("sigof type specifier");
1881 $$.t = type;
1882 }
1883 else
1884 {
1885 error ("`sigof' applied to non-aggregate expression");
1886 $$.t = error_mark_node;
1887 }
1888 }
1889 | SIGOF '(' type_id ')'
1890 { tree type = groktypename ($3.t);
1891
1892 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1893 if (IS_AGGR_TYPE (type))
1894 {
1895 sorry ("sigof type specifier");
1896 $$.t = type;
1897 }
1898 else
1899 {
1900 error("`sigof' applied to non-aggregate type");
1901 $$.t = error_mark_node;
1902 }
1903 }
1904 ;
1905
1906 /* A typespec that is a reserved word, or a type qualifier. */
1907
1908 typespecqual_reserved:
1909 TYPESPEC
1910 { $$.t = $1; $$.new_type_flag = 0; }
1911 | CV_QUALIFIER
1912 { $$.t = $1; $$.new_type_flag = 0; }
1913 | structsp
1914 ;
1915
1916 initdecls:
1917 initdcl0
1918 | initdecls ',' initdcl
1919 { check_multiple_declarators (); }
1920 ;
1921
1922 notype_initdecls:
1923 notype_initdcl0
1924 | notype_initdecls ',' initdcl
1925 { check_multiple_declarators (); }
1926 ;
1927
1928 nomods_initdecls:
1929 nomods_initdcl0
1930 | nomods_initdecls ',' initdcl
1931 { check_multiple_declarators (); }
1932 ;
1933
1934 maybeasm:
1935 /* empty */
1936 { $$ = NULL_TREE; }
1937 | asm_keyword '(' string ')'
1938 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
1939 ;
1940
1941 initdcl:
1942 declarator maybeasm maybe_attribute '='
1943 { $<ttype>$ = parse_decl ($<ttype>1, $3, 1); }
1944 init
1945 /* Note how the declaration of the variable is in effect while its init is parsed! */
1946 { parse_end_decl ($<ttype>5, $6, $2); }
1947 | declarator maybeasm maybe_attribute
1948 {
1949 $<ttype>$ = parse_decl ($<ttype>1, $3, 0);
1950 parse_end_decl ($<ttype>$, NULL_TREE, $2);
1951 }
1952 ;
1953
1954 /* This rule assumes a certain configuration of the parser stack.
1955 In particular, $0, the element directly before the beginning of
1956 this rule on the stack, must be a maybeasm. $-1 must be a
1957 declarator or notype_declarator. And $-2 must be some declmods
1958 or declspecs. We can't move the maybeasm into this rule because
1959 we need that reduce so we prefer fn.def1 when appropriate. */
1960 initdcl0_innards:
1961 maybe_attribute '='
1962 { $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
1963 $<ftype>-2.lookups, $1, 1); }
1964 /* Note how the declaration of the variable is in effect
1965 while its init is parsed! */
1966 init
1967 { parse_end_decl ($<ttype>3, $4, $<ttype>0); }
1968 | maybe_attribute
1969 { tree d = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
1970 $<ftype>-2.lookups, $1, 0);
1971 parse_end_decl (d, NULL_TREE, $<ttype>0); }
1972 ;
1973
1974 initdcl0:
1975 declarator maybeasm initdcl0_innards
1976 {}
1977 ;
1978
1979 notype_initdcl0:
1980 notype_declarator maybeasm initdcl0_innards
1981 {}
1982 ;
1983
1984 nomods_initdcl0:
1985 notype_declarator maybeasm
1986 { /* Set things up as initdcl0_innards expects. */
1987 $<ttype>2 = $1;
1988 $1 = NULL_TREE; }
1989 initdcl0_innards
1990 {}
1991 | constructor_declarator maybeasm maybe_attribute
1992 { tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0);
1993 parse_end_decl (d, NULL_TREE, $2); }
1994 ;
1995
1996 /* the * rules are dummies to accept the Apollo extended syntax
1997 so that the header files compile. */
1998 maybe_attribute:
1999 /* empty */
2000 { $$ = NULL_TREE; }
2001 | attributes
2002 { $$ = $1; }
2003 ;
2004
2005 attributes:
2006 attribute
2007 { $$ = $1; }
2008 | attributes attribute
2009 { $$ = chainon ($1, $2); }
2010 ;
2011
2012 attribute:
2013 ATTRIBUTE '(' '(' attribute_list ')' ')'
2014 { $$ = $4; }
2015 ;
2016
2017 attribute_list:
2018 attrib
2019 { $$ = $1; }
2020 | attribute_list ',' attrib
2021 { $$ = chainon ($1, $3); }
2022 ;
2023
2024 attrib:
2025 /* empty */
2026 { $$ = NULL_TREE; }
2027 | any_word
2028 { $$ = build_tree_list ($1, NULL_TREE); }
2029 | any_word '(' IDENTIFIER ')'
2030 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2031 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2032 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2033 | any_word '(' nonnull_exprlist ')'
2034 { $$ = build_tree_list ($1, $3); }
2035 ;
2036
2037 /* This still leaves out most reserved keywords,
2038 shouldn't we include them? */
2039
2040 any_word:
2041 identifier
2042 | SCSPEC
2043 | TYPESPEC
2044 | CV_QUALIFIER
2045 ;
2046
2047 /* A nonempty list of identifiers, including typenames. */
2048 identifiers_or_typenames:
2049 identifier
2050 { $$ = build_tree_list (NULL_TREE, $1); }
2051 | identifiers_or_typenames ',' identifier
2052 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2053 ;
2054
2055 maybe_init:
2056 /* empty */ %prec EMPTY
2057 { $$ = NULL_TREE; }
2058 | '=' init
2059 { $$ = $2; }
2060
2061 /* If we are processing a template, we don't want to expand this
2062 initializer yet. */
2063
2064 init:
2065 expr_no_commas %prec '='
2066 | '{' '}'
2067 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2068 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2069 | '{' initlist '}'
2070 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2071 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2072 | '{' initlist ',' '}'
2073 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2074 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2075 | error
2076 { $$ = NULL_TREE; }
2077 ;
2078
2079 /* This chain is built in reverse order,
2080 and put in forward order where initlist is used. */
2081 initlist:
2082 init
2083 { $$ = build_tree_list (NULL_TREE, $$); }
2084 | initlist ',' init
2085 { $$ = tree_cons (NULL_TREE, $3, $$); }
2086 /* These are for labeled elements. */
2087 | '[' expr_no_commas ']' init
2088 { $$ = build_tree_list ($2, $4); }
2089 | identifier ':' init
2090 { $$ = build_tree_list ($$, $3); }
2091 | initlist ',' identifier ':' init
2092 { $$ = tree_cons ($3, $5, $$); }
2093 ;
2094
2095 fn.defpen:
2096 PRE_PARSED_FUNCTION_DECL
2097 { start_function (NULL_TREE, $1->fndecl, NULL_TREE,
2098 (SF_DEFAULT | SF_PRE_PARSED
2099 | SF_INCLASS_INLINE));
2100 reinit_parse_for_function (); }
2101
2102 pending_inline:
2103 fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
2104 {
2105 expand_body (finish_function ((int)$3 | 2));
2106 process_next_inline ($1);
2107 }
2108 | fn.defpen maybe_return_init function_try_block
2109 {
2110 expand_body (finish_function ((int)$3 | 2));
2111 process_next_inline ($1);
2112 }
2113 | fn.defpen maybe_return_init error
2114 {
2115 finish_function (2);
2116 process_next_inline ($1); }
2117 ;
2118
2119 pending_inlines:
2120 /* empty */
2121 | pending_inlines pending_inline eat_saved_input
2122 ;
2123
2124 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2125 the TREE_LIST node for the parameter in question. */
2126 defarg_again:
2127 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2128 { replace_defarg ($1, $2); }
2129 | DEFARG_MARKER error END_OF_SAVED_INPUT
2130 { replace_defarg ($1, error_mark_node); }
2131
2132 pending_defargs:
2133 /* empty */ %prec EMPTY
2134 | pending_defargs defarg_again
2135 { do_pending_defargs (); }
2136 | pending_defargs error
2137 { do_pending_defargs (); }
2138 ;
2139
2140 structsp:
2141 ENUM identifier '{'
2142 { $<ttype>$ = current_enum_type;
2143 current_enum_type = start_enum ($2); }
2144 enumlist_opt '}'
2145 { $$.t = finish_enum (current_enum_type);
2146 $$.new_type_flag = 1;
2147 current_enum_type = $<ttype>4;
2148 check_for_missing_semicolon ($$.t); }
2149 | ENUM '{'
2150 { $<ttype>$ = current_enum_type;
2151 current_enum_type = start_enum (make_anon_name ()); }
2152 enumlist_opt '}'
2153 { $$.t = finish_enum (current_enum_type);
2154 $$.new_type_flag = 1;
2155 current_enum_type = $<ttype>3;
2156 check_for_missing_semicolon ($$.t); }
2157 | ENUM identifier
2158 { $$.t = xref_tag (enum_type_node, $2, 1);
2159 $$.new_type_flag = 0; }
2160 | ENUM complex_type_name
2161 { $$.t = xref_tag (enum_type_node, $2, 1);
2162 $$.new_type_flag = 0; }
2163 | TYPENAME_KEYWORD typename_sub
2164 { $$.t = $2;
2165 $$.new_type_flag = 0;
2166 if (!processing_template_decl)
2167 cp_pedwarn ("using `typename' outside of template"); }
2168 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2169 | class_head '{'
2170 { $1.t = begin_class_definition ($1.t); }
2171 opt.component_decl_list '}' maybe_attribute
2172 {
2173 int semi;
2174
2175 if (yychar == YYEMPTY)
2176 yychar = YYLEX;
2177 semi = yychar == ';';
2178
2179 $<ttype>$ = finish_class_definition ($1.t, $6, semi,
2180 $1.new_type_flag);
2181 }
2182 pending_defargs
2183 {
2184 begin_inline_definitions ();
2185 }
2186 pending_inlines
2187 {
2188 finish_inline_definitions ();
2189 $$.t = $<ttype>7;
2190 $$.new_type_flag = 1;
2191 }
2192 | class_head %prec EMPTY
2193 {
2194 if ($1.new_type_flag && $1.t != error_mark_node)
2195 pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL ($1.t)));
2196 $$.new_type_flag = 0;
2197 if ($1.t == error_mark_node)
2198 $$.t = $1.t;
2199 else if (TYPE_BINFO ($1.t) == NULL_TREE)
2200 {
2201 cp_error ("%T is not a class type", $1.t);
2202 $$.t = error_mark_node;
2203 }
2204 else
2205 {
2206 $$.t = $1.t;
2207 /* struct B: public A; is not accepted by the standard grammar. */
2208 if (CLASS_TYPE_P ($$.t)
2209 && TYPE_BINFO_BASETYPES ($$.t)
2210 && !COMPLETE_TYPE_P ($$.t)
2211 && ! TYPE_BEING_DEFINED ($$.t))
2212 cp_error ("base clause without member specification for `%#T'",
2213 $$.t);
2214 }
2215 }
2216 ;
2217
2218 maybecomma:
2219 /* empty */
2220 | ','
2221 ;
2222
2223 maybecomma_warn:
2224 /* empty */
2225 | ','
2226 { if (pedantic && !in_system_header)
2227 pedwarn ("comma at end of enumerator list"); }
2228 ;
2229
2230 aggr:
2231 AGGR
2232 | aggr SCSPEC
2233 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2234 | aggr TYPESPEC
2235 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2236 | aggr CV_QUALIFIER
2237 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2238 | aggr AGGR
2239 { error ("no body nor ';' separates two class, struct or union declarations"); }
2240 | aggr attributes
2241 { $$ = build_decl_list ($2, $1); }
2242 ;
2243
2244 named_class_head_sans_basetype:
2245 aggr identifier
2246 {
2247 current_aggr = $1;
2248 $$ = $2;
2249 }
2250 ;
2251
2252 named_class_head_sans_basetype_defn:
2253 aggr identifier_defn %prec EMPTY
2254 { current_aggr = $$; $$ = $2; }
2255 | named_class_head_sans_basetype '{'
2256 { yyungetc ('{', 1); }
2257 | named_class_head_sans_basetype ':'
2258 { yyungetc (':', 1); }
2259 ;
2260
2261 named_complex_class_head_sans_basetype:
2262 aggr nested_name_specifier identifier
2263 {
2264 current_aggr = $1;
2265 $$.t = handle_class_head ($1, $2, $3);
2266 $$.new_type_flag = 1;
2267 }
2268 | aggr global_scope nested_name_specifier identifier
2269 {
2270 current_aggr = $1;
2271 $$.t = handle_class_head ($1, $3, $4);
2272 $$.new_type_flag = 1;
2273 }
2274 | aggr global_scope identifier
2275 {
2276 current_aggr = $1;
2277 $$.t = handle_class_head ($1, NULL_TREE, $3);
2278 $$.new_type_flag = 1;
2279 }
2280 | aggr apparent_template_type
2281 {
2282 current_aggr = $1;
2283 $$.t = $2;
2284 $$.new_type_flag = 0;
2285 }
2286 | aggr nested_name_specifier apparent_template_type
2287 {
2288 current_aggr = $1;
2289 $$.t = $3;
2290 if (CP_DECL_CONTEXT ($$.t))
2291 push_scope (CP_DECL_CONTEXT ($$.t));
2292 $$.new_type_flag = 1;
2293 }
2294 ;
2295
2296 named_class_head:
2297 named_class_head_sans_basetype %prec EMPTY
2298 {
2299 $$.t = xref_tag (current_aggr, $1, 1);
2300 $$.new_type_flag = 0;
2301 }
2302 | named_class_head_sans_basetype_defn
2303 { $<ttype>$ = xref_tag (current_aggr, $1, 0); }
2304 /* Class name is unqualified, so we look for base classes
2305 in the current scope. */
2306 maybe_base_class_list %prec EMPTY
2307 {
2308 $$.t = $<ttype>2;
2309 $$.new_type_flag = 0;
2310 if ($3)
2311 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2312 }
2313 | named_complex_class_head_sans_basetype
2314 maybe_base_class_list
2315 {
2316 if ($1.t != error_mark_node)
2317 {
2318 $$.t = TREE_TYPE ($1.t);
2319 $$.new_type_flag = $1.new_type_flag;
2320 if (current_aggr == union_type_node
2321 && TREE_CODE ($$.t) != UNION_TYPE)
2322 cp_pedwarn ("`union' tag used in declaring `%#T'",
2323 $$.t);
2324 else if (TREE_CODE ($$.t) == UNION_TYPE
2325 && current_aggr != union_type_node)
2326 cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
2327 else if (TREE_CODE ($$.t) == RECORD_TYPE)
2328 /* We might be specializing a template with a different
2329 class-key; deal. */
2330 CLASSTYPE_DECLARED_CLASS ($$.t)
2331 = (current_aggr == class_type_node);
2332 if ($2)
2333 {
2334 maybe_process_partial_specialization ($$.t);
2335 xref_basetypes (current_aggr, $1.t, $$.t, $2);
2336 }
2337 }
2338 }
2339 ;
2340
2341 unnamed_class_head:
2342 aggr '{'
2343 { $$ = xref_tag ($$, make_anon_name (), 0);
2344 yyungetc ('{', 1); }
2345 ;
2346
2347 /* The tree output of this nonterminal a declarationf or the type
2348 named. If NEW_TYPE_FLAG is set, then the name used in this
2349 class-head was explicitly qualified, e.g.: `struct X::Y'. We have
2350 already called push_scope for X. */
2351 class_head:
2352 unnamed_class_head
2353 {
2354 $$.t = $1;
2355 $$.new_type_flag = 0;
2356 }
2357 | named_class_head
2358 ;
2359
2360 maybe_base_class_list:
2361 /* empty */ %prec EMPTY
2362 { $$ = NULL_TREE; }
2363 | ':' see_typename %prec EMPTY
2364 { yyungetc(':', 1); $$ = NULL_TREE; }
2365 | ':' see_typename base_class_list %prec EMPTY
2366 { $$ = $3; }
2367 ;
2368
2369 base_class_list:
2370 base_class
2371 | base_class_list ',' see_typename base_class
2372 { $$ = chainon ($$, $4); }
2373 ;
2374
2375 base_class:
2376 base_class.1
2377 { $$ = finish_base_specifier (access_default_node, $1); }
2378 | base_class_access_list see_typename base_class.1
2379 { $$ = finish_base_specifier ($1, $3); }
2380 ;
2381
2382 base_class.1:
2383 typename_sub
2384 { if ($$ == error_mark_node)
2385 ;
2386 else if (!TYPE_P ($$))
2387 $$ = error_mark_node;
2388 else
2389 $$ = TYPE_MAIN_DECL ($1); }
2390 | nonnested_type
2391 ;
2392
2393 base_class_access_list:
2394 VISSPEC see_typename
2395 | SCSPEC see_typename
2396 { if ($1 != ridpointers[(int)RID_VIRTUAL])
2397 cp_error ("`%D' access", $1);
2398 $$ = access_default_virtual_node; }
2399 | base_class_access_list VISSPEC see_typename
2400 {
2401 if ($1 != access_default_virtual_node)
2402 error ("multiple access specifiers");
2403 else if ($2 == access_public_node)
2404 $$ = access_public_virtual_node;
2405 else if ($2 == access_protected_node)
2406 $$ = access_protected_virtual_node;
2407 else /* $2 == access_private_node */
2408 $$ = access_private_virtual_node;
2409 }
2410 | base_class_access_list SCSPEC see_typename
2411 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2412 cp_error ("`%D' access", $2);
2413 else if ($$ == access_public_node)
2414 $$ = access_public_virtual_node;
2415 else if ($$ == access_protected_node)
2416 $$ = access_protected_virtual_node;
2417 else if ($$ == access_private_node)
2418 $$ = access_private_virtual_node;
2419 else
2420 error ("multiple `virtual' specifiers");
2421 }
2422 ;
2423
2424 opt.component_decl_list:
2425 | component_decl_list
2426 | opt.component_decl_list access_specifier component_decl_list
2427 | opt.component_decl_list access_specifier
2428 ;
2429
2430 access_specifier:
2431 VISSPEC ':'
2432 {
2433 current_access_specifier = $1;
2434 }
2435 ;
2436
2437 /* Note: we no longer warn about the semicolon after a component_decl_list.
2438 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2439 component_decl_list:
2440 component_decl
2441 {
2442 finish_member_declaration ($1);
2443 }
2444 | component_decl_list component_decl
2445 {
2446 finish_member_declaration ($2);
2447 }
2448 ;
2449
2450 component_decl:
2451 component_decl_1 ';'
2452 | component_decl_1 '}'
2453 { error ("missing ';' before right brace");
2454 yyungetc ('}', 0); }
2455 /* C++: handle constructors, destructors and inline functions */
2456 /* note that INLINE is like a TYPESPEC */
2457 | fn.def2 ':' /* base_init compstmt */
2458 { $$ = finish_method ($$); }
2459 | fn.def2 TRY /* base_init compstmt */
2460 { $$ = finish_method ($$); }
2461 | fn.def2 RETURN_KEYWORD /* base_init compstmt */
2462 { $$ = finish_method ($$); }
2463 | fn.def2 '{' /* nodecls compstmt */
2464 { $$ = finish_method ($$); }
2465 | ';'
2466 { $$ = NULL_TREE; }
2467 | extension component_decl
2468 { $$ = $2;
2469 pedantic = $1; }
2470 | template_header component_decl
2471 {
2472 if ($2)
2473 $$ = finish_member_template_decl ($2);
2474 else
2475 /* The component was already processed. */
2476 $$ = NULL_TREE;
2477
2478 finish_template_decl ($1);
2479 }
2480 | template_header typed_declspecs ';'
2481 {
2482 $$ = finish_member_class_template ($2.t);
2483 finish_template_decl ($1);
2484 }
2485 ;
2486
2487 component_decl_1:
2488 /* Do not add a "typed_declspecs declarator" rule here for
2489 speed; we need to call grok_x_components for enums, so the
2490 speedup would be insignificant. */
2491 typed_declspecs components
2492 {
2493 /* Most of the productions for component_decl only
2494 allow the creation of one new member, so we call
2495 finish_member_declaration in component_decl_list.
2496 For this rule and the next, however, there can be
2497 more than one member, e.g.:
2498
2499 int i, j;
2500
2501 and we need the first member to be fully
2502 registered before the second is processed.
2503 Therefore, the rules for components take care of
2504 this processing. To avoid registering the
2505 components more than once, we send NULL_TREE up
2506 here; that lets finish_member_declaration know
2507 that there is nothing to do. */
2508 if (!$2)
2509 grok_x_components ($1.t);
2510 $$ = NULL_TREE;
2511 }
2512 | declmods notype_components
2513 {
2514 if (!$2)
2515 grok_x_components ($1.t);
2516 $$ = NULL_TREE;
2517 }
2518 | notype_declarator maybeasm maybe_attribute maybe_init
2519 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2520 build_tree_list ($3, NULL_TREE)); }
2521 | constructor_declarator maybeasm maybe_attribute maybe_init
2522 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2523 build_tree_list ($3, NULL_TREE)); }
2524 | ':' expr_no_commas
2525 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2526 | error
2527 { $$ = NULL_TREE; }
2528
2529 /* These rules introduce a reduce/reduce conflict; in
2530 typedef int foo, bar;
2531 class A {
2532 foo (bar);
2533 };
2534 should "A::foo" be declared as a function or "A::bar" as a data
2535 member? In other words, is "bar" an after_type_declarator or a
2536 parmlist? */
2537 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2538 { tree specs, attrs;
2539 split_specs_attrs ($1.t, &specs, &attrs);
2540 $$ = grokfield ($2, specs, $5, $3,
2541 build_tree_list ($4, attrs)); }
2542 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2543 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2544 build_tree_list ($3, NULL_TREE)); }
2545 | using_decl
2546 { $$ = do_class_using_decl ($1); }
2547
2548 /* The case of exactly one component is handled directly by component_decl. */
2549 /* ??? Huh? ^^^ */
2550 components:
2551 /* empty: possibly anonymous */
2552 { $$ = 0; }
2553 | component_declarator0
2554 {
2555 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2556 $1 = finish_member_template_decl ($1);
2557 finish_member_declaration ($1);
2558 $$ = 1;
2559 }
2560 | components ',' component_declarator
2561 {
2562 check_multiple_declarators ();
2563 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2564 $3 = finish_member_template_decl ($3);
2565 finish_member_declaration ($3);
2566 $$ = 2;
2567 }
2568 ;
2569
2570 notype_components:
2571 /* empty: possibly anonymous */
2572 { $$ = 0; }
2573 | notype_component_declarator0
2574 {
2575 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2576 $1 = finish_member_template_decl ($1);
2577 finish_member_declaration ($1);
2578 $$ = 1;
2579 }
2580 | notype_components ',' notype_component_declarator
2581 {
2582 check_multiple_declarators ();
2583 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2584 $3 = finish_member_template_decl ($3);
2585 finish_member_declaration ($3);
2586 $$ = 2;
2587 }
2588 ;
2589
2590 component_declarator0:
2591 after_type_component_declarator0
2592 | notype_component_declarator0
2593 ;
2594
2595 component_declarator:
2596 after_type_component_declarator
2597 | notype_component_declarator
2598 ;
2599
2600 after_type_component_declarator0:
2601 after_type_declarator maybeasm maybe_attribute maybe_init
2602 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2603 $3, $2, $4); }
2604 | TYPENAME ':' expr_no_commas maybe_attribute
2605 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2606 $4, $3); }
2607 ;
2608
2609 notype_component_declarator0:
2610 notype_declarator maybeasm maybe_attribute maybe_init
2611 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2612 $3, $2, $4); }
2613 | constructor_declarator maybeasm maybe_attribute maybe_init
2614 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2615 $3, $2, $4); }
2616 | IDENTIFIER ':' expr_no_commas maybe_attribute
2617 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2618 $4, $3); }
2619 | ':' expr_no_commas maybe_attribute
2620 { $$ = parse_bitfield0 (NULL_TREE, $<ftype>0.t,
2621 $<ftype>0.lookups, $3, $2); }
2622 ;
2623
2624 after_type_component_declarator:
2625 after_type_declarator maybeasm maybe_attribute maybe_init
2626 { $$ = parse_field ($1, $3, $2, $4); }
2627 | TYPENAME ':' expr_no_commas maybe_attribute
2628 { $$ = parse_bitfield ($1, $4, $3); }
2629 ;
2630
2631 notype_component_declarator:
2632 notype_declarator maybeasm maybe_attribute maybe_init
2633 { $$ = parse_field ($1, $3, $2, $4); }
2634 | IDENTIFIER ':' expr_no_commas maybe_attribute
2635 { $$ = parse_bitfield ($1, $4, $3); }
2636 | ':' expr_no_commas maybe_attribute
2637 { $$ = parse_bitfield (NULL_TREE, $3, $2); }
2638 ;
2639
2640 enumlist_opt:
2641 enumlist maybecomma_warn
2642 | maybecomma_warn
2643 ;
2644
2645 /* We chain the enumerators in reverse order.
2646 Because of the way enums are built, the order is
2647 insignificant. Take advantage of this fact. */
2648
2649 enumlist:
2650 enumerator
2651 | enumlist ',' enumerator
2652 ;
2653
2654 enumerator:
2655 identifier
2656 { build_enumerator ($1, NULL_TREE, current_enum_type); }
2657 | identifier '=' expr_no_commas
2658 { build_enumerator ($1, $3, current_enum_type); }
2659 ;
2660
2661 /* ISO new-type-id (5.3.4) */
2662 new_type_id:
2663 type_specifier_seq new_declarator
2664 { $$.t = build_decl_list ($1.t, $2);
2665 $$.new_type_flag = $1.new_type_flag; }
2666 | type_specifier_seq %prec EMPTY
2667 { $$.t = build_decl_list ($1.t, NULL_TREE);
2668 $$.new_type_flag = $1.new_type_flag; }
2669 /* GNU extension to allow arrays of arbitrary types with
2670 non-constant dimension. */
2671 | '(' type_id ')' '[' expr ']'
2672 {
2673 if (pedantic)
2674 pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new");
2675 $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
2676 $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
2677 $$.new_type_flag = $2.new_type_flag;
2678 }
2679 ;
2680
2681 cv_qualifiers:
2682 /* empty */ %prec EMPTY
2683 { $$ = NULL_TREE; }
2684 | cv_qualifiers CV_QUALIFIER
2685 { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
2686 ;
2687
2688 nonempty_cv_qualifiers:
2689 CV_QUALIFIER
2690 { $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
2691 $$.new_type_flag = 0; }
2692 | nonempty_cv_qualifiers CV_QUALIFIER
2693 { $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
2694 $$.new_type_flag = $1.new_type_flag; }
2695 ;
2696
2697 /* These rules must follow the rules for function declarations
2698 and component declarations. That way, longer rules are preferred. */
2699
2700 /* An expression which will not live on the momentary obstack. */
2701 maybe_parmlist:
2702 '(' nonnull_exprlist ')'
2703 { $$ = $2; }
2704 | '(' parmlist ')'
2705 { $$ = $2; }
2706 | LEFT_RIGHT
2707 { $$ = empty_parms (); }
2708 | '(' error ')'
2709 { $$ = NULL_TREE; }
2710 ;
2711
2712 /* A declarator that is allowed only after an explicit typespec. */
2713
2714 after_type_declarator_intern:
2715 after_type_declarator
2716 | attributes after_type_declarator
2717 {
2718 /* Provide support for '(' attributes '*' declarator ')'
2719 etc */
2720 $$ = decl_tree_cons ($1, $2, NULL_TREE);
2721 }
2722 ;
2723
2724 /* may all be followed by prec '.' */
2725 after_type_declarator:
2726 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2727 { $$ = make_pointer_declarator ($2.t, $3); }
2728 | '&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2729 { $$ = make_reference_declarator ($2.t, $3); }
2730 | '*' after_type_declarator_intern %prec UNARY
2731 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2732 | '&' after_type_declarator_intern %prec UNARY
2733 { $$ = make_reference_declarator (NULL_TREE, $2); }
2734 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2735 { tree arg = make_pointer_declarator ($2, $3);
2736 $$ = build_parse_node (SCOPE_REF, $1, arg);
2737 }
2738 | direct_after_type_declarator
2739 ;
2740
2741 direct_after_type_declarator:
2742 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2743 { $$ = make_call_declarator ($$, $2, $3, $4); }
2744 | direct_after_type_declarator '[' expr ']'
2745 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2746 | direct_after_type_declarator '[' ']'
2747 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2748 | '(' after_type_declarator_intern ')'
2749 { $$ = $2; }
2750 | nested_name_specifier type_name %prec EMPTY
2751 { push_nested_class ($1, 3);
2752 $$ = build_parse_node (SCOPE_REF, $$, $2);
2753 TREE_COMPLEXITY ($$) = current_class_depth; }
2754 | type_name %prec EMPTY
2755 ;
2756
2757 nonnested_type:
2758 type_name %prec EMPTY
2759 {
2760 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2761 {
2762 $$ = lookup_name ($1, 1);
2763 maybe_note_name_used_in_class ($1, $$);
2764 }
2765 else
2766 $$ = $1;
2767 }
2768 | global_scope type_name
2769 {
2770 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2771 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
2772 else
2773 $$ = $2;
2774 got_scope = NULL_TREE;
2775 }
2776 ;
2777
2778 complete_type_name:
2779 nonnested_type
2780 | nested_type
2781 | global_scope nested_type
2782 { $$ = $2; }
2783 ;
2784
2785 nested_type:
2786 nested_name_specifier type_name %prec EMPTY
2787 { $$ = get_type_decl ($2); }
2788 ;
2789
2790 /* A declarator allowed whether or not there has been
2791 an explicit typespec. These cannot redeclare a typedef-name. */
2792
2793 notype_declarator_intern:
2794 notype_declarator
2795 | attributes notype_declarator
2796 {
2797 /* Provide support for '(' attributes '*' declarator ')'
2798 etc */
2799 $$ = decl_tree_cons ($1, $2, NULL_TREE);
2800 }
2801 ;
2802
2803 notype_declarator:
2804 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2805 { $$ = make_pointer_declarator ($2.t, $3); }
2806 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2807 { $$ = make_reference_declarator ($2.t, $3); }
2808 | '*' notype_declarator_intern %prec UNARY
2809 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2810 | '&' notype_declarator_intern %prec UNARY
2811 { $$ = make_reference_declarator (NULL_TREE, $2); }
2812 | ptr_to_mem cv_qualifiers notype_declarator_intern
2813 { tree arg = make_pointer_declarator ($2, $3);
2814 $$ = build_parse_node (SCOPE_REF, $1, arg);
2815 }
2816 | direct_notype_declarator
2817 ;
2818
2819 complex_notype_declarator:
2820 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2821 { $$ = make_pointer_declarator ($2.t, $3); }
2822 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2823 { $$ = make_reference_declarator ($2.t, $3); }
2824 | '*' complex_notype_declarator %prec UNARY
2825 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2826 | '&' complex_notype_declarator %prec UNARY
2827 { $$ = make_reference_declarator (NULL_TREE, $2); }
2828 | ptr_to_mem cv_qualifiers notype_declarator_intern
2829 { tree arg = make_pointer_declarator ($2, $3);
2830 $$ = build_parse_node (SCOPE_REF, $1, arg);
2831 }
2832 | complex_direct_notype_declarator
2833 ;
2834
2835 complex_direct_notype_declarator:
2836 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2837 { $$ = make_call_declarator ($$, $2, $3, $4); }
2838 | '(' complex_notype_declarator ')'
2839 { $$ = $2; }
2840 | direct_notype_declarator '[' expr ']'
2841 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2842 | direct_notype_declarator '[' ']'
2843 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2844 | notype_qualified_id
2845 { enter_scope_of ($1); }
2846 | nested_name_specifier notype_template_declarator
2847 { got_scope = NULL_TREE;
2848 $$ = build_parse_node (SCOPE_REF, $1, $2);
2849 enter_scope_of ($$);
2850 }
2851 ;
2852
2853 qualified_id:
2854 nested_name_specifier unqualified_id
2855 { got_scope = NULL_TREE;
2856 $$ = build_parse_node (SCOPE_REF, $$, $2); }
2857 | nested_name_specifier object_template_id
2858 { got_scope = NULL_TREE;
2859 $$ = build_parse_node (SCOPE_REF, $1, $2); }
2860 ;
2861
2862 notype_qualified_id:
2863 nested_name_specifier notype_unqualified_id
2864 { got_scope = NULL_TREE;
2865 $$ = build_parse_node (SCOPE_REF, $$, $2); }
2866 | nested_name_specifier object_template_id
2867 { got_scope = NULL_TREE;
2868 $$ = build_parse_node (SCOPE_REF, $1, $2); }
2869 ;
2870
2871 overqualified_id:
2872 notype_qualified_id
2873 | global_scope notype_qualified_id
2874 { $$ = $2; }
2875 ;
2876
2877 functional_cast:
2878 typespec '(' nonnull_exprlist ')'
2879 { $$ = build_functional_cast ($1.t, $3); }
2880 | typespec '(' expr_or_declarator_intern ')'
2881 { $$ = reparse_decl_as_expr ($1.t, $3); }
2882 | typespec fcast_or_absdcl %prec EMPTY
2883 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
2884 ;
2885
2886 type_name:
2887 TYPENAME
2888 | SELFNAME
2889 | template_type %prec EMPTY
2890 ;
2891
2892 nested_name_specifier:
2893 nested_name_specifier_1
2894 | nested_name_specifier nested_name_specifier_1
2895 { $$ = $2; }
2896 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
2897 { got_scope = $$
2898 = make_typename_type ($1, $3, /*complain=*/1); }
2899 ;
2900
2901 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
2902 inline here?!? (jason) */
2903 nested_name_specifier_1:
2904 TYPENAME SCOPE
2905 {
2906 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2907 {
2908 $$ = lastiddecl;
2909 maybe_note_name_used_in_class ($1, $$);
2910 }
2911 got_scope = $$ =
2912 complete_type (TYPE_MAIN_VARIANT (TREE_TYPE ($$)));
2913 }
2914 | SELFNAME SCOPE
2915 {
2916 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2917 $$ = lastiddecl;
2918 got_scope = $$ = TREE_TYPE ($$);
2919 }
2920 | NSNAME SCOPE
2921 {
2922 if (TREE_CODE ($$) == IDENTIFIER_NODE)
2923 $$ = lastiddecl;
2924 got_scope = $$;
2925 }
2926 | template_type SCOPE
2927 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
2928 /* These break 'const i;'
2929 | IDENTIFIER SCOPE
2930 {
2931 failed_scope:
2932 cp_error ("`%D' is not an aggregate typedef",
2933 lastiddecl ? lastiddecl : $$);
2934 $$ = error_mark_node;
2935 }
2936 | PTYPENAME SCOPE
2937 { goto failed_scope; } */
2938 ;
2939
2940 typename_sub:
2941 typename_sub0
2942 | global_scope typename_sub0
2943 { $$ = $2; }
2944 ;
2945
2946 typename_sub0:
2947 typename_sub1 identifier %prec EMPTY
2948 {
2949 if (TYPE_P ($1))
2950 $$ = make_typename_type ($1, $2, /*complain=*/1);
2951 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
2952 cp_error ("`%T' is not a class or namespace", $2);
2953 else
2954 {
2955 $$ = $2;
2956 if (TREE_CODE ($$) == TYPE_DECL)
2957 $$ = TREE_TYPE ($$);
2958 }
2959 }
2960 | typename_sub1 template_type %prec EMPTY
2961 { $$ = TREE_TYPE ($2); }
2962 | typename_sub1 explicit_template_type %prec EMPTY
2963 { $$ = make_typename_type ($1, $2, /*complain=*/1); }
2964 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
2965 { $$ = make_typename_type ($1, $3, /*complain=*/1); }
2966 ;
2967
2968 typename_sub1:
2969 typename_sub2
2970 {
2971 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2972 cp_error ("`%T' is not a class or namespace", $1);
2973 }
2974 | typename_sub1 typename_sub2
2975 {
2976 if (TYPE_P ($1))
2977 $$ = make_typename_type ($1, $2, /*complain=*/1);
2978 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
2979 cp_error ("`%T' is not a class or namespace", $2);
2980 else
2981 {
2982 $$ = $2;
2983 if (TREE_CODE ($$) == TYPE_DECL)
2984 $$ = TREE_TYPE ($$);
2985 }
2986 }
2987 | typename_sub1 explicit_template_type SCOPE
2988 { got_scope = $$
2989 = make_typename_type ($1, $2, /*complain=*/1); }
2990 | typename_sub1 TEMPLATE explicit_template_type SCOPE
2991 { got_scope = $$
2992 = make_typename_type ($1, $3, /*complain=*/1); }
2993 ;
2994
2995 typename_sub2:
2996 TYPENAME SCOPE
2997 {
2998 if (TREE_CODE ($1) != IDENTIFIER_NODE)
2999 $1 = lastiddecl;
3000
3001 /* Retrieve the type for the identifier, which might involve
3002 some computation. */
3003 got_scope = $$ = complete_type (IDENTIFIER_TYPE_VALUE ($1));
3004
3005 if ($$ == error_mark_node)
3006 cp_error ("`%T' is not a class or namespace", $1);
3007 }
3008 | SELFNAME SCOPE
3009 {
3010 if (TREE_CODE ($1) != IDENTIFIER_NODE)
3011 $$ = lastiddecl;
3012 got_scope = $$ = complete_type (TREE_TYPE ($$));
3013 }
3014 | template_type SCOPE
3015 { got_scope = $$ = complete_type (TREE_TYPE ($$)); }
3016 | PTYPENAME SCOPE
3017 | IDENTIFIER SCOPE
3018 | NSNAME SCOPE
3019 {
3020 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3021 $$ = lastiddecl;
3022 got_scope = $$;
3023 }
3024 ;
3025
3026 explicit_template_type:
3027 identifier '<' template_arg_list_opt template_close_bracket
3028 { $$ = build_min_nt (TEMPLATE_ID_EXPR, $1, $3); }
3029 ;
3030
3031 complex_type_name:
3032 global_scope type_name
3033 {
3034 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3035 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
3036 else
3037 $$ = $2;
3038 got_scope = NULL_TREE;
3039 }
3040 | nested_type
3041 | global_scope nested_type
3042 { $$ = $2; }
3043 ;
3044
3045 ptr_to_mem:
3046 nested_name_specifier '*'
3047 { got_scope = NULL_TREE; }
3048 | global_scope nested_name_specifier '*'
3049 { $$ = $2; got_scope = NULL_TREE; }
3050 ;
3051
3052 /* All uses of explicit global scope must go through this nonterminal so
3053 that got_scope will be set before yylex is called to get the next token. */
3054 global_scope:
3055 SCOPE
3056 { got_scope = void_type_node; }
3057 ;
3058
3059 /* ISO new-declarator (5.3.4) */
3060 new_declarator:
3061 '*' cv_qualifiers new_declarator
3062 { $$ = make_pointer_declarator ($2, $3); }
3063 | '*' cv_qualifiers %prec EMPTY
3064 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3065 | '&' cv_qualifiers new_declarator %prec EMPTY
3066 { $$ = make_reference_declarator ($2, $3); }
3067 | '&' cv_qualifiers %prec EMPTY
3068 { $$ = make_reference_declarator ($2, NULL_TREE); }
3069 | ptr_to_mem cv_qualifiers %prec EMPTY
3070 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3071 $$ = build_parse_node (SCOPE_REF, $1, arg);
3072 }
3073 | ptr_to_mem cv_qualifiers new_declarator
3074 { tree arg = make_pointer_declarator ($2, $3);
3075 $$ = build_parse_node (SCOPE_REF, $1, arg);
3076 }
3077 | direct_new_declarator %prec EMPTY
3078 ;
3079
3080 /* ISO direct-new-declarator (5.3.4) */
3081 direct_new_declarator:
3082 '[' expr ']'
3083 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3084 | direct_new_declarator '[' expr ']'
3085 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3086 ;
3087
3088 absdcl_intern:
3089 absdcl
3090 | attributes absdcl
3091 {
3092 /* Provide support for '(' attributes '*' declarator ')'
3093 etc */
3094 $$ = decl_tree_cons ($1, $2, NULL_TREE);
3095 }
3096 ;
3097
3098 /* ISO abstract-declarator (8.1) */
3099 absdcl:
3100 '*' nonempty_cv_qualifiers absdcl_intern
3101 { $$ = make_pointer_declarator ($2.t, $3); }
3102 | '*' absdcl_intern
3103 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3104 | '*' nonempty_cv_qualifiers %prec EMPTY
3105 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3106 | '*' %prec EMPTY
3107 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3108 | '&' nonempty_cv_qualifiers absdcl_intern
3109 { $$ = make_reference_declarator ($2.t, $3); }
3110 | '&' absdcl_intern
3111 { $$ = make_reference_declarator (NULL_TREE, $2); }
3112 | '&' nonempty_cv_qualifiers %prec EMPTY
3113 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3114 | '&' %prec EMPTY
3115 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3116 | ptr_to_mem cv_qualifiers %prec EMPTY
3117 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3118 $$ = build_parse_node (SCOPE_REF, $1, arg);
3119 }
3120 | ptr_to_mem cv_qualifiers absdcl_intern
3121 { tree arg = make_pointer_declarator ($2, $3);
3122 $$ = build_parse_node (SCOPE_REF, $1, arg);
3123 }
3124 | direct_abstract_declarator %prec EMPTY
3125 ;
3126
3127 /* ISO direct-abstract-declarator (8.1) */
3128 direct_abstract_declarator:
3129 '(' absdcl_intern ')'
3130 { $$ = $2; }
3131 /* `(typedef)1' is `int'. */
3132 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3133 { $$ = make_call_declarator ($$, $3, $5, $6); }
3134 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3135 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3136 | direct_abstract_declarator '[' expr ']' %prec '.'
3137 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3138 | direct_abstract_declarator '[' ']' %prec '.'
3139 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3140 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3141 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3142 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3143 { set_quals_and_spec ($$, $2, $3); }
3144 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3145 { set_quals_and_spec ($$, $2, $3); }
3146 | '[' expr ']' %prec '.'
3147 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3148 | '[' ']' %prec '.'
3149 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
3150 ;
3151
3152 /* For C++, decls and stmts can be intermixed, so we don't need to
3153 have a special rule that won't start parsing the stmt section
3154 until we have a stmt that parses without errors. */
3155
3156 stmts:
3157 stmt
3158 | errstmt
3159 | stmts stmt
3160 | stmts errstmt
3161 ;
3162
3163 errstmt:
3164 error ';'
3165 ;
3166
3167 /* Read zero or more forward-declarations for labels
3168 that nested functions can jump to. */
3169 maybe_label_decls:
3170 /* empty */
3171 | label_decls
3172 { if (pedantic)
3173 pedwarn ("ISO C++ forbids label declarations"); }
3174 ;
3175
3176 label_decls:
3177 label_decl
3178 | label_decls label_decl
3179 ;
3180
3181 label_decl:
3182 LABEL identifiers_or_typenames ';'
3183 {
3184 while ($2)
3185 {
3186 finish_label_decl (TREE_VALUE ($2));
3187 $2 = TREE_CHAIN ($2);
3188 }
3189 }
3190 ;
3191
3192 /* This is the body of a function definition.
3193 It causes syntax errors to ignore to the next openbrace. */
3194 compstmt_or_error:
3195 compstmt
3196 {}
3197 | error compstmt
3198 ;
3199
3200 compstmt:
3201 '{'
3202 { $<ttype>$ = begin_compound_stmt (0); }
3203 compstmtend
3204 { $$ = finish_compound_stmt (0, $<ttype>2); }
3205 ;
3206
3207 simple_if:
3208 IF
3209 {
3210 $<ttype>$ = begin_if_stmt ();
3211 cond_stmt_keyword = "if";
3212 }
3213 paren_cond_or_null
3214 { finish_if_stmt_cond ($3, $<ttype>2); }
3215 implicitly_scoped_stmt
3216 { $<ttype>$ = finish_then_clause ($<ttype>2); }
3217 ;
3218
3219 implicitly_scoped_stmt:
3220 compstmt
3221 | { $<ttype>$ = begin_compound_stmt (0); }
3222 simple_stmt
3223 { $$ = finish_compound_stmt (0, $<ttype>1); }
3224 ;
3225
3226 stmt:
3227 compstmt
3228 {}
3229 | simple_stmt
3230 ;
3231
3232 simple_stmt:
3233 decl
3234 { finish_stmt (); }
3235 | expr ';'
3236 { finish_expr_stmt ($1); }
3237 | simple_if ELSE
3238 { begin_else_clause (); }
3239 implicitly_scoped_stmt
3240 {
3241 finish_else_clause ($<ttype>1);
3242 finish_if_stmt ();
3243 }
3244 | simple_if %prec IF
3245 { finish_if_stmt (); }
3246 | WHILE
3247 {
3248 $<ttype>$ = begin_while_stmt ();
3249 cond_stmt_keyword = "while";
3250 }
3251 paren_cond_or_null
3252 { finish_while_stmt_cond ($3, $<ttype>2); }
3253 already_scoped_stmt
3254 { finish_while_stmt ($<ttype>2); }
3255 | DO
3256 { $<ttype>$ = begin_do_stmt (); }
3257 implicitly_scoped_stmt WHILE
3258 {
3259 finish_do_body ($<ttype>2);
3260 cond_stmt_keyword = "do";
3261 }
3262 paren_expr_or_null ';'
3263 { finish_do_stmt ($6, $<ttype>2); }
3264 | FOR
3265 { $<ttype>$ = begin_for_stmt (); }
3266 '(' for.init.statement
3267 { finish_for_init_stmt ($<ttype>2); }
3268 xcond ';'
3269 { finish_for_cond ($6, $<ttype>2); }
3270 xexpr ')'
3271 { finish_for_expr ($9, $<ttype>2); }
3272 already_scoped_stmt
3273 { finish_for_stmt ($9, $<ttype>2); }
3274 | SWITCH
3275 { $<ttype>$ = begin_switch_stmt (); }
3276 '(' condition ')'
3277 { finish_switch_cond ($4, $<ttype>2); }
3278 implicitly_scoped_stmt
3279 { finish_switch_stmt ($4, $<ttype>2); }
3280 | CASE expr_no_commas ':'
3281 { finish_case_label ($2, NULL_TREE); }
3282 stmt
3283 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3284 { finish_case_label ($2, $4); }
3285 stmt
3286 | DEFAULT ':'
3287 { finish_case_label (NULL_TREE, NULL_TREE); }
3288 stmt
3289 | BREAK ';'
3290 { finish_break_stmt (); }
3291 | CONTINUE ';'
3292 { finish_continue_stmt (); }
3293 | RETURN_KEYWORD ';'
3294 { finish_return_stmt (NULL_TREE); }
3295 | RETURN_KEYWORD expr ';'
3296 { finish_return_stmt ($2); }
3297 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3298 {
3299 finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE,
3300 NULL_TREE);
3301 }
3302 /* This is the case with just output operands. */
3303 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3304 {
3305 finish_asm_stmt ($2, $4, $6, NULL_TREE,
3306 NULL_TREE);
3307 }
3308 /* This is the case with input operands as well. */
3309 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
3310 { finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
3311 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ')' ';'
3312 { finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); }
3313 /* This is the case with clobbered registers as well. */
3314 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3315 asm_operands ':' asm_clobbers ')' ';'
3316 { finish_asm_stmt ($2, $4, $6, $8, $10); }
3317 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ':'
3318 asm_clobbers ')' ';'
3319 { finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); }
3320 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands SCOPE
3321 asm_clobbers ')' ';'
3322 { finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
3323 | GOTO '*' expr ';'
3324 {
3325 if (pedantic)
3326 pedwarn ("ISO C++ forbids computed gotos");
3327 finish_goto_stmt ($3);
3328 }
3329 | GOTO identifier ';'
3330 { finish_goto_stmt ($2); }
3331 | label_colon stmt
3332 | label_colon '}'
3333 { error ("label must be followed by statement");
3334 yyungetc ('}', 0); }
3335 | ';'
3336 { finish_stmt (); }
3337 | try_block
3338 | using_directive
3339 | namespace_using_decl
3340 { do_local_using_decl ($1); }
3341 | namespace_alias
3342 ;
3343
3344 function_try_block:
3345 TRY
3346 { $<ttype>$ = begin_function_try_block (); }
3347 ctor_initializer_opt compstmt
3348 { finish_function_try_block ($<ttype>2); }
3349 handler_seq
3350 {
3351 finish_function_handler_sequence ($<ttype>2);
3352 $$ = $3;
3353 }
3354 ;
3355
3356 try_block:
3357 TRY
3358 { $<ttype>$ = begin_try_block (); }
3359 compstmt
3360 { finish_try_block ($<ttype>2); }
3361 handler_seq
3362 { finish_handler_sequence ($<ttype>2); }
3363 ;
3364
3365 handler_seq:
3366 handler
3367 | handler_seq handler
3368 ;
3369
3370 handler:
3371 CATCH
3372 { $<ttype>$ = begin_handler(); }
3373 handler_args
3374 { $<ttype>$ = finish_handler_parms ($3, $<ttype>2); }
3375 compstmt
3376 { finish_handler ($<ttype>4, $<ttype>2); }
3377 ;
3378
3379 type_specifier_seq:
3380 typed_typespecs %prec EMPTY
3381 | nonempty_cv_qualifiers %prec EMPTY
3382 ;
3383
3384 handler_args:
3385 '(' ELLIPSIS ')'
3386 { $$ = NULL_TREE; }
3387 /* This doesn't allow reference parameters, the below does.
3388 | '(' type_specifier_seq absdcl ')'
3389 { check_for_new_type ("inside exception declarations", $2);
3390 expand_start_catch_block ($2.t, $3); }
3391 | '(' type_specifier_seq ')'
3392 { check_for_new_type ("inside exception declarations", $2);
3393 expand_start_catch_block ($2.t, NULL_TREE); }
3394 | '(' type_specifier_seq notype_declarator ')'
3395 { check_for_new_type ("inside exception declarations", $2);
3396 expand_start_catch_block ($2.t, $3); }
3397 | '(' typed_typespecs after_type_declarator ')'
3398 { check_for_new_type ("inside exception declarations", $2);
3399 expand_start_catch_block ($2.t, $3); }
3400 This allows reference parameters... */
3401 | '(' parm ')'
3402 {
3403 check_for_new_type ("inside exception declarations", $2);
3404 $$ = start_handler_parms (TREE_PURPOSE ($2.t),
3405 TREE_VALUE ($2.t));
3406 }
3407 ;
3408
3409 label_colon:
3410 IDENTIFIER ':'
3411 { finish_label_stmt ($1); }
3412 | PTYPENAME ':'
3413 { finish_label_stmt ($1); }
3414 | TYPENAME ':'
3415 { finish_label_stmt ($1); }
3416 | SELFNAME ':'
3417 { finish_label_stmt ($1); }
3418 ;
3419
3420 for.init.statement:
3421 xexpr ';'
3422 { finish_expr_stmt ($1); }
3423 | decl
3424 | '{' compstmtend
3425 { if (pedantic)
3426 pedwarn ("ISO C++ forbids compound statements inside for initializations");
3427 }
3428 ;
3429
3430 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3431
3432 maybe_cv_qualifier:
3433 /* empty */
3434 { $$ = NULL_TREE; }
3435 | CV_QUALIFIER
3436 ;
3437
3438 xexpr:
3439 /* empty */
3440 { $$ = NULL_TREE; }
3441 | expr
3442 | error
3443 { $$ = NULL_TREE; }
3444 ;
3445
3446 /* These are the operands other than the first string and colon
3447 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3448 asm_operands:
3449 /* empty */
3450 { $$ = NULL_TREE; }
3451 | nonnull_asm_operands
3452 ;
3453
3454 nonnull_asm_operands:
3455 asm_operand
3456 | nonnull_asm_operands ',' asm_operand
3457 { $$ = chainon ($$, $3); }
3458 ;
3459
3460 asm_operand:
3461 STRING '(' expr ')'
3462 { $$ = build_tree_list ($$, $3); }
3463 ;
3464
3465 asm_clobbers:
3466 STRING
3467 { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
3468 | asm_clobbers ',' STRING
3469 { $$ = tree_cons (NULL_TREE, $3, $$); }
3470 ;
3471
3472 /* This is what appears inside the parens in a function declarator.
3473 Its value is represented in the format that grokdeclarator expects.
3474
3475 In C++, declaring a function with no parameters
3476 means that that function takes *no* parameters. */
3477
3478 parmlist:
3479 /* empty */
3480 {
3481 $$ = empty_parms();
3482 }
3483 | complex_parmlist
3484 | type_id
3485 { $$ = finish_parmlist (build_tree_list (NULL_TREE, $1.t), 0);
3486 check_for_new_type ("inside parameter list", $1); }
3487 ;
3488
3489 /* This nonterminal does not include the common sequence '(' type_id ')',
3490 as it is ambiguous and must be disambiguated elsewhere. */
3491 complex_parmlist:
3492 parms
3493 { $$ = finish_parmlist ($$, 0); }
3494 | parms_comma ELLIPSIS
3495 { $$ = finish_parmlist ($1, 1); }
3496 /* C++ allows an ellipsis without a separating ',' */
3497 | parms ELLIPSIS
3498 { $$ = finish_parmlist ($1, 1); }
3499 | type_id ELLIPSIS
3500 { $$ = finish_parmlist (build_tree_list (NULL_TREE,
3501 $1.t), 1); }
3502 | ELLIPSIS
3503 { $$ = finish_parmlist (NULL_TREE, 1); }
3504 | parms ':'
3505 {
3506 /* This helps us recover from really nasty
3507 parse errors, for example, a missing right
3508 parenthesis. */
3509 yyerror ("possibly missing ')'");
3510 $$ = finish_parmlist ($1, 0);
3511 yyungetc (':', 0);
3512 yychar = ')';
3513 }
3514 | type_id ':'
3515 {
3516 /* This helps us recover from really nasty
3517 parse errors, for example, a missing right
3518 parenthesis. */
3519 yyerror ("possibly missing ')'");
3520 $$ = finish_parmlist (build_tree_list (NULL_TREE,
3521 $1.t), 0);
3522 yyungetc (':', 0);
3523 yychar = ')';
3524 }
3525 ;
3526
3527 /* A default argument to a */
3528 defarg:
3529 '='
3530 { maybe_snarf_defarg (); }
3531 defarg1
3532 { $$ = $3; }
3533 ;
3534
3535 defarg1:
3536 DEFARG
3537 | init
3538 ;
3539
3540 /* A nonempty list of parameter declarations or type names. */
3541 parms:
3542 named_parm
3543 { check_for_new_type ("in a parameter list", $1);
3544 $$ = build_tree_list (NULL_TREE, $1.t); }
3545 | parm defarg
3546 { check_for_new_type ("in a parameter list", $1);
3547 $$ = build_tree_list ($2, $1.t); }
3548 | parms_comma full_parm
3549 { check_for_new_type ("in a parameter list", $2);
3550 $$ = chainon ($$, $2.t); }
3551 | parms_comma bad_parm
3552 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
3553 | parms_comma bad_parm '=' init
3554 { $$ = chainon ($$, build_tree_list ($4, $2)); }
3555 ;
3556
3557 parms_comma:
3558 parms ','
3559 | type_id ','
3560 { check_for_new_type ("in a parameter list", $1);
3561 $$ = build_tree_list (NULL_TREE, $1.t); }
3562 ;
3563
3564 /* A single parameter declaration or parameter type name,
3565 as found in a parmlist. */
3566 named_parm:
3567 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3568 TYPESPEC IDENTIFIER. */
3569 typed_declspecs1 declarator
3570 { tree specs = strip_attrs ($1.t);
3571 $$.new_type_flag = $1.new_type_flag;
3572 $$.t = build_tree_list (specs, $2); }
3573 | typed_typespecs declarator
3574 { $$.t = build_tree_list ($1.t, $2);
3575 $$.new_type_flag = $1.new_type_flag; }
3576 | typespec declarator
3577 { $$.t = build_tree_list (build_decl_list (NULL_TREE, $1.t),
3578 $2);
3579 $$.new_type_flag = $1.new_type_flag; }
3580 | typed_declspecs1 absdcl
3581 { tree specs = strip_attrs ($1.t);
3582 $$.t = build_tree_list (specs, $2);
3583 $$.new_type_flag = $1.new_type_flag; }
3584 | typed_declspecs1 %prec EMPTY
3585 { tree specs = strip_attrs ($1.t);
3586 $$.t = build_tree_list (specs, NULL_TREE);
3587 $$.new_type_flag = $1.new_type_flag; }
3588 | declmods notype_declarator
3589 { tree specs = strip_attrs ($1.t);
3590 $$.t = build_tree_list (specs, $2);
3591 $$.new_type_flag = 0; }
3592 ;
3593
3594 full_parm:
3595 parm
3596 { $$.t = build_tree_list (NULL_TREE, $1.t);
3597 $$.new_type_flag = $1.new_type_flag; }
3598 | parm defarg
3599 { $$.t = build_tree_list ($2, $1.t);
3600 $$.new_type_flag = $1.new_type_flag; }
3601 ;
3602
3603 parm:
3604 named_parm
3605 | type_id
3606 ;
3607
3608 see_typename:
3609 /* empty */ %prec EMPTY
3610 { see_typename (); }
3611 ;
3612
3613 bad_parm:
3614 /* empty */ %prec EMPTY
3615 {
3616 error ("type specifier omitted for parameter");
3617 $$ = build_tree_list (integer_type_node, NULL_TREE);
3618 }
3619 | notype_declarator
3620 {
3621 error ("type specifier omitted for parameter");
3622 if (TREE_CODE ($$) == SCOPE_REF
3623 && (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM
3624 || TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TEMPLATE_PARM))
3625 cp_error (" perhaps you want `typename %E' to make it a type", $$);
3626 $$ = build_tree_list (integer_type_node, $$);
3627 }
3628 ;
3629
3630 exception_specification_opt:
3631 /* empty */ %prec EMPTY
3632 { $$ = NULL_TREE; }
3633 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
3634 { $$ = $3; }
3635 | THROW LEFT_RIGHT %prec EMPTY
3636 { $$ = empty_except_spec; }
3637 ;
3638
3639 ansi_raise_identifier:
3640 type_id
3641 {
3642 check_for_new_type ("exception specifier", $1);
3643 $$ = groktypename ($1.t);
3644 }
3645 ;
3646
3647 ansi_raise_identifiers:
3648 ansi_raise_identifier
3649 { $$ = add_exception_specifier (NULL_TREE, $1, 1); }
3650 | ansi_raise_identifiers ',' ansi_raise_identifier
3651 { $$ = add_exception_specifier ($1, $3, 1); }
3652 ;
3653
3654 conversion_declarator:
3655 /* empty */ %prec EMPTY
3656 { $$ = NULL_TREE; }
3657 | '*' cv_qualifiers conversion_declarator
3658 { $$ = make_pointer_declarator ($2, $3); }
3659 | '&' cv_qualifiers conversion_declarator
3660 { $$ = make_reference_declarator ($2, $3); }
3661 | ptr_to_mem cv_qualifiers conversion_declarator
3662 { tree arg = make_pointer_declarator ($2, $3);
3663 $$ = build_parse_node (SCOPE_REF, $1, arg);
3664 }
3665 ;
3666
3667 operator:
3668 OPERATOR
3669 { got_scope = NULL_TREE; }
3670 ;
3671
3672 operator_name:
3673 operator '*'
3674 { $$ = ansi_opname[MULT_EXPR]; }
3675 | operator '/'
3676 { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
3677 | operator '%'
3678 { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
3679 | operator '+'
3680 { $$ = ansi_opname[PLUS_EXPR]; }
3681 | operator '-'
3682 { $$ = ansi_opname[MINUS_EXPR]; }
3683 | operator '&'
3684 { $$ = ansi_opname[BIT_AND_EXPR]; }
3685 | operator '|'
3686 { $$ = ansi_opname[BIT_IOR_EXPR]; }
3687 | operator '^'
3688 { $$ = ansi_opname[BIT_XOR_EXPR]; }
3689 | operator '~'
3690 { $$ = ansi_opname[BIT_NOT_EXPR]; }
3691 | operator ','
3692 { $$ = ansi_opname[COMPOUND_EXPR]; }
3693 | operator ARITHCOMPARE
3694 { $$ = ansi_opname[$2]; }
3695 | operator '<'
3696 { $$ = ansi_opname[LT_EXPR]; }
3697 | operator '>'
3698 { $$ = ansi_opname[GT_EXPR]; }
3699 | operator EQCOMPARE
3700 { $$ = ansi_opname[$2]; }
3701 | operator ASSIGN
3702 { $$ = ansi_assopname[$2]; }
3703 | operator '='
3704 { $$ = ansi_opname [MODIFY_EXPR]; }
3705 | operator LSHIFT
3706 { $$ = ansi_opname[$2]; }
3707 | operator RSHIFT
3708 { $$ = ansi_opname[$2]; }
3709 | operator PLUSPLUS
3710 { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
3711 | operator MINUSMINUS
3712 { $$ = ansi_opname[PREDECREMENT_EXPR]; }
3713 | operator ANDAND
3714 { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
3715 | operator OROR
3716 { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
3717 | operator '!'
3718 { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
3719 | operator '?' ':'
3720 { $$ = ansi_opname[COND_EXPR]; }
3721 | operator MIN_MAX
3722 { $$ = ansi_opname[$2]; }
3723 | operator POINTSAT %prec EMPTY
3724 { $$ = ansi_opname[COMPONENT_REF]; }
3725 | operator POINTSAT_STAR %prec EMPTY
3726 { $$ = ansi_opname[MEMBER_REF]; }
3727 | operator LEFT_RIGHT
3728 { $$ = ansi_opname[CALL_EXPR]; }
3729 | operator '[' ']'
3730 { $$ = ansi_opname[ARRAY_REF]; }
3731 | operator NEW %prec EMPTY
3732 { $$ = ansi_opname[NEW_EXPR]; }
3733 | operator DELETE %prec EMPTY
3734 { $$ = ansi_opname[DELETE_EXPR]; }
3735 | operator NEW '[' ']'
3736 { $$ = ansi_opname[VEC_NEW_EXPR]; }
3737 | operator DELETE '[' ']'
3738 { $$ = ansi_opname[VEC_DELETE_EXPR]; }
3739 /* Names here should be looked up in class scope ALSO. */
3740 | operator type_specifier_seq conversion_declarator
3741 { $$ = grokoptypename ($2.t, $3); }
3742 | operator error
3743 { $$ = ansi_opname[ERROR_MARK]; }
3744 ;
3745
3746 %%
3747
3748 #ifdef SPEW_DEBUG
3749 const char *
3750 debug_yytranslate (value)
3751 int value;
3752 {
3753 return yytname[YYTRANSLATE (value)];
3754 }
3755
3756 #endif
This page took 0.19939 seconds and 5 git commands to generate.