aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1994-07-07 03:27:48 +0000
committerPer Bothner <per@bothner.com>1994-07-07 03:27:48 +0000
commitad86f717998e7dfe321dd21bdd4d3a8005db9c4e (patch)
treefa09e9a70c17f728a24c9fbda1fae4806ba7ace6
parent874a43273ce113676ef61b5dd779576fc4b3318b (diff)
downloadgdb-ad86f717998e7dfe321dd21bdd4d3a8005db9c4e.zip
gdb-ad86f717998e7dfe321dd21bdd4d3a8005db9c4e.tar.gz
gdb-ad86f717998e7dfe321dd21bdd4d3a8005db9c4e.tar.bz2
* ch-exp.y (match_simple_name_string): Don't lower-case here.
* ch-exp.y (yylex): First try name lookup using exact name typed by user; if that fails, try lower-cased name.
-rw-r--r--gdb/ch-exp.y31
1 files changed, 20 insertions, 11 deletions
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y
index 9525978..dc46d79 100644
--- a/gdb/ch-exp.y
+++ b/gdb/ch-exp.y
@@ -1053,9 +1053,6 @@ match_simple_name_string ()
yylval.sval.length = tokptr - lexptr;
lexptr = tokptr;
result = copy_name (yylval.sval);
- for (tokptr = result; *tokptr; tokptr++)
- if (isupper (*tokptr))
- *tokptr = tolower(*tokptr);
return result;
}
return (NULL);
@@ -1776,7 +1773,7 @@ yylex ()
{
unsigned int i;
int token;
- char *simplename;
+ char *inputname;
struct symbol *sym;
/* Skip over any leading whitespace. */
@@ -1888,10 +1885,16 @@ yylex ()
the token from lexptr, so we can't back out if we later find that
we can't classify what sort of name it is. */
- simplename = match_simple_name_string ();
+ inputname = match_simple_name_string ();
- if (simplename != NULL)
+ if (inputname != NULL)
{
+ char *simplename = (char*) alloca (strlen (inputname));
+
+ char *dptr = simplename, *sptr = inputname;
+ for (; *sptr; sptr++)
+ *dptr++ = isupper (*sptr) ? tolower(*sptr) : *sptr;
+
/* See if it is a reserved identifier. */
for (i = 0; i < sizeof (idtokentab) / sizeof (idtokentab[0]); i++)
{
@@ -1913,9 +1916,15 @@ yylex ()
return (BOOLEAN_LITERAL);
}
- sym = lookup_symbol (simplename, expression_context_block,
+ sym = lookup_symbol (inputname, expression_context_block,
VAR_NAMESPACE, (int *) NULL,
(struct symtab **) NULL);
+ if (sym == NULL && strcmp (inputname, simplename) != 0)
+ {
+ sym = lookup_symbol (simplename, expression_context_block,
+ VAR_NAMESPACE, (int *) NULL,
+ (struct symtab **) NULL);
+ }
if (sym != NULL)
{
yylval.ssym.stoken.ptr = NULL;
@@ -1956,7 +1965,7 @@ yylex ()
case LOC_UNDEF:
case LOC_CONST_BYTES:
case LOC_OPTIMIZED_OUT:
- error ("Symbol \"%s\" names no location.", simplename);
+ error ("Symbol \"%s\" names no location.", inputname);
break;
}
}
@@ -1966,7 +1975,7 @@ yylex ()
}
else
{
- error ("No symbol \"%s\" in current context.", simplename);
+ error ("No symbol \"%s\" in current context.", inputname);
}
}
@@ -1978,8 +1987,8 @@ yylex ()
case '.': /* Not float for example. */
lexptr++;
while (isspace (*lexptr)) lexptr++;
- simplename = match_simple_name_string ();
- if (!simplename)
+ inputname = match_simple_name_string ();
+ if (!inputname)
return '.';
return FIELD_NAME;
}