diff options
author | Keith Seitz <keiths@redhat.com> | 2009-08-25 18:40:45 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2009-08-25 18:40:45 +0000 |
commit | ec7f2efef84eae8bf6a1228c1d27fd2c19db5408 (patch) | |
tree | 2b82d8aeaa0be31a52ae5c5f5af98e949ff5d3a5 /gdb/c-exp.y | |
parent | 3a1ff0b63931e01abd4700ea265be2b72005be75 (diff) | |
download | gdb-ec7f2efef84eae8bf6a1228c1d27fd2c19db5408.zip gdb-ec7f2efef84eae8bf6a1228c1d27fd2c19db5408.tar.gz gdb-ec7f2efef84eae8bf6a1228c1d27fd2c19db5408.tar.bz2 |
* c-exp.y (yylex): Add cxx_only check for tokentab2 and tokentab3
searches.
(tokentab3): Add cxx_only for DOT_STAR.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r-- | gdb/c-exp.y | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y index fc41bfd..f8e4f12 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1683,6 +1683,8 @@ static const struct token tokentab2[] = {"->", ARROW, BINOP_END, 0}, {"&&", ANDAND, BINOP_END, 0}, {"||", OROR, BINOP_END, 0}, + /* "::" is *not* only C++: gdb overrides its meaning in several + different ways, e.g., 'filename'::func, function::variable. */ {"::", COLONCOLON, BINOP_END, 0}, {"<<", LSH, BINOP_END, 0}, {">>", RSH, BINOP_END, 0}, @@ -1690,7 +1692,7 @@ static const struct token tokentab2[] = {"!=", NOTEQUAL, BINOP_END, 0}, {"<=", LEQ, BINOP_END, 0}, {">=", GEQ, BINOP_END, 0}, - {".*", DOT_STAR, BINOP_END, 0} + {".*", DOT_STAR, BINOP_END, 1} }; /* Identifier-like tokens. */ @@ -1849,6 +1851,10 @@ yylex (void) for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) { + if (tokentab3[i].cxx_only + && parse_language->la_language != language_cplus) + break; + lexptr += 3; yylval.opcode = tokentab3[i].opcode; return tokentab3[i].token; @@ -1858,6 +1864,10 @@ yylex (void) for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) { + if (tokentab2[i].cxx_only + && parse_language->la_language != language_cplus) + break; + lexptr += 2; yylval.opcode = tokentab2[i].opcode; if (in_parse_field && tokentab2[i].token == ARROW) |