aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>1997-03-22 10:50:18 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>1997-03-22 10:50:18 +0000
commit0742270560b516a11e0b1a42c4f2ac865f390be8 (patch)
treeb64851703571b7cd62e1162a4c081f628cf5589f /gdb/c-exp.y
parentc81a76b311a313707e80af5de287a11008fc72bc (diff)
downloadgdb-0742270560b516a11e0b1a42c4f2ac865f390be8.zip
gdb-0742270560b516a11e0b1a42c4f2ac865f390be8.tar.gz
gdb-0742270560b516a11e0b1a42c4f2ac865f390be8.tar.bz2
* c-exp.y (yylex): Handle nested template parameter lists.
* symtab.c (decode_line_2): Fix test for valid choice number.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y35
1 files changed, 25 insertions, 10 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index d7d4235..a70691f 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1,5 +1,5 @@
/* YACC parser for C expressions, for GDB.
- Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996
+ Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996, 1997
Free Software Foundation, Inc.
This file is part of GDB.
@@ -1409,15 +1409,30 @@ yylex ()
(c == '_' || c == '$' || (c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
{
- if (c == '<')
- {
- int i = namelen;
- while (tokstart[++i] && tokstart[i] != '>');
- if (tokstart[i] == '>')
- namelen = i;
- }
- c = tokstart[++namelen];
- }
+ /* Template parameter lists are part of the name.
+ FIXME: This mishandles `print $a<4&&$a>3'. */
+
+ if (c == '<')
+ {
+ int i = namelen;
+ int nesting_level = 1;
+ while (tokstart[++i])
+ {
+ if (tokstart[i] == '<')
+ nesting_level++;
+ else if (tokstart[i] == '>')
+ {
+ if (--nesting_level == 0)
+ break;
+ }
+ }
+ if (tokstart[i] == '>')
+ namelen = i;
+ else
+ break;
+ }
+ c = tokstart[++namelen];
+ }
/* The token "if" terminates the expression and is NOT
removed from the input stream. */