aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-11-29 06:59:17 +0000
committerFred Fish <fnf@specifix.com>1992-11-29 06:59:17 +0000
commitcbd1bdc3facc87ac2aa85108a721daf66e26a1a8 (patch)
treea6c21f74667bd10f3184ca897f3239827e709cca
parent2a20c602d9c556f02aa239f2285a01f68177c761 (diff)
downloadfsf-binutils-gdb-cbd1bdc3facc87ac2aa85108a721daf66e26a1a8.zip
fsf-binutils-gdb-cbd1bdc3facc87ac2aa85108a721daf66e26a1a8.tar.gz
fsf-binutils-gdb-cbd1bdc3facc87ac2aa85108a721daf66e26a1a8.tar.bz2
* ch-exp.y (GENERAL_PROCEDURE_NAME, LOCATION_NAME): New
terminal tokens. * ch-exp.y (access_name): New non-terminal token and production. * ch-exp.y (general_procedure_name): Now a terminal token. * ch-exp.y (location): Expand production. * ch-exp.y (match_simple_name_string): New function. * ch-exp.y (yylex): Call match_simple_name_string and return GENERAL_PROCEDURE_NAME or LOCATION_NAME as appropriate.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/ch-exp.y96
2 files changed, 104 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 37e4198..01512ad 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+ **** start-sanitize-chill ****
+Sat Nov 28 22:45:04 1992 Fred Fish (fnf@cygnus.com)
+
+ * ch-exp.y (GENERAL_PROCEDURE_NAME, LOCATION_NAME): New
+ terminal tokens.
+ * ch-exp.y (access_name): New non-terminal token and
+ production.
+ * ch-exp.y (general_procedure_name): Now a terminal token.
+ * ch-exp.y (location): Expand production.
+ * ch-exp.y (match_simple_name_string): New function.
+ * ch-exp.y (yylex): Call match_simple_name_string and return
+ GENERAL_PROCEDURE_NAME or LOCATION_NAME as appropriate.
+ **** end-sanitize-chill ****
+
Wed Nov 25 07:17:13 1992 Fred Fish (fnf@cygnus.com)
* munch: Backslash escape vertical bar characters inside
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y
index d9c985b..dc60729 100644
--- a/gdb/ch-exp.y
+++ b/gdb/ch-exp.y
@@ -151,6 +151,8 @@ static int parse_number PARAMS ((void));
%token <typed_val> INTEGER_LITERAL
%token <ulval> BOOLEAN_LITERAL
%token <typed_val> CHARACTER_LITERAL
+%token <ssym> GENERAL_PROCEDURE_NAME
+%token <ssym> LOCATION_NAME
%token <voidval> SET_LITERAL
%token <voidval> EMPTINESS_LITERAL
%token <voidval> CHARACTER_STRING_LITERAL
@@ -200,6 +202,7 @@ static int parse_number PARAMS ((void));
%token <voidval> ILLEGAL_TOKEN
%type <voidval> location
+%type <voidval> access_name
%type <voidval> primitive_value
%type <voidval> location_contents
%type <voidval> value_name
@@ -236,7 +239,6 @@ static int parse_number PARAMS ((void));
%type <voidval> value_enumeration_name
%type <voidval> value_do_with_name
%type <voidval> value_receive_name
-%type <voidval> general_procedure_name
%type <voidval> string_primitive_value
%type <voidval> start_element
%type <voidval> left_element
@@ -278,7 +280,25 @@ undefined_value : FIXME
/* Z.200, 4.2.1 */
-location : FIXME
+location : access_name
+ {
+ $$ = 0; /* FIXME */
+ }
+ | FIXME
+ {
+ $$ = 0; /* FIXME */
+ }
+ ;
+
+/* Z.200, 4.2.2 */
+
+access_name : LOCATION_NAME
+ {
+ write_exp_elt_opcode (OP_VAR_VALUE);
+ write_exp_elt_sym ($1.sym);
+ write_exp_elt_opcode (OP_VAR_VALUE);
+ }
+ | FIXME
{
$$ = 0; /* FIXME */
}
@@ -374,9 +394,11 @@ value_name : synonym_name
{
$$ = 0; /* FIXME */
}
- | general_procedure_name
+ | GENERAL_PROCEDURE_NAME
{
- $$ = 0; /* FIXME */
+ write_exp_elt_opcode (OP_VAR_VALUE);
+ write_exp_elt_sym ($1.sym);
+ write_exp_elt_opcode (OP_VAR_VALUE);
}
;
@@ -743,7 +765,6 @@ synonym_name : FIXME { $$ = 0; }
value_enumeration_name : FIXME { $$ = 0; }
value_do_with_name : FIXME { $$ = 0; }
value_receive_name : FIXME { $$ = 0; }
-general_procedure_name : FIXME { $$ = 0; }
string_primitive_value : FIXME { $$ = 0; }
start_element : FIXME { $$ = 0; }
left_element : FIXME { $$ = 0; }
@@ -765,6 +786,28 @@ buffer_location : FIXME { $$ = 0; }
%%
+/* Try to consume a simple name string token. If successful, returns
+ a pointer to a nullbyte terminated copy of the name that can be used
+ in symbol table lookups. If not successful, returns NULL. */
+
+static char *
+match_simple_name_string ()
+{
+ char *tokptr = lexptr;
+
+ if (isalpha (*tokptr))
+ {
+ do {
+ tokptr++;
+ } while (isalpha (*tokptr) || isdigit (*tokptr) || (*tokptr == '_'));
+ yylval.sval.ptr = lexptr;
+ yylval.sval.length = tokptr - lexptr;
+ lexptr = tokptr;
+ return (copy_name (yylval.sval));
+ }
+ return (NULL);
+}
+
/* Start looking for a value composed of valid digits as set by the base
in use. Note that '_' characters are valid anywhere, in any quantity,
and are simply ignored. Since we must find at least one valid digit,
@@ -1090,6 +1133,8 @@ yylex ()
{
unsigned int i;
int token;
+ char *simplename;
+ struct symbol *sym;
/* Skip over any leading whitespace. */
while (isspace (*lexptr))
@@ -1191,10 +1236,49 @@ yylex ()
return (BOOLEAN_LITERAL);
}
token = match_integer_literal ();
- if (token != 0);
+ if (token != 0)
{
return (token);
}
+
+ /* Try to match a simple name string, and if a match is found, then
+ further classify what sort of name it is and return an appropriate
+ token. Note that attempting to match a simple name string consumes
+ 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 ();
+ if (simplename != NULL)
+ {
+ sym = lookup_symbol (simplename, expression_context_block,
+ VAR_NAMESPACE, (int *) NULL,
+ (struct symtab **) NULL);
+ if (sym != NULL)
+ {
+ yylval.ssym.stoken.ptr = NULL;
+ yylval.ssym.stoken.length = 0;
+ yylval.ssym.sym = sym;
+ yylval.ssym.is_a_field_of_this = 0; /* FIXME, C++'ism */
+ switch (SYMBOL_CLASS (sym))
+ {
+ case LOC_BLOCK:
+ /* Found a procedure name. */
+ return (GENERAL_PROCEDURE_NAME);
+ case LOC_STATIC:
+ /* Found a global or local static variable. */
+ return (LOCATION_NAME);
+ }
+ }
+ else if (!have_full_symbols () && !have_partial_symbols ())
+ {
+ error ("No symbol table is loaded. Use the \"file\" command.");
+ }
+ else
+ {
+ error ("No symbol \"%s\" in current context.", simplename);
+ }
+ }
+
return (ILLEGAL_TOKEN);
}