/* YACC parser for C++ names, for GDB.
- Copyright (C) 2003-2005, 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 2003-2014 Free Software Foundation, Inc.
Parts of the lexer are based on c-exp.y from GDB.
#include "defs.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
-#include <string.h>
-
#include "safe-ctype.h"
-#include "libiberty.h"
#include "demangle.h"
#include "cp-support.h"
-#include "gdb_assert.h"
/* Bison does not make it easy to create a parser without global
state, unfortunately. Here are all the global variables used
;
operator : OPERATOR NEW
- { $$ = make_operator ("new", 3); }
+ {
+ /* Match the whitespacing of cplus_demangle_operators.
+ It would abort on unrecognized string otherwise. */
+ $$ = make_operator ("new", 3);
+ }
| OPERATOR DELETE
- { $$ = make_operator ("delete ", 1); }
+ {
+ /* Match the whitespacing of cplus_demangle_operators.
+ It would abort on unrecognized string otherwise. */
+ $$ = make_operator ("delete ", 1);
+ }
| OPERATOR NEW '[' ']'
- { $$ = make_operator ("new[]", 3); }
+ {
+ /* Match the whitespacing of cplus_demangle_operators.
+ It would abort on unrecognized string otherwise. */
+ $$ = make_operator ("new[]", 3);
+ }
| OPERATOR DELETE '[' ']'
- { $$ = make_operator ("delete[] ", 1); }
+ {
+ /* Match the whitespacing of cplus_demangle_operators.
+ It would abort on unrecognized string otherwise. */
+ $$ = make_operator ("delete[] ", 1);
+ }
| OPERATOR '+'
{ $$ = make_operator ("+", 2); }
| OPERATOR '-'
;
exp : SIZEOF '(' type ')' %prec UNARY
- { $$ = d_unary ("sizeof", $3); }
+ {
+ /* Match the whitespacing of cplus_demangle_operators.
+ It would abort on unrecognized string otherwise. */
+ $$ = d_unary ("sizeof ", $3);
+ }
;
/* C++. */