diff options
author | Daniel Jacobowitz <drow@false.org> | 2004-01-12 00:44:47 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2004-01-12 00:44:47 +0000 |
commit | af4f4b8396a6d5701b6bfd1d07f922ec9d12b4cd (patch) | |
tree | 0ffa0625c28f62acda5ed4e685d1b2e080f65103 | |
parent | be01fded5c79b543d9f28974a625fe4b05162a92 (diff) | |
download | fsf-binutils-gdb-af4f4b8396a6d5701b6bfd1d07f922ec9d12b4cd.zip fsf-binutils-gdb-af4f4b8396a6d5701b6bfd1d07f922ec9d12b4cd.tar.gz fsf-binutils-gdb-af4f4b8396a6d5701b6bfd1d07f922ec9d12b4cd.tar.bz2 |
* cp-names.y (orig_lexptr): New variable.
(exp1): New production for parenthesized references.
(yyerror): Print out complete string on parse error.
(demangled_name_to_comp, main): Set orig_lexptr.
-rw-r--r-- | gdb/ChangeLog.cplus | 7 | ||||
-rw-r--r-- | gdb/cp-names.y | 16 |
2 files changed, 19 insertions, 4 deletions
diff --git a/gdb/ChangeLog.cplus b/gdb/ChangeLog.cplus index 21de7a1..f485e89 100644 --- a/gdb/ChangeLog.cplus +++ b/gdb/ChangeLog.cplus @@ -1,3 +1,10 @@ +2004-01-11 Daniel Jacobowitz <drow@mvista.com> + + * cp-names.y (orig_lexptr): New variable. + (exp1): New production for parenthesized references. + (yyerror): Print out complete string on parse error. + (demangled_name_to_comp, main): Set orig_lexptr. + 2003-01-04 Daniel Jacobowitz <drow@mvista.com> * Makefile.in (cp_names_h): Remove. diff --git a/gdb/cp-names.y b/gdb/cp-names.y index 6661893..7fe33d8 100644 --- a/gdb/cp-names.y +++ b/gdb/cp-names.y @@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define IN_GDB #include "cp-demangle.h" -static const char *lexptr, *prev_lexptr; +static const char *lexptr, *prev_lexptr, *orig_lexptr; static struct d_comp *d_qualify (struct d_comp *, int, int); @@ -934,6 +934,13 @@ exp1 : exp '>' exp { $$ = d_binary (">", $1, $3); } ; +/* References. Not allowed everywhere in template parameters, only + at the top level, but treat them as expressions in case they are wrapped + in parentheses. */ +exp1 : '&' start + { $$ = cp_v3_d_make_comp (di, D_COMP_UNARY, cp_v3_d_make_operator_from_string (di, "&"), $2); } + ; + /* Expressions, not including the comma operator. */ exp : '-' exp %prec UNARY { $$ = d_unary ("-", $2); } @@ -1989,6 +1996,7 @@ yyerror (msg) if (prev_lexptr) lexptr = prev_lexptr; + printf ("Orig expression: %s\n", orig_lexptr); error ("A %s in expression, near `%s'.\n", (msg ? msg : "error"), lexptr); } @@ -2043,7 +2051,7 @@ demangled_name_to_comp (const char *demangled_name, struct d_info **di_p) int len = strlen (demangled_name); len = len + len / 8; - lexptr = demangled_name; + orig_lexptr = lexptr = demangled_name; di = cp_v3_d_init_info_alloc (NULL, DMGL_PARAMS | DMGL_ANSI, len); @@ -2155,7 +2163,7 @@ main (int argc, char **argv) /* Use DMGL_VERBOSE to get expanded standard substitutions. */ c = trim_chars (buf, &extra_chars); str2 = cplus_demangle (buf, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE); - lexptr = str2; + orig_lexptr = lexptr = str2; if (lexptr == NULL) { /* printf ("Demangling error\n"); */ @@ -2182,7 +2190,7 @@ main (int argc, char **argv) else { int len; - lexptr = argv[arg]; + orig_lexptr = lexptr = argv[arg]; len = strlen (lexptr); di = cp_v3_d_init_info_alloc (NULL, DMGL_PARAMS | DMGL_ANSI, len); if (yyparse () || result == NULL) |